1
Intro to Java Programming Questions with
Correct Answers for Specific Exam Mail
Which of the following are storage devices?
Select one or more:
A. floppy disk
B. hard disk
C. flash drive
D. CD-ROM
Ans: A, B, C, and D
Select the item that doesn't belong on the list.
A. software
B. machine language
C. JVM
D. bytecode
E. CPU
Ans: E
The Java compiler translates source code into __________.
Select one:
A. Java bytecode
Pretest - Stuvia US
,2
B. machine code
C. assembly language code
D. none of the above
Ans: Java bytecode
For the Java program below, what file name should the source code be
stored in?
public class MyProg{System.out.println( "Hello World" );}
Select one:
A. MyProg.txt
B. MyProg.docx
C. MyProg.java
D. Any file name with a .java extension
Ans: MyProg.java
Which of the following is the correct way to write the header for a main
method?
Select one:
A. public static void main( string [] args )
B. public static void main( String [] args )
C. public static void Main( String [] args )
D. public static main( String [] args )
Ans: public static void main( String [] args )
Pretest - Stuvia US
,3
__________ is considered to be the brain of a computer.
Select one:
A. hardware
B. CPU
C. memory
D. disk drive
Ans: CPU
Which JDK command will compile a Java program named YourProgram?
Select one:
A. java YourProgram
B. java YourProgram.java
C. javac YourProgram.java
D. javac YourProgram
Ans: javac YourProgram.java
What is the output of the following program?
public class 6Times2{public static void main( String [] args ){System.out.println(
"6 times 2 is 12" );}}
Select one:
A. "6 times 2 is 12"
B. 6 times 2 is 12
C. The program will not compile
D. The program will compile, but it will produce a runtime error
Pretest - Stuvia US
, 4
Ans: The program will not compile
Which of the following statements are true? (select all that apply)
Select one or more:
A. The Java compiler translates source code into machine language that
can be directly executed on a computer.
B. The output file produced by the Java compiler is architecturally neutral.
C. A Java program named MyProgram should be stored in a file named
MyProgram.java.
D. The Java language is a high-level programming language.
Ans: A and D
What was the original name for the Java language?
Select one:
A. Java
B. Oak
C. Maple
D. D
Ans: Oak
What is the output of the following code?
public static void main( String [] args ){int a;int b = 10;a = 9;c = a +
b;System.out.println( a + "\t" + b + "\t" + c );}
Select one:
Pretest - Stuvia US
Intro to Java Programming Questions with
Correct Answers for Specific Exam Mail
Which of the following are storage devices?
Select one or more:
A. floppy disk
B. hard disk
C. flash drive
D. CD-ROM
Ans: A, B, C, and D
Select the item that doesn't belong on the list.
A. software
B. machine language
C. JVM
D. bytecode
E. CPU
Ans: E
The Java compiler translates source code into __________.
Select one:
A. Java bytecode
Pretest - Stuvia US
,2
B. machine code
C. assembly language code
D. none of the above
Ans: Java bytecode
For the Java program below, what file name should the source code be
stored in?
public class MyProg{System.out.println( "Hello World" );}
Select one:
A. MyProg.txt
B. MyProg.docx
C. MyProg.java
D. Any file name with a .java extension
Ans: MyProg.java
Which of the following is the correct way to write the header for a main
method?
Select one:
A. public static void main( string [] args )
B. public static void main( String [] args )
C. public static void Main( String [] args )
D. public static main( String [] args )
Ans: public static void main( String [] args )
Pretest - Stuvia US
,3
__________ is considered to be the brain of a computer.
Select one:
A. hardware
B. CPU
C. memory
D. disk drive
Ans: CPU
Which JDK command will compile a Java program named YourProgram?
Select one:
A. java YourProgram
B. java YourProgram.java
C. javac YourProgram.java
D. javac YourProgram
Ans: javac YourProgram.java
What is the output of the following program?
public class 6Times2{public static void main( String [] args ){System.out.println(
"6 times 2 is 12" );}}
Select one:
A. "6 times 2 is 12"
B. 6 times 2 is 12
C. The program will not compile
D. The program will compile, but it will produce a runtime error
Pretest - Stuvia US
, 4
Ans: The program will not compile
Which of the following statements are true? (select all that apply)
Select one or more:
A. The Java compiler translates source code into machine language that
can be directly executed on a computer.
B. The output file produced by the Java compiler is architecturally neutral.
C. A Java program named MyProgram should be stored in a file named
MyProgram.java.
D. The Java language is a high-level programming language.
Ans: A and D
What was the original name for the Java language?
Select one:
A. Java
B. Oak
C. Maple
D. D
Ans: Oak
What is the output of the following code?
public static void main( String [] args ){int a;int b = 10;a = 9;c = a +
b;System.out.println( a + "\t" + b + "\t" + c );}
Select one:
Pretest - Stuvia US