Font size
WorksheetsBasics in Java
Total questions: 15
Worksheet time: 9mins
What type of literal is "null"?
null Literal
Character Literal
String Literal
It is not a Literal
Function of the Scanner class to accept a float literal from the user is
nextInt( )
hasNext( )
next( )
nextFloat( )
What is the value of c after int c = 'B'+3; is executed?
101
69
Code is incorrect
B3
Select the types of programming constructs in Java.
Selective
Sequential
Random
Iterative
r and l in r-value and l-value are
read and location
real and location
reference and location
right and left
Absence of _________ in switch..case leads to fallthrough
switch
case
default
break
The compiler of Java works on_______ to give _________.
Byte Code, Source Code
Source Code, Object Code
Source Code, Byte Code
Byte Code, Object Code
Predict the value of k,
int k =10;
k=k+k++;
11
20
21
22
Select the options that will yield a boolean value if a and b are of integer datatype and c is of boolean datatype.
a=b
a>b&&b>c
a==b
!c
Predict the output of,
if(true)
{
System.out.println("true");
}
else
{
System.out.println("false");
}
true
false
No Output
Compile error
What is the value of p after the following statement is executed?
int p=4538%100
8
38
4538
4
Select all the statements that shows static initialisation of an integer variable x.
x=10
static int x;
x=y+10;
x=10.0
Select all the statement that finds the above value
Math.pow(x,1/3)
Math.sqrt(x)
Math.pow(x,3)
Math.cbrt(x)
Rewrite the following code block after removing the errors.
char m='H';
int p=m*5;
m=p;
Find the output of,
int x =4;
while(x>5)
{
System.out.println(x);
x++;
}
6
7
8... infinity
1
2
3
4
No Output
4
5
