QUESTION 1 Examine the code. When will C be assigned 3? (Be careful.) if (A == B
ID: 3737424 • Letter: Q
Question
QUESTION 1
Examine the code. When will C be assigned 3? (Be careful.)
if (A == B);
C = 3;
when A is equal to B
when A is not equal to B
never
every time the program is executed
not enough information is given
QUESTION 2
Given the following segment of code, what will be the output?
int x = 5;
if (x == 2)
Write("Brown, brown, run aground. ");
else
Write("Blue, blue, sail on through. ");
Write("Green, green, nice and clean.");
Brown, brown, run aground.
Blue, blue, sail on through.
Brown, brown, run aground. Blue, blue, sail on through.
Blue, blue, sail on through. Green, green, nice and clean.
none of the above
QUESTION 3
Complete the tables below for Logical And and Or (T and F denote true and false.)
P Q P And Q
T T T
T F
F T F
F F
P Q P Or Q
T T T
T F
F T F
F F
QUESTION 4
After execution of the following code, what will be the value of inputValue?
int inputValue = 0;
if (inputValue > 5)
inputValue += 5;
else if (inputValue > 2)
inputValue += 10;
else inputValue += 15;
15
10
25
0
5
when A is equal to B
when A is not equal to B
never
every time the program is executed
not enough information is given
QUESTION 2
Given the following segment of code, what will be the output?
int x = 5;
if (x == 2)
Write("Brown, brown, run aground. ");
else
Write("Blue, blue, sail on through. ");
Write("Green, green, nice and clean.");
Brown, brown, run aground.
Blue, blue, sail on through.
Brown, brown, run aground. Blue, blue, sail on through.
Blue, blue, sail on through. Green, green, nice and clean.
none of the above
QUESTION 3
Complete the tables below for Logical And and Or (T and F denote true and false.)
P Q P And Q
T T T
T F
F T F
F F
P Q P Or Q
T T T
T F
F T F
F F
QUESTION 4
After execution of the following code, what will be the value of inputValue?
int inputValue = 0;
if (inputValue > 5)
inputValue += 5;
else if (inputValue > 2)
inputValue += 10;
else inputValue += 15;
15
10
25
0
5
Explanation / Answer
Question 1
Answer:
when A is equal to B
Question 2
Answer:
Blue, blue, sail on through. Green, green, nice and clean.
Question 3
Answer:
P Q P And Q
T T T
T F F
F T F
F F F
P Q P Or Q
T T T
T F T
F T T
F F F
Question 4
Answer:
15
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.