Title | Quiz 2021, questions and answers |
---|---|
Course | Programming 1 |
Institution | University of the People |
Pages | 5 |
File Size | 122.3 KB |
File Type | |
Total Downloads | 91 |
Total Views | 149 |
CS1102 Quiz Unit 1...
CS1102 Unit 1 Quiz
Question 1: What does a Java compiler do?
Select one:
a. Runs Java programs
b. Translates byte code in ".class" files into machine language ✔
c. Translates source code in ".class" files into machine language
d. Translates source code in ".java" files into Java byte code in ".class" files
e. Translates source code in ".java" files into machine language
Your answer is incorrect.
The correct answer is: Translates source code in ".java" files into Java byte code in ".class"
Question 2: Consider
the following line of Java code.
System.out.println("Hello, World!");
"System" is which of the following?
Select one: a. a class ✔ b. a method (subroutine) c. an object d. a parameter e. a statement Your answer is correct. "System" is a built-in Java class with static member objects, like "out". See Section 2.3.1 of Eck (2014). The correct answer is: a class
Question 3: Consider the following line of Java code.
System.out.println("Hello, World!");
The full line of code is which of the following?
Select one: a. a class b. a method (subroutine) c. an object d. a parameter e. a statement ✔
Question 4: Which
of the following is NOT a valid identifier in Java?
Select one: a. p b. Public c. public ✔ d. public23 e. PuBlIc_tWeNtY_3 Your answer is correct.
"public" is a reserved word in Java and cannot be used as an identifier. See Section 2.2 of Eck (2014). The correct answer is: public
Question 5: Consider the following line of Java code.
System.out.println("Hello, World!");
Which one of the following does NOT describe '"Hello, World!"'?
Select one: a. a declaration ✔ b. an expression c. a literal
d. a parameter e. a statement Your answer is correct.
'"Hello, World!"' is a String literal, which means it is also a String expression. It is the parameter to the method "println". It is not a declaration statement. See Sections 2.2.4 and 2.2.5 of Eck (2014).
...