0% found this document useful (0 votes)
17 views

Java Assignment

The document contains 20 multiple choice questions about Java concepts and features. The questions cover topics like bytecode, object-oriented features, variable types and default values, classes, methods, and more.

Uploaded by

Mouli learning
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Java Assignment

The document contains 20 multiple choice questions about Java concepts and features. The questions cover topics like bytecode, object-oriented features, variable types and default values, classes, methods, and more.

Uploaded by

Mouli learning
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 5

1. Which of the following option leads to the portability and security of Java?

A. Bytecode is executed by JVM

B. The applet makes the Java code secure and portable

C. Use of exception handling

D. Dynamic binding between objects

Ans:Bytecode is executed by
JVM(A)

2. Which of the following is not a Java features?

A. Dynamic

B. Architecture Neutral

C. Use of pointers

D. Object-oriented
Ans: Use of pointers(c)

3. Which is a valid keyword in java?

A. interface

B. string

C. Float

D. Unsigned
Ans:interface(A)

4. What is the default value of double variable?

A. 0.0d

B. 0.0f

C. 0

D. not defined
Ans:0.0d(A)

5. What kind of variables a class can consist of?

A. class variable, instance variable

B. class variable, local variable, instance variable

C. class variable
D. class variables, local variables
Ans:class variable, local
variable, instance variable(B)

6. What is the default value of Object variable?

A. undefined

B. 0

C. null

D. not defined
Ans:null(c)

7. What is the size of float variable?

A. 8 bit

B. 16 bit

C. 32 bit

D. 64 bit
Ans:64bit(D)

8. Method Overloading is an example of?

A. Static Binding

B. Dynamic Binding;

C. Both of the above

D. None of the above


Ans:Dynamic Binding

9. What will happen if static modifier is removed from the signature of the
main method?

A. Compilation Error

B. RunTimeError: NoSuchMethodError

C. Program will compile and run without any output

D. Programm will compile and run to show the required output


Ans:RunTimeError:
NoSuchMethodError

10. What is Serialization?

A. Serialization is the process of writing the state of an object to another


object

B. Serialization is the process of writing the state of an object to a byte


stream

C. Both of the above

D. None of the above


Ans:Serialization is the process of writing the
state of an object to a byte stream

11. What is a class in Java?

A. A class is a blue print from which individual objects are created.

B. class is a spacial data type

C. class is used to allocate memory to a data type

D. None of the above


Ans:A class is a blue print from which individual
objects are created.

12. Method Overriding

A. Volatile variable

B. Mutable variable

C. Immutable variable

D. Dynamic variable
Ans:Mutable variable

13. What is Abstraction?

A. Abstraction is a technique to define different methods of same type.

B. Abstraction is the ability of an object to take on many forms.

C. It refers to the ability to make a class abstraction in OOP

D. None of the above


Ans: None of the above

14. Which three are valid declarations of a char??

A. char c1 = 'face';

B. char c2 = 0xbeef;

C. char c3 = \u0022;
D. char c4 = '\iface';Netscape
Ans:char c1 = 'face'

15. Which built-in method combines the text of two strings and returns a new
string?

A. append()

B. concat()

C. attach()

D. None of the above.


Ans:concat()

16. Which is the valid declarations within an interface definition?

A. public double methoda();

B. public final double methoda();

C. static void methoda(double d1);

D. protected void methoda(double d1);


Ans:public double methoda()

17. Which of the following is an IF statement in Java?

A. if i = 5

B. if i = 5 then

C. if (i == 5)

D. All of these
Ans:if (i == 5)

18. Which of the following is not a reserved word in Java?

A. interface

B. throws

C. program

D. short

Ans: program

19. Who invented Java language?

A. Dennis Ritchie

B. James Gosling

C. Larry Page

D. Serge Page
Ans:James Gosling

20. What is the original name of Java Programming language?

A. J++

B. C++

C. Oak

D. Teak
Ans:Oak

You might also like