oop[

Ace your homework & exams now with Quizwiz!

Which one of the following is not a Java feature?

Dynamic and Extensible

Which of these statement is incorrect?

Every class must contain a main() method

Static members are not inherited to subclass.

False

Which of these cannot be used for a variable name in Java?

keyword

1. What is the implicit return type of constructor?

No return type

Which of the following is not an OOPS concept in Java?

Compilation

1. Exception created by try block is caught in which block

Catch

What would be behaviour if the constructor has a return type?

Compilation error

Identify the infinite loop.

For(;;)

From where break statement causes an exit?

From innermost loops or switches

Which of the following is used with the switch statement?

break

Which of the following is not a decision making statement?

do-while

Which of the following is not a valid flow control statement?

exit()

Which of the following is used for implementing inheritance through an interface?

implements

Which of these selection statements test only for equality?

switch

Which of these have highest precedence?

()

What is the extension of compiled java classes?

.class

What is the extension of java code files?

.java

Which of this statement is incorrect?

All object of a class are allotted memory for the methods defined in the class

1. Which of the following exception is thrown when divided by zero statement is executed?

ArithmeticException

Which of the following is a valid declaration of an object of class Box?

Box obj = new Box();

What is true about a break?

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

What is not the use of "this" keyword in Java?

Calling another constructor in constructor chaining

1. Identify the interface which is used to declare core methods in java?

Collection

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

What is false about constructor?

Constructor can have a return type

Which of these statements are incorrect?

Division operator, /, has higher precedence than multiplication operator

What is not type of inheritance?

Double inheritance

Abstract class cannot have a constructor.

False

What is the process of defining more than one method in a class differentiated by method signature?

Function overloading

1. What is the variables declared in a class for the use of all methods of the class called?

Instance variable

Using which of the following, multiple inheritance in Java can be implemented?

Interfaces

1. 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 take 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 java program?

JDK

Which component is responsible to run java program?

JRE

Which component is responsible for converting bytecode into machine specific code?

JVM

Which component is used to compile, debug and execute the java programs?

JVM

Which statement is true about Java?

Java is a platform-independent programming language

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

Which statement is true about java?

Platform independent programming language

In order to restrict a variable of a class from inheriting to subclass, how variable

Private

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 be instantiated even if child is in a different package

1. Identify the prototype of the default constructor. Public class Solution {}

Public Solution()

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

1. Where does the system stores parameters and local variables whenever a method is invoked?

Stack

1. Identify the modifier which cannot be used for constructor.

Static

Does Java support multiple level inheritance?

True

The while loop repeats a set of code while the condition is not met?

True

Which one of the following is not an access modifier?

Void

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

Which of these jump statements can skip processing the remainder of the code in its body for a particular iteration?

continue

What is true about do statement?

do statement executes the code of a loop at least once

Which of the following loops will execute the body of loop even when condition controlling the loop is initially false?

do-while

Which of the following is used for implementing inheritance through class?

extends

Which of this keyword must be used to inherit a class?

extends

Which of the following is not a valid jump statement?

goto

Which of these are selection statements in Java?

if()

Which of these keywords is used to define interfaces in Java?

interface

All classes in Java are inherited from which class?

java.lang.Object

1. Where is System class defined?

java.lang.package

Which method can be defined only once in a program?

main method

A class member declared protected becomes a member of subclass of which type?

private member

If super class and subclass have same variable name, which keyword should be used to use super class?

super

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 of this statement is incorrect?

two case constants in the same switch can have identical values

What is the return type of a method that does not return any value?

void


Related study sets

QuickBooks Online Certification Test Study Guide

View Set

Clinical Psychology Science Exam 1

View Set

Chapter 12 reading Quiz attempt #2

View Set

Ch 14 - Socioemotional Development in Middle Adulthood

View Set