1. A _________ is a basic unit of
storage in Java.
|
||
A.
|
Identifier
|
|
B.
|
Variable
|
|
C.
|
Constant
|
|
D.
|
Memory
|
2
|
. What is the default data type of a decimal
number in Java?
|
|
A.
|
int
|
|
B.
|
float
|
|
C.
|
double
|
|
D.
|
long
|
3. What would be the output of the
following program?
|
|||
A.
|
byte=0 short=0 int=0
long=0 float=0.0 double=0.0
char= boolean=false
|
||
B.
|
byte=0 short=0 int=0
long=0 float=0.000000
double=0.000000
char= boolean=false
|
||
C.
|
Compilation Error
|
||
D.
|
None of the Above
|
4. What would be the output of the
following program?
|
||
A.
|
byte=0 short=0 int=0
long=0 float=0.0 double=0.0
char= boolean=false
|
|
B.
|
byte=0 short=0 int=0
long=0 float=0.000000
double=0.000000
char= boolean=false
|
|
C.
|
Compilation Error
|
|
D.
|
None of the Above
|
5. What would be the output of the
following program?
|
||
A.
|
byte=0 short=0 int=0
long=0 float=0.0 double=0.0
char= boolean=false
|
|
B.
|
byte=0 short=0 int=0
long=0 float=0.000000
double=0.000000
char= boolean=false
|
|
C.
|
byte=0 short=0 int=0
long=0 float=0 double=0
char=null boolean=false
|
|
D.
|
Compilation Error
|
6. What would be the output of the
following program?
|
|||
A.
|
Hello World!
i=0
|
||
B.
|
Hello World!
|
||
C.
|
Compilation Error
|
||
D.
|
None of the Above
|
7. What would be the output of the
following program?
|
||
A.
|
i=10 j=10 k=10
|
|
B.
|
Compilation Error
|
|
C.
|
i=0 j=0 k=10
|
8. What would be the output of the
following program?
|
||
A.
|
i is not used in this program!
|
|
B.
|
Compilation Error
|
9. How can we create an unsigned
int variable in Java?
|
||
A.
|
Can not be created
|
|
B.
|
unsigned int i;
|
|
C.
|
int i=(unsigned int) 10;
|
|
D.
|
int unsigned i;
|
10. What would be the output of
the following program?
|
||
A.
|
128
|
|
B.
|
-128
|
|
C.
|
Compilation Error
|
|
D.
|
None of the Above
|
11. What would be the output of
the following program?
|
||
A.
|
128
|
|
B.
|
-127
|
|
C.
|
Compilation Error
|
|
D.
|
None of the Above
|
12. What is the width and range of
int in java?
|
||
A.
|
32 bits | -2,147,483,648 to
2,147,483,647
|
|
B.
|
32 bits | 0 to 4294967296
|
|
C.
|
16 bits | -32768 to 32767
|
|
D.
|
Compiler Dependent
|
13. What would be the output of the
following program?
class CharRange
{
public static void main(String[]
args)
{
char ch=88;
System.out.println(ch+"
= " +(int)ch);
ch=ch+1;
System.out.println(ch+"
= " +(int)ch);
}
}
|
14. What would be the output of
the following program?
|
||
A.
|
9
|
|
B.
|
09
|
|
C.
|
00
|
|
D.
|
Compilation Error
|
15. What would be the output of the
following program?
class OctalPrgm
{
public static void main(String[]
args)
{
int i=07;
System.out.println(++i);
i=i+1;
System.out.println(++i);
}
}
|
|||
16. What would be
the output of the following program?
|
|||
A.
|
10
|
||
B.
|
a
|
||
C.
|
16
|
||
17. What would be the output of
the following program?
|
||
A.
|
0
|
|
B.
|
16
|
|
C.
|
17
|
|
D.
|
Compilation Error
|
18. What would be the output of the
following program?
class Scope1
{
public static void main(String
args[])
{
int i=10;
System.out.println(i);
if (i==10)
{
int i=20;
System.out.println(i);
}
System.out.println(i);
}
}
|
19. What would be the output of
the following program?
|
||
A.
|
i=10
i=20, j=20
|
|
B.
|
i=10
i=10,j=20
|
|
C.
|
Compilation Error
|
|
D.
|
None of the Above
|
20. What would be the output of
the following program?
|
||
A.
|
i=1 y=1
i=2 y=2
i=3 y=3
|
|
B.
|
i=1 y=1
i=2 y=1
i=3 y=1
|
|
C.
|
i=1 y=1
i=1 y=1
i=1 y=1
|
|
D.
|
Compilation Error
|
No comments:
Post a Comment