Java programming - Java test
1) Which specification that provides runtime environment in which java byte code can be executed?
A) JDK
B) JVM
C) JRE
D) None of the above
View Answer / Hide Answer2) Java language was initially called as "OaK"?
A) True
B) False
View Answer / Hide Answer3) Which is an application designed to be transmitted over the Internet and executed by a Java-compatible Web browser?
A) An Applet
B) An Application
C) Both A & B
D) None of the above
View Answer / Hide Answer4) Which provides a new way for your programs to interface with code libraries written in other languages?
A) JNI
B) JDBC
C) RMI
D) GUI
View Answer / Hide Answer5) Which are used to produce a programming environment that supports the development of far more robust and scalable programs than does the process-oriented model?
A) Polymorphism, Encapsulation, and Inheritance
B) Encapsulation and Inheritance
C) Polymorphism and Encapsulation
D) Inheritance and Polymorphism
View Answer / Hide AnswerANSWER: Polymorphism, Encapsulation, and Inheritance
6) Which allows you to migrate your implementations over time without breaking the code that depends on the public interface of your classes?
A) Polymorphism
B) Inheritance
C) Encapsulation
D) Both A & B
View Answer / Hide Answer7) The comment must begin with /* and end with */ is known as?
A) Multiline comment
B) Single line comment
C) Both A & B
D) None of the above
View Answer / Hide AnswerANSWER: Multiline comment
8) Which is nothing but a blueprint or a template for creating different objects which defines its properties and behaviours?
A) An Array
B) A class
C) Interface
D) None of the above
View Answer / Hide Answer9) In this type one super-class is having more than one sub-class?
A) Hierarchical inheritance
B) Single inheritance
C) Multiple inheritances
D) Multilevel inheritance
View Answer / Hide AnswerANSWER: Hierarchical inheritance
10) An exception is an event, which occurs during the execution of a program that disrupts the normal flow of the program's instructions?
A) True
B) False
View Answer / Hide Answer11) Which symbol Used to contain the values of automatically initialized arrays. Also used
To define a block of code, for classes, methods, and local scopes?
A) Brackets
B) Braces
C) Parentheses
D) Semicolon
View Answer / Hide Answer12) Which data type has this Minimum and Maximum value 3.4e-038 to 3.4e+038?
A) long
B) Int
C) Byte
D) Float
View Answer / Hide Answer13) Which variables are created when an object is created with the use of the keyword 'new' and destroyed when the object is destroyed?
A) Local variables
B) Instance variables
C) Class Variables
D) Static variables
View Answer / Hide AnswerANSWER: Instance variables
14) In the following statements which is a Disadvantage of Java Array?
A) An array can hold primitive types data
B) An array has its size that is known as array length
C) An array knows only its type that it contains. Array type is checked at the compile-time
D) An array holds only one type of data
View Answer / Hide AnswerANSWER: An array holds only one type of data
15) In java control statements break, continue, return, try-catch-finally and assert belongs to?
A) Selection statements
B) Loop Statements
C) Transfer statements
D) None of the above
View Answer / Hide AnswerANSWER: Transfer statements
16) What output you will get if you run this program?
class Modulus {
public static void main(String args[]) {
int x = 42;
double y = 42.25;
System.out.println("x mod 10 = " + x % 10);
System.out.println("y mod 10 = " + y % 10);
}
}
A) x mod 10 = 2
y mod 10 = 2.25
B) x mod 10 = 4
y mod 10 = 2.50
C) x mod 10 = 6
y mod 10 = 3.25
D) x mod 10 = 2
y mod 10 = 4.25
View Answer / Hide Answer17) The Java Virtual Machine is the cornerstone of the Java platform?
A) True
B) False
View Answer / Hide Answer18) Which is used for Java Virtual Machine "assembly language", its opcodes and operands, as well as items in the Java Virtual Machine's run-time data areas?
A) ASCII
B) Italic
C) Latin
D) Greek
View Answer / Hide Answer19) JVM stands for?
A) Java Very Large Machine
B) Java Verified Machine
C) Java Very Small Machine
D) Java Virtual Machine
View Answer / Hide AnswerANSWER: Java Virtual Machine
20) Who is also called father of Java Programming Language?
A) James Gosling
B) Ken Thompson
C) Dennis Richie
D) None of the above
View Answer / Hide Answer21) Java Virtual Machine is platform independent?
A) True
B) False
View Answer / Hide Answer22) Switch is more efficient than nested if or if - else in java?
A) True
B) False
View Answer / Hide Answer23) Which statement provides an easy way to dispatch 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
View Answer / Hide Answer24) The data type int ranges from one of the following value?
A) –2,147,483,648 to 2,147,483,647
B) -2,147,483,647 to 2,147,483,648
C) -32,768 to 32,767
D) -32,767 to 32,768
View Answer / Hide AnswerANSWER: –2,147,483,648 to 2,147,483,647
25) Give the Output for the following program?
class Char {
public static void main(String args[]) {
char ch1, ch2;
ch1 = 88; // code for X
ch2 = 'Y';
System.out.print("ch1 and ch2: ");
System.out.println(ch1 + " " + ch2);
}
}
A) ch1 and ch2: X Y
B) ch1 and ch2: x y
C) ch1 and ch2: 1 3
D) None of the above
View Answer / Hide Answer26) The following main tasks are performed by?
- Loads code
- Verifies code
- Executes code
- Provides runtime environment
A) JVM
B) JDK
C) JRE
D) Both B & C
View Answer / Hide Answer