oop

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

1. What is the implicit return type of constructor? · No return type · A class object in which it is defined · Void · None

A class object in which it is defined

1. Which of these have highest precedence? a) () b) ++ c) * d) >>

a) ()

1. Which of this statement is incorrect? a) All object of a class are allotted memory for the all the variables defined in the class b) If a function is defined public it can be accessed by object of other class by inheritation c) main() method must be made public d) All object of a class are allotted memory for the methods defined in the class

all object a class are allotted memory for the methods defined in the class

1. Which of the following is a valid declaration of an object of class Box? a) Box obj = new Box() ;b) Box obj = new Box; c) obj = new Box(); d) new Box obj;

box obj=new Box()

1. Which of the following is used with the switch statement? a) Continue b) Exit c) break d) do

break;

1. Exception created by try block is caught in which block · catch · throw · final · none

catch

1. What is the extension of compiled java classes? a) .txt b) .js c) .class d) .java

class

1. Which method can be defined only once in a program? a) main method b) finalize method c) static method d) private method

main method

1. What is the return type of a method that does not return any value? a) int b) float c) void d) double

void

1. Which of the following is not an OOPS concept in Java? a) Polymorphism b) Inheritance c) Compilation d) Encapsulation

Compilation

1. Which of these statements are incorrect? a) Equal to operator has least precedence b) Brackets () have highest precedence c) Division operator, /, has higher precedence than multiplication operator d) Addition operator, +, and subtraction operator have equal precedence

Division operator, /, has higher precedence than multiplication operator

1. Which component is used to compile, debug and execute java program? a) JVM b) JDK c) JIT d) JRE

JDK

1. Which component is responsible to run java program? a) JVM b) JDK c) JIT d) JRE

JRE

1. Which component is responsible for converting bytecode into machine specific code? a) JVM b) JDK c) JIT d) JRE

JVM

Which statement is true about Java? a) Java is a sequence-dependent programming language b) Java is a code dependent programming language c) Java is a platform-dependent programming language d) Java is a platform-independent programming language

Java is a platform-independent programming language

1. Which statement is true about java? a) Platform independent programming language b) Platform dependent programming language c) Code dependent programming language d) Sequence dependent programming language

PLATFORM INDEPENDENT LANGUAGE

1. Which of the following exception is thrown when divided by zero statement is executed? · NullPointerException · NumberFormatException · ArithmeticException None

arithmeticException

1. What is true about a break? a) Break stops the execution of entire program b) Break halts the execution and forces the control out of the loop c) Break forces the control out of the loop and starts the execution of next iteration d) Break halts the execution of the loop for certain time frame

break halts the execution and forces the control out of the loop

1. Which of this statement is incorrect? a) switch statement is more efficient than a set of nested ifs b) two case constants in the same switch can have identical values c) switch statement can only test for equality, whereas if statement can evaluate any type of boolean expression d) it is possible to create a nested switch statements

cases can't have the same values

1. Which of these keywords must be used to handle the exception thrown by try block in some rational manner? a) try b) finally c) throw d) catch

catch

1. Which of these keywords is used to make a class? a) class b) struct c) int d) none of the mentioned

class

1. Which of these is correct way of inheriting class A by class B? a) class B + class A {} b) class B inherits class A {} c) class B extends A {} d) class B extends class A {}

class B inherits class A

1. Identify the interface which is used to declare core methods in java? · Comparator · EventListener · Set · Collection

collection

1. What would be behaviour if the constructor has a return type? a) Compilation error b) Runtime error c) Compilation and runs successfully d) Only String return type is allowed

compilation error

1. What would be the behaviour if this() and super() used in a method? a) Runtime error b) Throws exception c) compile time error d) Runs successfully

compile time error

1. 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. a) Runtime error b) Compile time error c) Code runs successfully d) First called method is executed successfully

compile time error

1. Which of the following is a method having same name as that of it's class?a) finalize b) delete c) class d) constructor

constructor

1. What is false about constructor? a) Constructors cannot be synchronized in Java b) Java does not provide default copy constructor c) Constructor can have a return type d) "this" and "super" can be used in a constructor

constructor can have a return type

1. Which of these jump statements can skip processing the remainder of the code in its body for a particular iteration? a) break b) return c) exit d) continue

continue

1. What is true about do statement? a) do statement executes the code of a loop at least once b) do statement does not get execute if condition is not matched in the first iteration c) do statement checks the condition at the beginning of the loop d) do statement executes the code more than once always

do statement executes the code of a loop at least one

1. Which of the following loops will execute the body of loop even when condition controlling the loop is initially false? a) do-while b) while c) for d) none of the mentioned

do- while

1. Which of the following is not a decision making statement? a) if b) if-else c) switch d) do-while

do-while

1. What is not type of inheritance? a) Single inheritance b) Double inheritance c) Hierarchical inheritance d) Multiple inheritance

double inheritance

1. Which of these statement is incorrect? a) Every class must contain a main() method b) Applets do not require a main() method at all c) There can be only one main() method in a program d) main() method must be made public

every class must contain a main() method

1. Which of the following is not a valid flow control statement? a) exit() b) break c) continue d) return

exit()

1. Which of the following is used for implementing inheritance through class? a) inherited b) using c) extends d) implements

extends

1. Which of this keyword must be used to inherit a class? a) super b) this c) extent d) extends

extends

1. Static members are not inherited to subclass. a) True b) False

false

1. The while loop repeats a set of code while the condition is not met? a) True b) False

false

1. Abstract class cannot have a constructor. a) True b) False

false it cam contain constructor

