1 . Which of the following are legal int literals? Choose all that are correct.
ID: 3559512 • Letter: 1
Question
1. Which of the following are legal int literals? Choose all that are correct.
A. 22
B. 1.5
C. -1
D. 10.0
E. "42"
F. 42
2. What is the value of this expression?
2 + 19 % 5 - (11 * (5 / 2))
A. -23 B. -18 C. -17. D. none of the above
3. What is the value of this expression?
" 2 + 2" + 4 * 5 + 3
A. 27 B. "2+2203" C. 64 D. "27"
4. What are the values of the variables after this code executes?
int a = 5;
int b = 10;
int c = b;
a = a + 1;
b = b - 1;
c = c + a;
A. a = 5, b = 10, c = 10
B. a = 6, b = 9, c = 15
C. a = 6, b = 10, c = 16
D. a = 6, b = 9, c = 16
5.
Assume that you have a variable called count that will take on the values 1, 2, 3, 4, and so on. You are going to formulate expressions in terms of count that will yield different sequences. The first row is filled in for you as an example. Fill in the solution boxes below, indicating an expression that will generate each sequence. Your answers should be in the form 'coefficient * count + constant' in that order, or the solution checking may not be accurate.
4, 19, 34, 49, 64, 79, ...
A. 15 * count + 4
B. 15 * count - 11
C. 4 * count - 1
D. count + 3
count value SequenceExplanation / Answer
1.)
A.22
C. -1
F. 42
2.)
First executes bracket
So (5/2)=2
11*(5/2)=11*2 = 22
Then 19%5 =4
So 2 + 4 -22 = -16
So D.) none of the above
3.)
" 2 + 2" + 4 * 5 + 3 = "2 + 2203"
So B. "2+2203"
4.)
a=6
b=9
c=10+6=16
So D. a = 6, b = 9, c = 16
5.)
4= 15*1-11
SO B. 15 * count - 11
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.