Which of the following is the general form of the conditional operator?
expression 1:expression 2?conditional expression;
conditional expression? expression 1 : expression 2;
Conditional expression:expressions?expression2;
All of them
What does the following code fragment write to the monitor?
int sum=14
if(sum<20)
System.out.print("under");
else
System.out.print("over");
System .out.print ln ("the limit");
under
over
under the limit
over the limit
What Value is placed in awk?
int x=5,y=19; awk=y-x>x-y?Y-x:X-Y;
5
19
14
-14
What value is placed in choice. int a=5,b=10,c=15 choice=a>b && a>c? a:(b>c? b:c);
15
10
0
What can be the test-expression for if in the following program? int a=12,b=21; if(?) { System.Out.Println ("A is largest"); } else { System.Out.Print ("B is largest");
}
a<b
a>b
a!=b
a!<b
What is meant by conditional branching?
Branching based on particular condition.
Branching done if condition is true
Branching is done if condition is false
Branching takes place without any decision.
How many choices are possible when using a single if else statement.
1
2
3
Many choices
if (0) { System.out. println ("Sreenath"); } else { System.out.Println ("Suresh"); }
What is the output of the given program?
Syntax error
sreenath
Suresh
both a and b
What is the sequence of statement contained in a pair of braces called as?
block
function
branch
Class
What is the output of the given program? int i =-1; if (i>-2) { System.Out.Println("India"); }
else { System.out.println("America"); }
Complication error
Run time error
India
America