1. Identify the infinite loop. · for(;;) · for(int i=0; i<1; i--) · for(int i=0; ; i++) · All of the above

for(;;)

1. From where break statement causes an exit? a) Only from innermost loop b) Terminates a program c) Only from innermost switch d) From innermost loops or switches

from innermost loops or switches

1. What is the process of defining more than one method in a class differentiated by method signature? a) Function overriding b) Function overloading c) Function doubling d) None of the mentioned

function overloading

1. Which of the following is not a valid jump statement? a) break b) goto c) continue d) return

goto

1. Which of these are selection statements in Java? a) break b) continue c) for() d) if()

if ()

1. Which of these are selection statements in Java? a) if() b) for() c) continue d) break

if()

1. Which of the following is used for implementing inheritance through an interface? a) inherited b) using c) extends d) implements

implements

1. What is the variables declared in a class for the use of all methods of the class called? · Object · Instance variable · Reference variable · None

instance variables

1. . Which of these keywords is used to define interfaces in Java? a) intf b) Intf c) interface d) Interface

interface

1. Using which of the following, multiple inheritance in Java can be implemented? a) Interfaces b) Multithreading c) Protected methods d) Private methods

interfaces

1. Which of the following statements are true about finalize() method? · It can be called Zero or one times · It can be called Zero or more times · It can be called exactly once · It can be called one or more times

it can be called Zero or one times

1. What is true about constructor? a) It can contain return type b) It can take any number of parameters c) It can have any non access modifiers d) Constructor cannot throw an exception

it can have any number of peremeters

1. What is the extension of java code files? a) .js b) .txt c) .class d) .java

java

1. All classes in Java are inherited from which class? a) java.lang.class b) java.class.inherited c) java.class.object d) java.lang.Object

java.lang.object

1. Where is System class defined? · java.lang.package · java.util.package · java.io.package · None

java.lang.package

1. . Which environment variable is used to set the java path? a) MAVEN_Path b) JavaPATH c) JAVA d) JAVA_HOME

java_home

1. Which component is used to compile, debug and execute the java programs? a) JRE b) JIT c) JDK d) JVM

jdk

1. Which of these cannot be used for a variable name in Java? a) identifier & keyword b) identifier c) keyword d) none of the mentioned

keyword

1. Which of the following is a superclass of every class in Java? a) ArrayList b) Abstract class c) Object class d) String

object class

1. Which exception is thrown when java is out of memory? a) MemoryError b) OutOfMemoryError c) MemoryOutOfBoundsException d) MemoryFullException

outofmemoryerror

1. What is not the use of "this" keyword in Java? a) Passing itself to another method b) Calling another constructor in constructor chaining c) Referring to the instance variable when local variable has the same name d) Passing itself to method of the same class

passing itself to method of the same class

1. A class member declared protected becomes a member of subclass of which type? a) public member b) private member c) protected member d) static member

private

1. In order to restrict a variable of a class from inheriting to subclass, how variable should be declared? a) Protected b) Private c) Public d) Static

private

1. What is true about private constructor? a) Private constructor ensures only one instance of a class exist at any point of time b) Private constructor ensures multiple instances of a class exist at any point of time c) Private constructor eases the instantiation of a class d) Private constructor allows creating objects in other classes

private constructor ensures only one instance os a class exist at any point of time

1. What is true about protected constructor? a) Protected constructor can be called directly b) Protected constructor can only be called using super() c) Protected constructor can be used outside package d) protected constructor can be instantiated even if child is in a different package

protected constructor can only be called using super

1. Identify the prototype of the default constructor. Public class Solution {} · Solution(void) · Solution() · public Solution(void) · public Solution()

public Solution ()

1. Which of the following statements is correct? a) Public method is accessible to all other classes in the hierarchy b) Public method is accessible only to subclasses of its parent class c) Public method can only be called by object of its class d) Public method can be accessed by calling object of the public class

public method is accessible to all other classes in the heirarcy

1. When does Exceptions in Java arises in code sequence? a) Run Time b) Compilation Time c) Can Occur Any Time d) None of the mentioned

run time

1. Where does the system stores parameters and local variables whenever a method is invoked? · Heap · Stack · Array · Tree

stack

1. Identify the modifier which cannot be used for constructor. · public · protected · private static

static

1. If super class and subclass have same variable name, which keyword should be used to use super class? a) super b) this c) upper d) classname

super

Which of these selection statements test only for equality? a) if b) switch c) if & switch d) none of the mentioned

switch

1. Which of these keywords is used to manually throw an exception? a) try b) finally c) throw d) catch

throw

1. Which of these keywords is not a part of exception handling? a) try b) finally c) thrown d) catch

thrown

1. Does Java support multiple level inheritance? a) True b) False

true

1. Which of these keywords are used for the block to be examined for exceptions? a) check b) throw c) catch d) try

try

1. Which of these keywords must be used to monitor for exceptions? a) try b) finally c) throw d) catch

try

Which one of the following is not a Java feature? a) Object-oriented b) Use of pointers c) Portable d) Dynamic and Extensible

use of pointers

Which one of the following is not an access modifier? a) Protected b) Void c) Public d) Private

void


Kaugnay na mga set ng pag-aaral

Chemistry Ch. 12.3 and 12.4 Quiz

View Set

Topic Two, Lesson Six: Supporting Economic Growth-Economics

View Set

SUPAH DUPAH UVU HEALTH 1100 FINAL REVIEW, YEAH I KNOW YOU GOOGLED ALL THIS JUNK JUST LIKE I DID. YOU'RE WELCOME

View Set

research exam 3: independent study; systematic reviews and review questions

View Set