Java Week One
The format specifier ____ is used to output values of type float or double.
%f
When a Java program is compiled, the file produced by the compiler ends with the _______ file extension.
.class
A Java Source code file must end with the _____ file extension.
.java
Multiple Line comments begin with ____.
/
______ are reserved for use by java.
Keywords
Which of the following is the highest Precedence? Select one: a. () b. ++ c. * d. >>
a. ()
Following file is the Human readable in Java programming language. Select one: a. .Java b. .Jar c. .Obj d. .Class
a. .Java
What output is displayed as the result of the executing the following statement? System.out.println("// Looks like a comment."); Select one: a. // Looks like a comment b. \ Looks like a comment c. \\ Looks like a comment d. The statement result in the compilation error
a. // Looks like a comment
Which statement is true? Select one: a. Class name always start with capital letter b. We can add spaces in class names c. It is not possible to make class, without including main method in it d. None of these
a. Class name always start with capital letter
JRE stands for ______________. Select one: a. Java Runtime Environment b. Java Reply Engine c. Java Running Engine d. Java Runtime Engine
a. Java Runtime Environment
Full form of JVM is ___________ Select one: a. Java Virtual Machine b. Java Virtual Mechanism c. Java Variable Machine d. Java Variable Mechanism
a. Java Virtual Machine
JVM stands for _______________. Select one: a. Java Virtual Machine b. Java Virtual Mechanism c. Java Virtual Management d. Java Virtual Memory
a. Java Virtual Machine
Which java package is imported by default? Select one: a. Java.lang b. Java.util c. Java.awt d. None of these
a. Java.lang
Which of the following is not the valid java identifier? Select one: a. My Value b. $_AAA1 c. Width d. m_x e. my_value
a. My Value
The Correct order of the declaration in a java program is Select one: a. Package declaration, import statement, class declaration b. Import statement, class declaration, package declaration c. Class declaration, import statement, package declaration d. Class declaration, package declaration, import statement
a. Package declaration, import statement, class declaration
If a local variable of a method shop() belonging to a class called Walmart has the same name as a data member of Walmart, which value is used when shop() is executing? Select one: a. The local variable's b. The class variable's c. The data member's d. None of the above since this would cause the compiler error.
a. The local variable's
All variables must be given a type when they are declared. Select one: a. True b. False
a. True
Can we do nesting of comments in java? Select one: a. True b. False
a. True
Eclipse is the Free Open source Integrated Development Environment? Select one: a. True b. False
a. True
Empty parentheses following a method name in a method declaration indicates that the method does not require any parameters to perform task. Select one: a. True b. False
a. True
Java Allows, Same program to be executed on the multiple Operating Systems. Select one: a. True b. False
a. True
Java is called as Platform Independent language. Do you agree with this statement? Select one: a. True b. False
a. True
The number of arguments in the method call must match the number of parameters in the method declaration's parameter list. Select one: a. True b. False
a. True
Keyword _______ in the class declaration is always followed by the class name Select one: a. class b. Public c. Return Type d. None of these
a. class
When the source code is successfully compiled , _______ is generated Select one: a. Output b. Bytecode c. Error d. None of these
b. Bytecode
Which of the following is considered as platform independent code? Select one: a. Source Code b. Compiled File c. Both A & B d. None of the above
b. Compiled File
You read the following statement in java program that compiles and executes. Submarine.dive(depth) What can you say for sure? Select one: a. Depth must be an int b. Dive must be method c. Dive must be name of the instance field d. Submarine must be name of the class e. Submarine must be method
b. Dive must be method
The Arithmetic Operators *, /, %, + and - all have the same level of precedence. Select one: a. True b. False
b. False
Which of the statement is reserved word in the java? Select one: a. Run b. Import c. Transient d. Implement
b. Import
Bytecode is given as input to ___________. Select one: a. JRE b. JVM c. Linker d. Assembler
b. JVM
Platform Independent code file created from source file is understandable by ____________. Select one: a. JRE b. JVM c. Applet d. Compiler
b. JVM
Consider the following program: import myLibrary.*; public class ShowSomeClass { // code for the class... } What is the name of the java file containing this program? Select one: a. myLibrary.java b. ShowSomeClass.java c. ShowSomeClass d. ShowSomeClass.class
b. ShowSomeClass.java
We can use the Command line tool to run Java Application. Select one: a. False b. True
b. True
Return type _________ indicates that a method will not return a value. Select one: a. int b. Void c. Null d. We do not specify return type in that case
b. Void
What is garbage collection in context of java? Select one: a. The operating system periodically deletes all the java files available on the system. b. When all references to an object gone, the memory used by the objects is automatically reclaimed. c. Any package imported in a program and not used is automatically deleted. d. The JVM checks the output of any java program and delete anything that doesn't make any sense.
b. When all references to an object gone, the memory used by the objects is automatically reclaimed.
Which of the following command is used to execute Java code? Select one: a. jar b. java c. Javadoc d. Javac
b. java
The file produced by the Java compiler contains _____ that are executed by the Java Virtual Machine.
bytecode
Single Line Comments starts with ________ in Java. Select one: a. /** b. /* c. // d. None of these
c. //
What is the output of this program? Select one: a. 10 b. 11 c. 12 d. 56
c. 12
Which of the following converts human readable file into platform independent code file in Java? Select one: a. JVM b. Applet c. Compiler d. JRE
c. Compiler
Which of these statement is incorrect? Select one: a. Equal to operator has least precedence. b. Brackets () have the highest precedence. c. Division operator / has the highest precedence than the multiplication operator. d. Addition operator + and Subtraction operator have equal precedence.
c. Division operator / has the highest precedence than the multiplication operator.
JVM is a __________. Select one: a. Debugger b. Compiler c. Interpreter d. Assembler
c. Interpreter
JDK in Java stands for __________ Select one: a. Java Debugging Kit b. Java Decompilation Kit c. Java Development Kit d. None of these
c. Java Development Kit
Which of the following is not the Java code editor? Select one: a. Eclipse b. NetBeans c. Microsoft word d. Notepad ++
c. Microsoft word
What kind of language Java is? Select one: a. Event Driven b. Procedural c. Object Oriented d. None of these
c. Object Oriented
Java Programming was designed by ___________ Select one: a. Microsoft b. Mozilla Corporation c. Sun Microsystems d. Amazon Inc.
c. Sun Microsystems
Which of the following is the correct way of importing an entire package 'pkg' ? Select one: a. Import pkg. b. import pkg. c. import pkg. * d. Import pkg.*
c. import pkg. *
Which of these keywords is used to define packages in java? Select one: a. pkg b. PKg c. package d. Package
c. package
Java Compiled Programs have ________extension. Select one: a. .java b. .source c. .compile d. .class
d. .class
What is the output of this program? Select one: a. 24 8 b. 24 9 c. 27 8 d. 27 9
d. 27 9
Which one is invalid identifier? Select one: a. _variabename b. Max_value c. VariabelTest d. 8example
d. 8example
Java Source code is compiled into __________ Select one: a. Source Code b. .Obj c. .Exe d. Bytecode
d. Bytecode
From these which one is the Compulsory section in the java program? Select one: a. Package statement b. Import statement c. Documentation section d. Class Declaration section
d. Class Declaration section
Front end application which includes GUI is created using _________. Select one: a. JVM b. DOS c. Compiler d. IDE
d. IDE
Which of the following is not the return type? Select one: a. boolean b. void c. int d. public
d. public
Which one is the legal Identifier in java? Select one: a. 7button b. My Age c. My-Age ( Underscores are acceptable but hyphens are not ) d. Exa+ple ( this plus sign make it invalid ) e. $testvariable
e. $testvariable
A(n) ____ is not required if you always refer a class with the fully qualified class name.
import
Java Application begin execution at, method ______.
main
Scanner method _____ return a double value.
nextDouble