WorksheetsJavapie Quiz
Total questions: 20
Worksheet time: 10mins
What is the range of short data type in Java?
-128 to 127
-32768 to 32767
-2147483648 to 2147483647
None of the mentioned
Which data type value is returned by all transcendental math functions?
int
float
double
long
Java is created by?
Hal Abelson
James Gosling
Hannry Bottom
Alfred Aho
What will be the output of these statement?
class output {
public static void main(String args[])
{
double a, b,c;
a = 3.0/0;
b = 0/4.0;
c=0/0.0;
System.out.println(a);
System.out.println(b);
System.out.println(c);
}
}
Infinity
0.0
NaN
all of the mentioned
Which of the following can be operands of arithmetic operators?
Numeric
Boolean
Characters
Both Numeric & Characters
Modulus operator, %, can be applied to which of these?
Integers
Floating – point numbers
Both Integers and floating – point numbers
None of the mentioned
What is the output of this program?
class increment
{
public static void main(String args[])
{
double var1 = 1 + 5;
double var2 = var1 / 4;
int var3 = 1 + 5;
int var4 = var3 / 4;
System.out.print(var2 + " " + var4);
}
}
1 1
0 1
1.5 1
1.5 1.0
What is the output of this program?
advertisement
class Modulus
{
public static void main(String args[])
{
double a = 25.64;
int b = 25;
a = a % 10;
b = b % 10;
System.out.println(a + " " + b);
}
}
5.640000000000001 5
5.640000000000001 5.0
5 5
5 5.640000000000001
Which of these are selection statements in Java?
if()
for()
continue
break
Which of the following is not OOPS concept in Java?
Inheritance
Encapsulation
Polymorphism
Compilation
Which of these is an incorrect array declaration?
int arr[] = new int[5].
int [] arr = new int[5].
int arr[] = new int[5].
int arr[] = int [5] new
What is the output of this program?
class array_output
{
public static void main(String args[])
{
int array_variable [] = new int[10];
for (int i = 0; i < 10; ++i)
{
array_variable[i] = i;
System.out.print(array_variable[i] + " ");
i++;
}
}
}
0 2 4 6 8
1 3 5 7 9
0 1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9 10
Which of these is necessary to specify at time of 2D array initialization?
Row
Column
Both Row and Column
None of the mentioned
What is the output of following program ?
public class Solution {
public static void main (String[] args) {
String s="563";
System.out.println(12 + s + 70);
}
}
12s70
1256370
645
12633
What is mean by JVM ?
Java Virtual Maintenance
Java Verification Machine
Java Virtual Machine
Jason Virtual Machine
Which of these can not be used for a variable name in Java?
identifier
keyword
identifier & keyword
none of the mentioned
The while loop repeats a set of code while the condition is not met?
True
False
Which of these is an incorrect Statement?
It is necessary to use new operator to initialize an array
Array can be initialized using comma separated expressions surrounded by curly braces
Array can be initialized when they are declared
None of the mentioned
Which of these coding types is used for data type characters in Java?
ASCII
ISO-LATIN-1
UNICODE
None of the mentioned
What is the output of this program?
class mainclass {
public static void main(String args[])
{
char a = 'A';
a++;
System.out.print((int)a);
}
}
66
67
65
64
