0% found this document useful (1 vote)
3K views6 pages

Java MCQ

The document contains 20 multiple choice questions about Java programming concepts. It tests knowledge in the following key areas: 1) James Gosling is known as the father of the Java programming language. 2) Control statements like break, continue, return, try-catch-finally and assert are categorized as transfer statements in Java. 3) The Java Virtual Machine (JVM) provides the runtime environment for Java byte code to be executed. 4) Byte code is code generated by a Java compiler from Java source code files.

Uploaded by

Sara Akbari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
3K views6 pages

Java MCQ

The document contains 20 multiple choice questions about Java programming concepts. It tests knowledge in the following key areas: 1) James Gosling is known as the father of the Java programming language. 2) Control statements like break, continue, return, try-catch-finally and assert are categorized as transfer statements in Java. 3) The Java Virtual Machine (JVM) provides the runtime environment for Java byte code to be executed. 4) Byte code is code generated by a Java compiler from Java source code files.

Uploaded by

Sara Akbari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Q. Who is known as father of Java Programming Language?

[Link] Gosling
B.M. P Java
[Link] Babbage
[Link] Pascal
Answer : James Gosling [Option : A]

Q. In java control statements break, continue, return, try-catch-finally and assert


belongs to?
[Link] statements
[Link] Statements
[Link] statements
[Link] Statement
Answer : Transfer statements [Option : C]

Q. Which provides runtime environment for java byte code to be executed?


[Link]
[Link]
[Link]
[Link]
Answer : JVM [Option : B]

Q. What is byte code in Java?


[Link] generated by a Java compiler
[Link] generated by a Java Virtual Machine
[Link] of Java source code file
[Link] of code written inside a class
Answer : Code generated by a Java compiler [Option : A]

Q. Which of the following are not Java keywords ?


[Link]
[Link]
[Link]
[Link]
Answer : then [Option : C]
Q. Which of these have highest precedence?
A.()
B.++
C.*
D.>>
Answer : () [Option : A]

Q. Which of these is returned by operator '&' ?


[Link]
[Link]
[Link]
[Link]
Answer : Character [Option : B]

Q. Data type long literals are appended by _____


[Link] L
[Link] L
[Link]
[Link] A and B
Answer : Both A and B [Option : D]

Q. Which variables are created when an object is created with the use of the
keyword 'new' and destroyed when the object is destroyed?
[Link] variables
[Link] variables
[Link] Variables
[Link] variables
Answer : Instance variables [Option : B]

Q. Java language was initially called as ________


[Link]
B.J++
[Link]
[Link]
Answer : Oak [Option : C]
Q. What is garbage collection in the context of Java?
[Link] deletes all unused java files on the system.
[Link] used by the object with no reference is automatically reclaimed.
[Link] JVM cleans output of Java program with error.
[Link] unused package in a program automatically gets deleted.
Answer : Memory used by the object with no reference is automatically reclaimed. [Option : B]

Q. Which one is a template for creating different objects ?


[Link] Array
B.A class
[Link]
[Link]
Answer : A class [Option : B]

Q. Which symbol is used to contain the values of automatically initialized arrays?


[Link]
[Link]
[Link]
[Link]
Answer : Braces [Option : B]

Q. Which one is true about a constructor ?


A.A constructor must have the same name as the class it is declared within.
B.A constructor is used to create objects.
C.A constructor may be declared private
[Link] of the above
Answer : All of the above [Option : D]

Q. Which of these operators is used to allocate memory to array variable in Java?


[Link]
[Link]
[Link] malloc
[Link]
Answer : new [Option : D]
Q. Which of these is not a bitwise operator?
A.
&' Operator
B.
&=' Operator

C.
|=' Operator
D.
<=' Operator

Answer : <=' Operator [Option : D]

Show Answer

Q. Which of these is returned by Greater Than, Less Than and Equal To (i.e
Relational) operator ?
A.
Fload
B.
Integer

C.
Boolean
D.
Double

Answer : Boolean [Option : C]

Show Answer

Q. Which statement transfer execution to different parts of your code based on the
value of an expression?
A.
If
B.
Switch

C.
Nested-if
D.
if-else-if

Answer : Switch [Option : B]

Show Answer

Q. Modulus operator (%) can be applied to which of these?


A.
Integers
B.
Floating - point numbers

C.
Both A and B
D.
None of These

Answer : Both A and B [Option : C]

Show Answer

Q. What feature of OOP has a super-class sub-class concept?


A.
Hierarchical inheritance
B.
Single inheritance

C.
Multiple inheritances
D.
Multilevel inheritance
Answer : Hierarchical inheritance [Option : A]

Show Answer

You might also like