Font size
Worksheetsjava
Total questions: 87
Worksheet time: 22hrs 45mins
Attributes of an object are also known as
methods
properties
classes
functions
Polymorphism related to :
PPO
Class
OPP
OOP
Which from the following is a feature that allows us to perform a single action in different ways.
Abstraction
Polymorphism
Encapsulation
Inheritance
The process by which objects of one class acquire the properties of objects of another class is known as
Polymorphism
Inheritance
Data Hiding
Association
Which of the these is the functionality of ‘Encapsulation’?
Binds together code and data
Using single interface for general class of actions
Reduce Complexity
All of the mentioned
What is the main difference between float and double data types?
4.1 is an example of float.
4.11 is an example of double.
Float consists of 8 bytes, and double consists of 4 bytes.
Float consists of 4 bytes, and double consists of 8 bytes.
How do you create a variable with the numeric value 5?
float x = 5;
x = 5;
int x = 5;
num x = 5
Which data type is used to create a variable that should store text?
myString
String
Txt
string
How do you insert COMMENTS in Java code?
# This is a comment
/* This is a comment
// This is a comment
Java is short for "JavaScript".
true
false
How do you create a variable with the floating number 2.8?
byte x = 2.8f
x = 2.8f;
float x = 2.8f;
int x = 2.8f;
The value of a string variable can be surrounded by single quotes.
true
false
The default value of a static integer variable of a class in Java is,
(a) 0
(b) 1
(c) Garbage value
d) Null
(e) -1.
Java is a
Procedure Oriented Language
Structure Oriented Language
Object_Oriented Language
Machine Language
The name of the following should be the file name in Java
Object Name
Variable Nam
Class Name
Array Name
Java program is
Interpreted
Compiled
Java program does not run without below function
user()
system()
main()
void()
A ___________ file is created after successful compilation of a Java program.
Object file
Array file
Class file
String file
Command to compile Java program
javax
javay
javac
Java
Command to run a Java program
javaa
java
jaava
jaavaa
JDK stands for
Java Developer Kit
Java Development Kit
Java Design Kit
Java Debugging Kit
JRE stands for
Java Run Environment
Java Run Execution
Java Runtime Environment
Java Ready Execution
Java is
Machine dependent language
Machine independent language
Java is a
Procedure Oriented Language
Structure Oriented Language
Object_Oriented Language
Machine Language
Java is a
Procedure Oriented Language
Structure Oriented Language
Object_Oriented Language
Machine Language
The name of the following should be the file name in Java
Object Name
Variable Nam
Class Name
Array Name
Java program is
Interpreted
Compiled
Java program does not run without below function
user()
system()
main()
void()
A ___________ file is created after successful compilation of a Java program.
Object file
Array file
Class file
String file
Command to compile Java program
javax
javay
javac
Java
Command to run a Java program
javaa
java
jaava
jaavaa
JDK stands for
Java Developer Kit
Java Development Kit
Java Design Kit
Java Debugging Kit
JRE stands for
Java Run Environment
Java Run Execution
Java Runtime Environment
Java Ready Execution
Java is
Machine dependent language
Machine independent language
which of the following is wrapper class in java
Float
Integer
Double
all of above
which one of the following is true?
runnable interface declares the start method
Thread.start() method is used to move a thread from a new state to the runnable state
Thread.runnable() method is used to move a thread from new state to the runnable state
Thread.run() method is used to move a thread from new state to the runnable state
Which one of the following statement is not true about the collection interface?
all methods defined in set interface are also defined in collection interface
list interface extends collection interface
set interface extends collection interface
all methods defined in list interface are also defined in collection interface
which one of the following is a legal decelration of a two- dimensional array of integers
int[] a[] = new int[5][];
int[5][5] a = new int[][];
int a = new int[5,5];
int[][] a = new int[][5];
which interface needs to be implemented in order to make an object seralized
clonnable
remote
seralizable
none of the above
superclass of all classes representing the output stream of characters is -------------
OutputStream
Reader
InputStream
Writer
which of this class is used by character streams for reading data from buffer
BufferReader
InputStreamReader
FileReader
FileInputStream
which one this keywords are used to create a class in java
class
struct
int
none of the avove
which one of these events will cause the thread to die?
on calling the sleep() method.
when the execution of the run() method ends
when the execution of the start() method ends
on calling the wait() method
which one of the following have elements in insertion order
sorted map
hashmap
linkedhashmap
treemap
Java is a
Procedure Oriented Language
Structure Oriented Language
Object_Oriented Language
Machine Language
The name of the following should be the file name in Java
Object Name
Variable Nam
Class Name
Array Name
Java program is
Interpreted
Compiled
Java program does not run without below function
user()
system()
main()
void()
A ___________ file is created after successful compilation of a Java program.
Object file
Array file
Class file
String file
Command to compile Java program
javax
javay
javac
Java
Command to run a Java program
javaa
java
jaava
jaavaa
JDK stands for
Java Developer Kit
Java Development Kit
Java Design Kit
Java Debugging Kit
JRE stands for
Java Run Environment
Java Run Execution
Java Runtime Environment
Java Ready Execution
Java is
Machine dependent language
Machine independent language
Which of the following option leads to the portability and security of Java?
Bytecode is executed by JVM
The applet makes the Java code secure and portable
Use of exception handling
Dynamic binding between objects
Which of the following is not a Java features?
Dynamic
Architecture Neutral
Use of pointers
Object-oriented
_____ is used to find and fix bugs in the Java programs.
JVM
JRE
JDK
JDB
Which of the following is a valid declaration of a char?
char ch = '\utea';
char ca = 'tea';
char cr = \u0223;
char cc = '\itea';
What does the expression float a = 35 / 0 return?
0
Not a number
Infinity
Run time exception
Evaluate the following Java expression, if x=3, y=5, and z=10:
++z + y - y + z + x++
24
23
20
25
Which of the following for loop declaration is not valid?
for ( int i = 99; i >= 0; i / 9 )
for ( int i = 7; i <= 77; i += 7 )
for ( int i = 20; i >= 2; - -i )
for ( int i = 2; i <= 20; i = 2* i )
Which of the following is not OOPS concept in Java?
Inheritance
Encapsulation
Polymorphism
Compilation
Which of the following is a type of polymorphism in Java?
Compile time polymorphism
Execution time polymorphism
Multiple polymorphism
Multilevel polymorphism
When does method overloading is determined?
At run time
At compile time
At coding time
At execution time
Which concept of Java is a way of converting real world objects in terms of class?
Polymorphism
Encapsulation
Abstraction
Inheritance
Which concept of Java is achieved by combining methods and attribute into a class?
Encapsulation
Inheritance
Polymorphism
Abstraction
Which component is used to compile, debug and execute java program?
JVM
JDK
JIT
JRE
Which of the below is invalid identifier with the main method?
public
static
final
private
What is use of interpreter?
They convert bytecode to machine language code
They read high level code and execute them
They are intermediated between JIT and JVM
It is a synonym for JIT
What is the extension of compiled java classes?
.java
.class
.txt
.js
Which of these keywords is used to make a class?
class
struct
int
none of the mentioned
Which of these statement is incorrect?
Every class must contain a main() method
Applets do not require a main() method at all
There can be only one main() method in a program
main() method must be made public
Which of the following statements is correct?
Public method is accessible to all other classes in the hierarchy
Public method is accessible only to subclasses of its parent class
Public method can only be called by object of its class
Public method can be accessed by calling object of the public class
Which of this keyword must be used to inherit a class?
super
this
extend
extends
Output of following Java Program?
Derived::show() called
Base::show() called
Run time Error
Compilation Error
Output of following Java Program?
10
20
Compilation Error
Run Time Error
Output of following Java Program?
12
321
123
23
What will be the output of following program?
Base::show() called
Derived::show() called
Compiler Error
Runtime Error
What will be the output of the following program?
Base::show() called
Derived::show() called
Compiler Error
Run Time Error
Which inheritance in java programming is not supported
Multiple inheritance using classes
Multiple inheritance using interfaces
Multilevel inheritance
Single inheritance
What is subclass in java?
A subclass is a class that extends another class
A subclass is a class declared inside a class
Both above.
None of the above.
Output of following Java program?
Base
Derived
Derived
Base
Base
Derived
Base
Derived
Base
Compiler Error
Predict the output of following program
Base
Derived
Compiler Error
Runtime Error
Predict the output of following Java Program
Compiler Error
Grandparent's Print()
Parent's Print()
Child's Print()
Child's Print()
Parent's Print()
Grandparent's Print()
Runtime Error
