Multiple choice question of Java Set (2)


Multiple choice question of Java

Set (2)

1)The statement n++ is equivalent to:

a) ++n           b) n=n+1           c) n+1             d) none

2) What will be output of a & b the following,if int a,b;a=10;b=++a?

a)10,10         b) 10,11             c) 11,10          d)11,11

3) What will be the output of a++;int a=-1?

a)1                b)-1                    c)0                  d) none

4) if int a=43; int b=5;  int c=0;what value is stored in c when c=a%b?

a) 8.6            b) 8.0                  c)0                  d) none

5) What is the result of the following in java statement: When int m=8;m*=8;System.out.println(“The output=”+m)?

a) 8              b) 16                    c) 64                d) 88

6) Double c;int x,y,z;x=5;y=10;z=11;c=x*y+z/2; the value stored in c is:

a)  55.0         b)55.5                 c) 55                d) none

7) int m,p; m=5;p=0;p=++m+  –m;the output will be:

a) 11              b)10                    c)9                   d) 12

8) int a=7;int p=0;  p=++a+  –a; the output of p will be:

a) 13               b) 14                  c) 15                d) -15

9) What is the binary equivalent of (45)10?

a) (110011)2    b)(101101)2     c)(100101)2       d)(1011010)2

10) if a=0 ,b=1;then the output of logical OR will be

a) 0                  b) 1                   c) both 0 & 1   d) none

11) { if(a!=b)

c=a;

else c=b;}

can be written as:

a) c= (b!=a)?a:b;             b) c=(a!= b)?a:b;

c) c=(a!= b)? b:a;            d) both a &b

12) Which of the following is a selective statement?

a) if                b) goto        c)  for          d) none

13) A compound statement in a Java programming is enclosed in:

a) parenthesis    b) Braces     c) square brackets     d)All of them

14) If condition is essentially formed by using:

a) Arithmetic operators        b) Relational operators

c) Logical operators               d) Ternary operators

15) if ((a!=b)&&(a==c)),then which of the statement is true:

a)  b is the smallest number          b) b is the greatest number

c) a is the smallest number            d) both (a) & (b)

 

Answer  1) b       2) b         3) c           4) d          5) c          6) a        7)  a        8) c            9)                                                                    10)   b             11) d           12) a          13) b        14)  b        15) b

Comments are closed.