Department of Computer Science
Java Programming
Java was released in .
A. 1990
B. 1995
C. 1996
D. 2000
ANSWER: B
The old name of java was.
A. c++
B. j
C. oak
D. ock
ANSWER: C
Which of these coding types is used for data type characters in Java.
A. ASCII
B. ISO-LATIN-1
C. UNICODE
D. None of the mentioned
ANSWER: C
Which of these values can a boolean variable contain.
A. True & False
B. 0 & 1
C. Any integer value
D. true
ANSWER: A
What is the range of short data type in Java.
A. -128 to 127
B. -327688 to 32767
C. -2147483648 to 2147483647
D. none
ANSWER: B
Which of these is necessary to specify at time of array initialization.
A. Row
B. Column
C. Both Row and Column
D. None of the mentioned
ANSWER: A
Java source code is compile into.
A. .obj
B. .exe
C. .hex
D. Byte Code
ANSWER: D
Which tool is used to compile Java code.
A. jar
B. Java
C. javadoc
D. javac
ANSWER: D
JVM stand for .
A. Java variable machine
B. Java Virtual mechanism
C. Java Virtual Machine
D. Java variable mechanism
ANSWER: C
Which of the following is Private data type .
A. Byte
B. Float
C. String
D. Double
ANSWER: A
Which data type value is returned by all transcendental math functions.
A. int
B. float
C. double
D. long
ANSWER: C
Which of these cannot be used for a variable name in Java.
A. identifier
B. keyword
C. identifier & keyword
D. none of the mentioned
ANSWER: B
Which one is a valid declaration of a boolean.
A. boolean b1 = 1;
B. boolean b2 = ‘false’;
C. boolean b3 = false;
D. boolean b4 = ‘true’
ANSWER: C
Modulus operator, %, can be applied to which of these.
A. Integers
B. Floating – point numbers
C. Both Integers and floating – point numbers
D. None of the mentioned
ANSWER: C
Can 8 byte long data type be automatically type cast to 4 byte float data type.
A. True
B. False
ANSWER: A
Which of the following loops will execute the body of loop even when condition controlling the loop is
initially false.
A. do-while
B. while
C. for
D. none of the mentioned
ANSWER: A
Which of this statement is incorrect.
A. switch statement is more efficient than a set of nested ifs
B. two case constants in the same switch can have identical values
C. switch statement can only test for equality, whereas if statement can evaluate any type of boolean
expression
D. it is possible to create a nested switch statements
ANSWER: B
From where break statement causes an exit.
A. Only from innermost loop
B. Terminates a program
C. Only from innermost switch
D. From innermost loops or switches
ANSWER: D
Which of these is not a bitwise operator.
A. &
B. &=
C. |=
D. <=
ANSWER: D
Which of these is returned by “greater than”, “less than” and “equal to” operators.
A. Integers
B. Floating – point numbers
C. Boolean
D. None of the mentioned
ANSWER: C
Which of these can not be used for a variable name in Java.
A. identifier
B. keyword
C. identifier & keyword
D. none of the mentioned
ANSWER: B
Which of the following loops will execute the body of loop even when condition controlling the loop is
initially false.
A. do-while
B. while
C. for
D. none of the mentioned
ANSWER: A
Which of these operators can skip evaluating right hand operand.
A. !
B. |
C. &
D. &&
ANSWER: D
When does method overloading is determined.
A. At run time
B. At compile time
C. At coding time
D. At execution time
ANSWER: B
Which of the following is a type of polymorphism in Java.
A. Compile time polymorphism
B. Execution time polymorphism
C. Multiple polymorphism
D. Multilevel polymorphism
ANSWER: A
What is it called where child object gets killed if parent object is killed.
A. Aggregation
B. Composition
C. Encapsulation
D. Association
ANSWER: B
Which statement is true about java.
A. Platform independent programming language
B. Platform dependent programming language
C. Code dependent programming language
D. Sequence dependent programming language
ANSWER: A
What is use of interpreter.
A. They convert bytecode to machine language code
B. They read high level code and execute them
C. They are intermediated between JIT and JVM
D. It is a synonym for JIT
ANSWER: B
Arrays in Java are implemented as.
A. class
B. object
C. variable
D. none of the mentioned
ANSWER: B
Which of these cannot be declared static.
A. class
B. object
C. variable
D. method
ANSWER: B
Which of these methods must be made static.
A. main()
B. delete()
C. run()
D. finalize()
ANSWER: A
What is the return type of a method that does not return any value.
A. int
B. float
C. void
D. double
ANSWER: C
Which method can be defined only once in a program.
A. main method
B. finalize method
C. static method
D. private method
ANSWER: A
String in Java is a.
A. class
B. object
C. variable
D. character array
ANSWER: A
Which of these keywords is used to refer to member of base class from a subclass.
A. upper
B. super
C. this
D. none of the mentioned
ANSWER: B
Which of these method of String class can be used to test to strings for equality.
A. isequal()
B. isequals()
C. equal()
D. equals()
ANSWER: D
What is false about constructor.
A. Constructors cannot be synchronized in Java
B. Java does not provide default copy constructor
C. Constructor have return type
D. “this” and “super” can be used in a constructor
ANSWER: C
Abstract class cannot have a constructor.
A. True
B. False
ANSWER: B
Which of these keywords can be used to prevent Method overriding.
A. static
B. constant
C. protected
D. final
ANSWER: D
Which of these class is superclass of every class in Java.
A. String class
B. Object class
C. Abstract class
D. ArrayList class
ANSWER: B
Which of these method of Object class is used to obtain class of an object at run time.
A. get()
B. void getclass()
C. Class getclass()
D. None of the mentioned
ANSWER: C
Which of these keywords are used to define an abstract class.
A. abst
B. abstract
C. Abstract
D. abstract class
ANSWER: B
Which of these packages contains abstract keyword.
A. [Link]
B. [Link]
C. [Link]
D. [Link]
ANSWER: A
A class member declared protected becomes a member of subclass of which type.
A. public member
B. private member
C. protected member
D. static member
ANSWER: B
What is not type of inheritance.
A. Single inheritance
B. Double inheritance
C. Hierarchical inheritance
D. Multiple inheritance
ANSWER: B
Static members are not inherited to subclass.
A. True
B. False
ANSWER: B
Which concept of Java is achieved by combining methods and attribute into a class.
A. Encapsulation
B. Inheritance
C. Polymorphism
D. Abstraction
ANSWER: A
Feature that allows the parent class and the subclass to have a same name.
A. Overloading
B. Inheritance
C. Polymorphism
D. Overriding
ANSWER: D
Which of the below is invalid identifier with the main method.
A. public
B. static
C. private
D. final
ANSWER: C
Which of the following is a valid declaration of an object of class Box.
A. Box obj = new Box();
B. Box obj = new Box;
C. obj = new Box();
D. new Box obj;
ANSWER: A