Question :
MULTIPLE CHOICE
1.To compile a program named First, use the following : 2007982
MULTIPLE CHOICE
1.To compile a program named First, use the following command
a.java First.java
b.javac First
c.javac First.java
d.compile First.javac
2.A Java program must have at least one of these:
a.Class definition
b.Variable
c.Comment
d.System.out.println(); statement
3.The ___________ is normally considered the standard output and standard input devices, and usually refer to the monitor and keyboard.
a.CRT
b.CPU
c.secondary storage devices
d.console
4.If the following Java statements are executed, what will be displayed?
System.out.println("The top three winners are\n");
System.out.print("Jody, the Giant\n");
System.out.print("Buffy, the Barbarian");
System.out.println("Adelle, the Alligator");
a.The top three winners are
Jody, the Giant
Buffy, the Barbarian
Adelle, the Alligator
b.The top three winners are
Jody, the Giant\nBuffy, the BarbarianAdelle, the Alligator
c.The top three winners are Jody, the Giant\nBuffy, the BarbarianAdelle, and the Albino
d.The top three winners are
Jody, the Giant
Buffy, the BarbarianAdelle, the Alligator
5.This is a value that is written into the code of a program.
a.literal
b.assignment statement
c.variable
d.operator
6.What would be printed out as a result of the following code?
System.out.println("The quick brown fox" +
"jumped over the \n"
"slow moving hen.");
a.The quick brown fox jumped over the \nslow moving hen.
b.The quick brown fox jumped over the
slow moving hen.
c.The quick brown fox
jumped over the
slow moving hen.
d.Nothing. This is an error.
7.Which of the following is not a rule that must be followed when naming identifiers?
a.The first character must be one of the letters a-z, A-Z, and underscore or a dollar sign.
b.Identifiers can contain spaces.
c.Uppercase and lowercase characters are distinct.
d.After the first character, you may use the letters a-z, A-Z, the underscore, a dollar sign, or digits 0-9.
8.Which of the following is not a primitive data type?
a.short
b.long
c.float
d.String
9.Which of the following is valid?
a.float y;
y = 54.9;
b.float y;
double z;
z = 934.21;
y = z;
c.float w;
w = 1.0f;
d.float v;
v = 1.0;
10.The boolean data type may contain values in the following range of values
a.true or false
b.-128 to + 127
c.- 2,147,483,648 to +2,147,483,647
d.- 32,768 to +32,767