Deck 1: Introduction to Computers, Programs, and Java

Full screen (f)
exit full mode
Question
Assume x is 0. What is the output of the following statement? Assume x is 0. What is the output of the following statement?  <div style=padding-top: 35px>
Use Space or
up arrow
down arrow
to flip the card.
Question
What is the printout of the following switch statement? <strong>What is the printout of the following switch statement?  </strong> A) ab B) a C) aa D) abc E) abcd <div style=padding-top: 35px>

A) ab
B) a
C) aa
D) abc
E) abcd
Question
Which of the following is a constant, according to Java naming conventions?

A) read
B) MAX_VALUE
C) ReadInt
D) Test
Question
What is y after the following switch statement is executed? <strong>What is y after the following switch statement is executed?  </strong> A) 1 B) 4 C) 3 D) 2 E) 0 <div style=padding-top: 35px>

A) 1
B) 4
C) 3
D) 2
E) 0
Question
To declare a constant MAX_LENGTH inside a method with value 99.98, you write

A) final double MAX_LENGTH = 99.98;
B) double MAX_LENGTH = 99.98;
C) final MAX_LENGTH = 99.98;
D) final float MAX_LENGTH = 99.98;
Question
Analyze the following code: <strong>Analyze the following code:  </strong> A) Code 2 has syntax errors. B) Code 1 has syntax errors. C) Both Code 1 and Code 2 have syntax errors. D) Both Code 1 and Code 2 are correct, but Code 2 is better. <div style=padding-top: 35px>

A) Code 2 has syntax errors.
B) Code 1 has syntax errors.
C) Both Code 1 and Code 2 have syntax errors.
D) Both Code 1 and Code 2 are correct, but Code 2 is better.
Question
What is x after evaluating x = (2 > 3) ? 2 : 3;

A) 5
B) 2
C) 3
D) 4
Question
What is y after the following switch statement? <strong>What is y after the following switch statement?  </strong> A) 2 B) 1 C) 0 D) -1 <div style=padding-top: 35px>

A) 2
B) 1
C) 0
D) -1
Question
Analyze the following code. <strong>Analyze the following code.  </strong> A) The value of variable x is always printed. B) The symbol x is always printed twice. C) The symbol x is always printed. D) Nothing is printed because x > 0 is false. <div style=padding-top: 35px>

A) The value of variable x is always printed.
B) The symbol x is always printed twice.
C) The symbol x is always printed.
D) Nothing is printed because x > 0 is false.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/9
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 1: Introduction to Computers, Programs, and Java
1
Assume x is 0. What is the output of the following statement? Assume x is 0. What is the output of the following statement?
C
2
What is the printout of the following switch statement? <strong>What is the printout of the following switch statement?  </strong> A) ab B) a C) aa D) abc E) abcd

A) ab
B) a
C) aa
D) abc
E) abcd
B
3
Which of the following is a constant, according to Java naming conventions?

A) read
B) MAX_VALUE
C) ReadInt
D) Test
B
4
What is y after the following switch statement is executed? <strong>What is y after the following switch statement is executed?  </strong> A) 1 B) 4 C) 3 D) 2 E) 0

A) 1
B) 4
C) 3
D) 2
E) 0
Unlock Deck
Unlock for access to all 9 flashcards in this deck.
Unlock Deck
k this deck
5
To declare a constant MAX_LENGTH inside a method with value 99.98, you write

A) final double MAX_LENGTH = 99.98;
B) double MAX_LENGTH = 99.98;
C) final MAX_LENGTH = 99.98;
D) final float MAX_LENGTH = 99.98;
Unlock Deck
Unlock for access to all 9 flashcards in this deck.
Unlock Deck
k this deck
6
Analyze the following code: <strong>Analyze the following code:  </strong> A) Code 2 has syntax errors. B) Code 1 has syntax errors. C) Both Code 1 and Code 2 have syntax errors. D) Both Code 1 and Code 2 are correct, but Code 2 is better.

A) Code 2 has syntax errors.
B) Code 1 has syntax errors.
C) Both Code 1 and Code 2 have syntax errors.
D) Both Code 1 and Code 2 are correct, but Code 2 is better.
Unlock Deck
Unlock for access to all 9 flashcards in this deck.
Unlock Deck
k this deck
7
What is x after evaluating x = (2 > 3) ? 2 : 3;

A) 5
B) 2
C) 3
D) 4
Unlock Deck
Unlock for access to all 9 flashcards in this deck.
Unlock Deck
k this deck
8
What is y after the following switch statement? <strong>What is y after the following switch statement?  </strong> A) 2 B) 1 C) 0 D) -1

A) 2
B) 1
C) 0
D) -1
Unlock Deck
Unlock for access to all 9 flashcards in this deck.
Unlock Deck
k this deck
9
Analyze the following code. <strong>Analyze the following code.  </strong> A) The value of variable x is always printed. B) The symbol x is always printed twice. C) The symbol x is always printed. D) Nothing is printed because x > 0 is false.

A) The value of variable x is always printed.
B) The symbol x is always printed twice.
C) The symbol x is always printed.
D) Nothing is printed because x > 0 is false.
Unlock Deck
Unlock for access to all 9 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 9 flashcards in this deck.