• 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 3 out of 19 pages
Exam (elaborations)

CS 1102 Programming Self Quiz Unit 1,2 and 3- University of the People

Document preview thumbnail
Preview 3 out of 19 pages

CS 1102 Programming Self Quiz Unit 1,2 and 3- University of the People/CS 1102 Programming Self Quiz Unit 1,2 and 3- University of the People/CS 1102 Programming Self Quiz Unit 1,2 and 3- University of the People/CS 1102 Programming Self Quiz Unit 1,2 and 3- University of the People/CS 1102 Programming Self Quiz Unit 1,2 and 3- University of the People/CS 1102 Programming Self Quiz Unit 1,2 and 3- University of the People

Content preview

1.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

Question 2

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

Feedback

Your answer is incorrect.

The correct answer is: Translates source code in ".java" files into Java byte code in ".class" files

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

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

Question 5

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


6. Consider the following Java program:


1 public class HelloWorld {
2 // My first program!
3 public static void main(String[] args) {
4 System.out.println("Hello, World!");
5 }
6}

What is on line 1?

Select one:

a. a variable declaration

b. a statement

c. a method (subroutine) definition

d. a comment

e. a class definition

Feedback

Your answer is correct.

See Section 2.1 of Eck (2014).

The correct answers are: a variable declaration, a class definition

Question 2

Consider the following Java statements.
int x = 3;
x = x++;

Select one:

, a. 0

b. 3

c. 4

d. 5

e. The question is moot. The statements have a syntax error.

Question 3

Which of the following should be used to compare the contents of two String objects in Java?

Select one:

a. =

b. ==

c. cmp

d. equals

e. ?

Feedback

Your answer is incorrect.

"=" is for assignment. "==" compares the memory locations of String objects, not their contents. "cmp" is a
command from Python, not Java. "?" Is the conditional operator. Use "s1.equals(s2)" to compare the
contents of String "s1" and "s2". See Section 2.3.3 of Eck (2014).

The correct answer is: equals

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

Question 5

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

Document information

Uploaded on
August 15, 2022
Number of pages
19
Written in
2022/2023
Type
Exam (elaborations)
Contains
Questions & answers
$17.48

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.
Timeless2024
3.9
(683)
Sold
3673
Followers
3137
Items
2121
Last sold
1 month 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