• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 4 out of 37 pages
Exam (elaborations)

Intro. to Java Programming UPDATED Exam Questions and CORRECT Answers

Document preview thumbnail
Preview 4 out of 37 pages

Intro. to Java Programming UPDATED Exam Questions and CORRECT Answers Which of the following are storage devices? Select one or more: A. floppy disk B. hard disk C. flash drive D. CD-ROM - CORRECT ANSWER - A, B, C, and D

Content preview

Intro. to Java Programming UPDATED
Exam Questions and CORRECT Answers
Which of the following are storage devices?


Select one or more:
A. floppy disk
B. hard disk
C. flash drive

D. CD-ROM - CORRECT ANSWER - 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 - CORRECT ANSWER -E


The Java compiler translates source code into __________.
Select one:
A. Java bytecode
B. machine code
C. assembly language code

D. none of the above - CORRECT ANSWER - 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 - CORRECT ANSWER - 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 ) - CORRECT ANSWER - public static void main(
String [] args )


__________ is considered to be the brain of a computer.
Select one:
A. hardware
B. CPU
C. memory

D. disk drive - CORRECT ANSWER - 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 - CORRECT ANSWER - 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 - CORRECT ANSWER -
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. - CORRECT ANSWER -A
and D


What was the original name for the Java language?
Select one:
A. Java
B. Oak
C. Maple

D. D - CORRECT ANSWER - 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:
A. 9 10 19

, B. a = 9 b = 10 c = 19
C. The program will not compile and run
D. The program will compile, but a runtime error will be generated - CORRECT
ANSWER - The program will not compile and run


Which of the following is accomplished in the Java statement int myVariable; ? (select all that
apply)
Select one or more:
A. The name myVariable is made known to a portion of the program.
B. The data type int is associated with myVariable.
C. The value of myVariable is initialized to zero by default.

D. The value of myVariable is not initialized. - CORRECT ANSWER - A,B, and D


Which of the following are valid Java variable names? (select all that apply)
Select one or more:
A. Hello
B. test_score
C. 4ere
D. 5+5

E. float - CORRECT ANSWER - A and B


Which of the following statements is true?
Select one:
A. The portion of a program over which a variable is known and can be referenced is called a
variable's duration.
B. The portion of a program over which a variable is known and can be referenced is called a
variable's lifetime.
C. The portion of a program over which a variable is known and can be referenced is called a
variable's scope.

Document information

Uploaded on
April 17, 2025
Number of pages
37
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$11.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
STANFORDGRADESS
4.0
(242)
Sold
1704
Followers
109
Items
123764
Last sold
8 hours ago




Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions