Java MCQ Questions - Java Basics
This section focuses on the "Basics" of Java programming. These Multiple Choice Questions (MCQ) should be practiced to improve the Java programming skills required for various interviews (campus interview, walk-in interview, company interview), placements, entrance exams and other competitive examinations.
1. Java Source Code is compiled into ______________.
A. .Obj
B. Source Code
C. Bytecode
D. .Exe
View Answer
Ans : C
Explanation: Java Source Code is compiled into Bytecode.
2. Enums were introduced in?
A. Java 4.0
B. Java 8.0
C. Java 5.0
D. Java 6.0
View Answer
Ans : C
Explanation: Enums were introduced in Java 5.0. Enums restrict a variable to have one of only a few predefined values. The values in this enumerated list are called enums.
3. Default, public , protected, private are?
A. Access Modifier
B. Non-access Modifiers
C. Both A and B
D. It's variable
View Answer
Ans : A
Explanation: Access Modifiers : default, public , protected, private
4. Which of the following is used to interpret and execute Java Applet Classes hosted by HTML.
A. appletviewer
B. appletwatcher
C. appletshow
D. appletscreen
View Answer
Ans : A
Explanation: appletviewer is used to interpret and execute Java Applet Classes hosted by HTML.
5. HTML based Java Documentary help can be accessed using ______________.
A. javahelp
B. javamanual
C. javadoc
D. None of these
View Answer
Ans : C
Explanation: HTML based Java Documentary help can be accessed using javadoc.
6. jar stands for _____________.
A. Java Application Runner
B. Java Archive
C. Java Archive Runner
D. None of these
View Answer
Ans : B
Explanation: jar stands for Java Archive
7. Which of the following is not a keyword in Java.
A. transient
B. instanceof
C. emun
D. strictfp
View Answer
Ans : C
Explanation: Incorrect spelling of the word "enum",enum is a keyword in Java.
8. Which of the following is not a keyword in Java.
A. assert
B. boolean
C. abstract
D. finalize
View Answer
Ans : D
Explanation: Final class can't be inherited, final method can't be overridden and final variable value can't be changed. Finally is used to place important code, it will be executed whether exception is handled or not. Finalize is used to perform clean up processing just before object is garbage collected.
9. Single line comment starts with _________ in Java.
A. /**
B. //
C. /*
D. None of these
View Answer
Ans : B
Explanation: Single-line comments start with two forward slashes ( // ). Any text between // and the end of the line is ignored by Java
10. What is JRE?
A. JRE is a java based GUI application.
B. JRE is an implementation of the Java Virtual Machine which executes Java programs.
C. JRE is an application development framework.
D. None of the above
View Answer
Ans : B
Explanation: Java Runtime Environment is an implementation of the Java Virtual Machine which executes Java programs. It provides the minimum requirements for executing a Java application.
11. How to compile java code in command prompt?
A. javac filename.java
B. java filename.java
C. javac filename
D. java filename
View Answer
Ans : A
Explanation: Type javac filename.java and press enter to compile your code. If there are no errors in your code, the command prompt will take you to the next line.
12. How to run java program in command prompt?
A. javac filename.java
B. java filename.java
C. javac filename
D. java filename
View Answer
Ans : D
Explanation: Now, type java filename to run your program.
13. Java is case sensitive?
A. True
B. False
C. Depends On Complier
D. May be true or false
View Answer
Ans : A
Explanation: Case Sensitivity : Java is case sensitive, which means identifier Hello and hello would have different meaning in Java.
14. What is true in Java?
A. For all class names the first letter should be in Upper Case.
B. All method names should start with a Lower Case letter.
C. Name of the program file should exactly match the class name.
D. All of the above
View Answer
Ans : D
Explanation: All of the above statement are true.
15. All Java components require names. Names used for classes, variables, and methods are called?
A. Variables
B. identifiers
C. Access Modifiers
D. Java Modifiers
View Answer
Ans : B
Explanation: All Java components require names. Names used for classes, variables, and methods are called identifiers.
Also check :
Discussion
vaishanvi tambe
Q_5 is wrong ans
Letsfindcourse
Thanks for reporting the incorrect ans our team will correct that soon.