OOP
Which of these have highest precedence (приоритет)?
()
What is the extension of compiled java classes?
.class
What is the extension of java code files?
.java
What is the implicit return type of constructor?
A class object in which it is defined
Which of the following exception is thrown when divided by zero statement is executed?
Arithmetic Exception
Which of the following is a valid declaration of an object of class Box?
Box obj = new Box();
Identify the interface which is used to declare core methods in java?
Collection
Which of the following is not an OOPS concept in Java?
Compilation
What would be behaviour if the constructor has a return type?
Compilation error
What would be the result if a class extends two interfaces and both have a method with same name and signature? Lets assume that the class is not implementing that method.
Compile time error
Which of these statements are incorrect?
Division operator, /, has higher precedence than multiplication operator
What is not type of inheritance?
Double inheritance
Which of these statement is incorrect?
Every class must contain a main() method.
Abstract class cannot have a constructor.
False
All object of a class are allotted memory for the methods defined in the class
False
Static members are not inherited to subclass.
False
The while loop repeats a set of code while the condition is not met?
False
Two case constants in the same switch can have identical values
False
What is the process of defining more than one method in a class differentiated by method signature?
Function overloading
What is the variables declared in a class for the use of all methods of the class called?
Instance variable
Multiple inheritance in Java can be implemented by...?
Interfaces
Which of the following statements are true about finalize() method?
It can be called Zero or One times
What is true about constructor?
It can have any number of parameters
Which environment variable is used to set the java path?
JAVA_HOME
Which component is used to compile, debug and execute the java programs?
JDK
Which component is responsible to run java program?
JRE
Which component is responsible for converting bytecode into machine specific code?
JVM
Which of the following is a superclass of every class in Java?
Object class
Which exception is thrown when java is out of memory?
OutOfMemoryError
What is not the use of "this" keyword in Java?
Passing itself to method of the same class
What is true about private constructor?
Private constructor ensures only one instance of a class exist at any point of time.
What is true about protected constructor?
Protected constructor can only be called using super()
Which of the following statements is correct?
Public method is accessible to all other classes in the hierarchy.
When does Exceptions in Java arises in code sequence?
Run Time
Identify the prototype of the default constructor. Public class Solution {}
Solution()
Where does the system stores parameters and local variables whenever a method isinvoked?
Stack
Break halts the execution and forces the control out of the loop
True
Do statement executes the code of a loop at least once
True
Java supports multiple level inheritance?
True
Java is...
a platform - independent programming language
Which of the following is used with the switch statement?
break
Exception created by try block is caught in which block
catch
Which of these keywords must be used to handle the exception thrown by try block in some rational manner?
catch
Which of these keywords is used to make a class?
class
Which of these is correct way of inheriting class A by class B?
class B extends A
What would be the behaviour if this() and super() used in a method?
compile time error
Which of the following is a method having same name as that of it's class?
constructor
What is false about constructor?
constructor can have a return type
Which of these jump statements can skip processing the remainder of the code inits body for a particular iteration?
continue
Which of the following is not a decision making statement?
do-while
Which of the following loops will execute the body of loop even when condition controlling the loop is initially false?
do-while
Identify the infinite loop: · for(;;) · for(int i=0; i<1; i--) · for(int i=0; ; i++) · All of the above
dymy zhok, for (;;)
Which of the following is not a valid flow control statement?
exit()
Which of the following is used for implementing inheritance through class?
extends
Which of this keyword must be used to inherit a class?
extends
From where break statement causes an exit?
from innermost loops or switches
Which of the following is not a valid jump statement?
goto
Which of these are selection statements in Java?
if ()
Which of the following is used for implementing inheritance through an interface?
implements
Which of these keywords is used to define interfaces in Java?
interface (kiwkentai arippen strogo)
All classes in Java are inherited from which class?
java.lang.Object
Where is System class defined?
java.lang.package
Which of these cannot be used for a variable name in Java?
keyword
Which method can be defined only once in a program?
main method
In order to restrict a variable of a class from inheriting to subclass, how variable should be declared?
private
A class member declared protected becomes a member of subclass of which type?
private member
Identify the modifier which cannot be used for constructor
static
If super class and subclass have same variable name, which keyword should be used to use super class?
super
Which of these selection statements test only for equality?
switch
Which of these keywords is used to manually throw an exception?
throw
Which of these keywords is not a part of exception handling?
thrown
Which of these keywords are used for the block to be examined for exceptions?
try
Which of these keywords must be used to monitor for exceptions?
try
Which one of the following is not a Java feature?
use of pointers
not an access modifier
void