Font size
WorksheetsJAVA PROGRAMMING
Total questions: 30
Worksheet time: 15mins
Here the class name is
(a)
memeber function name is
(a)
Select ALL subclasses
Account
Current
Mortgage
Bank
Which of these can not be used for a variable name in Java?
identifier
keyword
identifier & keyword
none of the mentioned
-OpeningDate
-InterestRate
are examples of what in OOP?
Classes
Objects
Attributes / Properties
Methods
How do you call a method in Java?
methodName();
methodName[];
(methodName);
methodName;
How do you create a method in Java?
methodName()
(methodName)
methodName[]
methodName.
The value of a string variable can be surrounded by single quotes.
true
false
Total number of primitive data types in Java are ....?
5
6
7
8
Which method can be used to find the highest value of x and y?
Math.largest(x,y)
Math.max(x,y)
Math.maximum(x,y)
Math.maxNum(x,y)
Command to compile Java program
javax
javay
javac
Java
which is the legal range of values for a short?
-128 to +127
-255 to 255
-32768 to 32767
0 to 65535
What does super keyword points to?
Super Class
Immediate parent class
none
Child class
Which data type is used to create a variable that should store text?
myString
String
Txt
string
Which of these operators is used to allocate memory to array variable in Java?
malloc
alloc
new
new malloc
What will be the output of the given code?
5 4
4 5
4 4
5 5
which declaration of the main() method is valid?
public void main(String args[])
public void static main(String args[])
final public static void main(String []arr)
public static void main(String []arr)
Java was developed in which year
1992
1993
1994
1995
What is the correct way to create an object called myObj of MyClass?
new myObj = MyClass();
class MyClass = new myObj();
class myObj = new MyClass();
MyClass myObj = new MyClass();
Which of the following below resides in heap memory in java?
class
instance variable
object
method
Java does not support.
Multiple Inheritance
Single Inheritance
Multilevel Inheritance
Hierarchical Inheritance
Is 3*4 equivalent to 3 << 2 ?
Yes
NO
Column size of a 2D array can be allocated separately!
True
False
The size of the 'long' data type in bits is .....
8-bit
16-bit
32-bit
64-bit
Which operator can be used to compare two values?
==
=
<>
><
What will be the error in the following Java code?
byte b = 50;
b = b * 50;
b cannot contain value 100, limited by its range
* operator has converted b * 50 into int, which can not be converted to byte without casting
b cannot contain value 50
No error in this code
What will be the result of given programme?
Hello World!
Infinite loop
Compile-time error
Run-time error
Java programs ________________
are only compiled
are only compiled not interpreted
are only interpreted
are both compiled and interpreted
Total number of primitive data types in Java are ....?
5
6
7
8
In Java, it is possible to inherit attributes and methods from one class to another.
True
False
