Java OOP - P13

Ace your homework & exams now with Quizwiz!

c

Every Java applet or application is composed of at least one (a) Method (b) Data member (c) Class definition (d) Imported class (e) Package definition.

d

. Which of the following is not true for a constructor? (a) A constructor is used to initialize an object (b) A default constructor takes no parameter (c) A constructor can be overloaded (d) A constructor can be declared abstract (e) A constructor access mutators are get() and set().

d

Which of the following package is automatically imported to your program file? (a) java.util (b) java.io (c) java.net (d) java.lang (e) java.math.

c

Which of the following stream is used for Object Serialization? (a) DataOutputStream (b) DataInputStream (c) ObjectOutputStream (d) ObjectWriter (e) ObjectReader.

b

Which of the following stream is/are used to handle primitive data types? (a) BufferedOutputStream (b) DataInputStream (c) FileOutputStream (d) FileInputStream (e) All the above.

a

Consider the class definition: public class MyClass { int x; int y; void myprint(){ System.out.println("x = " +x); System.out.println("Y = " +y); } } Which of the following is a correct way to create an object? (a) MyClass mc=new MyClass(); (b) MyClass mc; (c) MyClass mc=new MyClass(10,20); (d) MyClass mc=MyClass(10,20); (e) All the above.

a

Consider the following code: interface A { int a=5; int b=10;} Which of the following is possible for the above? (a) class B implements A{int x; void add(){ x= a+b; } } (b) class B extends A { int x; void add(){ x= a+b; } } (c) class B implements A { int x; void add(){ a=20; b=10; x= a+b; } } (d) class B extends A{ int x; void add(){ a=20; b=10; x= a+b; } } (e) class A implements B{int x; void add() { x=a+b; }.

a

Which of the following is true for method overriding? (a) A method in the subclass that has the same name, same arguments and same return type as a method in the super class is orverridden (b) An overridden method advocates for inheritance in OOP (c) It is not possible to access the method which is overridden in a subclass (d) Overridden method in java is called virtual function (e) Overloading method in java is called virtual function.

b

The extends keyword creates a new (a) Instance (b) Subclass (c) Baseclass (d) Superclass (e) Object.

a

Which is not a valid operator in Java? (a) <> (b) != (c) => (d) <= (e) +=.

a

Which of the following exception is caused when a math error such as division by zero occurs? (a) ArithmaticException (b) DivisionByZeroException (c) NumberFormatException (d) IOException (e) ArrayIndex OutofBoundException.

d

Which of the following is a character stream? (a) FileInputStream (b) DataInputStream (c) BufferedInputStream (d) FileReader (e) FileOutputStream.

e

Which of the following is not a built-in exception found in java API? (a) IOException (b) NullPointerException (c) ArithmaticException (d) FileNotFoundException (e) SystemFoundException.

a

Which of the following is not a valid Java identifier? (a) my Value (b) $_AAA1 (c) width (d) m_x (e) my_value.

b

Which of the following is not a valid String Constant? (a) "X" (b) 'x' (c) "Hello" (d) "2002" (e) "Hello Guys".

c

Which of the following is not an Applet method? (a) start() (b) init() (c) run() (d) stop() (e) destroy().

c

Which of the following is not necessarily related to RMI? (a) Stub and skeleton (b) Remote interface (c) Graphical User Interface (d) Client and Server (e) Protocol.

a

Which of the following is not true for a java thread? (a) The run method calls start method (b) The start method calls run method (c) Runnable interface contains only run method (d) The run method is overridden to contain the functionality of the application (e) Once we use the stop() method on a thread, we cannot use the start() method.

b

Which of the following is not true? (a) Every time the class is instantiated, a new copy of each of the instance variables is created (b) Every time the class is instantiated, a new copy of each of the class variables is created (c) A class has only one copy of each of its static members, which are shared by all the instances of the class (d) Static members are accessed without an instance of a class (e) An object is the instance of the class.

a

Which of the following method is inherited by Applet from its parent class? (a) paint (b) start (c) init (d) stop (e) run.


Related study sets

Eco 2013 Exam Review 1 (ch 1,2,3)

View Set

Economics - Chapter 12: Economics of Inequality and Poverty

View Set

Random questions and answers (online) part 15

View Set

World War 1 Texas-World History Review

View Set

Exam #2: Essentials of Anatomy and Physiology

View Set

Chapter 1: Marketing, Creating and Capturing Customer Value

View Set

Chords and Arcs+ Other Geometry Conjectures for quiz

View Set

Brunner & Suddarths 14th Edition: Pre,Post Operative Management

View Set