Quiz 1
Quiz 1
NAME –
ROLL NO –
Question 1) Question 3)
What is the result of expression In java __(1)__ loop can only test for equality,
5.45 + "3.2"? whereas, ___(2)____ can evaluate any Boolean
expression.What is (1) and (2) ?
The long value 8.
A) (1) – if , (2) – switch
A)
The String "5.453.2"
B) (1) – switch , (2) – if
B)
The string "8.6"
C) (1) – if , (2) – break
C)
The double value 8.6
D) (1) – continue , (2) – if
D)
Question 2)
public class Question { Question 4)
Question 5)
Default value of Boolean data type is
A) True
B) False
C) Garbage value
D) None of these
A) for
Question 6) B) do-while
Find output –
C) while
public class IntTest { D) None of these
public static void main(String[] args) {
int a=10; Question 11)
int b=20; Choose incorrect statement
A) class String is used to display messages
a+=(a=4);
string created with StringBuffer class is of variable
b+=(b=5); B)
length
System.out.println(a+”,”+b); C) String is a class and keyword used in java
} D) atring created with StringBuffer cannot be modified
}
Question 12)
14 , 25 String is an object that is created using
A)
A) String class
4,5 B) StringBuffer class
B)
C) Both A and B
8 , 25
C) D) None of these
Question 40)
Which of the following variable declaration
would NOT compile in a java program?
int var;
A)
int VAR;
B)
int 1_var;.
C)
int var1;
D)