Operating System

Tuesday, April 9, 2019

Can we have only try block in Java without catch/finally?

Leave a Comment

Question 
Yes
No

Explanation: try block should have at least catch or finally block with it

public class HelloWorld{

     public static void main(String []args){
        try{
            System.out.println(1/0);
            
        }
     }
}
Above code gives "'try' without 'catch', 'finally' or resource declarations error"
public class HelloWorld{
     public static void main(String []args){
        try{
            System.out.println(1/0);
        }catch(Exception e){
            System.out.println("catch");
        }
     }
}
Above code compiles properly

public class HelloWorld{
     public static void main(String []args){
        try{
            System.out.println("try");
        }finally{
            System.out.println("finally");
        }
     }
}
Above code compiles properly
Read More

Can we have return statement inside finally block?

Leave a Comment
Question 
Yes
NO

Read More

Can we have return statement inside catch block?

Leave a Comment
Question 
Yes
NO

Read More

Can we have return statement inside try block?

Leave a Comment
Question 
Yes
NO
Read More

Monday, July 13, 2015

Which of the given option is NOT TRUE?

Leave a Comment
Which of the given option is  NOT TRUE?
SELECT cannot retrive data from more than one table 
UPDATE command can update only one table at a time 
SAVEPOINT identifies a point in a transaction to which you can later roll back 
INSERT adds data into a table 
Read More

The command to eliminate a table from a database is:________

Leave a Comment
The command to eliminate a table from a database is:________
REMOVE TABLE CUSTOMER; 
DELETE TABLE CUSTOMER; 
DROP TABLE CUSTOMER; 
UPDATE TABLE CUSTOMER; 
Read More

The SQL WHERE clause is ________

Leave a Comment
The SQL WHERE clause is ________
Neither A nor B are correct 
A) limits the column data that are returned. 
B) limits the row data are returned 
Both A and B are correct 
Read More

Which of the following do you need to consider when you make a table in SQL?

Leave a Comment
Which of the following do you need to consider when you make a table in SQL?
Data types 
Default values 
Primary keys 
All of the listed options 
Read More

Which command undo all the updates performed by the SQL in the transaction?

Leave a Comment
Which command undo all the updates performed by the SQL in the transaction?
COMMIT
ROLLBACK 
DELETE
TRUNCATE
Read More

What will be output if you will compile and execute the following c code?

Leave a Comment
What will be output if you will compile and execute the following c code?
void main(){
char c=125;
c=c+10;
printf("%d",c);
}
2
0
-121
1
Read More

We cannot modify the code in base class as it will affect the derived classes as well.State true or false.

Leave a Comment
We cannot modify the code in base class as it will affect the derived classes as well.State true or false.
TRUE
FALSE
Read More

If the subclass does not define all the inherited abstract methods, then the sub class must be ________________.

Leave a Comment
If the subclass does not define all the inherited abstract methods, then the sub class must be ________________.
Abstract 
None of the listed options 
Complete 
Partially abstract 
Read More

We cannot modify the code in derived class as it will affect the base class.State true or false.

Leave a Comment
We cannot modify the code in derived class as it will affect the base class.State true or false.
TRUE
FALSE
Read More

In which of the following inheritance types. the derived class has only one base class?

Leave a Comment
In which of the following inheritance types. the derived class has only one base class?
Multiple 
Both of the listed options 
Single 
None of the listed options 
Read More

Which of the following statements explains the importance of multiple inheritance ?

Leave a Comment
Which of the following statements explains the importance of multiple inheritance ?
Multiple inheritance enables a derived class to inherit members from more than one parent. 
Multiple inheritance enables a base and derived classes to inherit members from more than one parent. 
None of the listed options 
Multiple inheritance enables a base class to inherit members from more than one parent.
Read More

Sunday, July 12, 2015

If a base class member access is public, and an inherited class accesses specifier is private, which of the following statement is true ?

Leave a Comment
If a base class member access is public, and an inherited class accesses specifier is private, which of the following statement is true ? 
The base class member can be accessed by derived class objects 
The derived class members can be accessed by the base class objects 
The base class members cannot be accessed by the derived class members
None of the listed options 
Read More

Which of the following statements is a definition for inheritance?

Leave a Comment
Which of the following statements is a definition for inheritance?
Manipulate objects of different classes and invoke methods on an object without knowing that object's type
Deriving new class from an existing class 
Ability to take on different forms 
It allows one interface to be used for general class of action 
Read More

Which of the following factors are an advantage for encapsulation?

Leave a Comment
Which of the following factors are an advantage for encapsulation?
High reusability 
Both of the listed options 
None of the listed options 
maintainability 
Read More

Encapsulation is understanding an object and representating it in terms of its characteristics and ____________.

Leave a Comment
Encapsulation is understanding an object and representating it in terms of its characteristics and ____________.
Usage frequency 
Both of the listed options 
None of the listed options 
Behaviour 
Read More

Which of the following factors influences an object's change of behaviour?

Leave a Comment
Which of the following factors influences an object's change of behaviour?
None of the listed options 
Number of input parameters 
Type of input parameters 
Both of the listed options 
Read More