1. Which boolean operation is described by the following table? A B Operation Tr
ID: 3548719 • Letter: 1
Question
1. Which boolean operation is described by the following table?
A
B
Operation
True
True
True
True
False
True
False
True
True
False
False
False
a. or
b. and
c. not
d. None of the choices apply.
2. Which of the following symbols has the highest precedence?
a. ++
b. ||
c. &&
d. -
3. What is the value of the following expression? (true && (4/3 || !(6)))
a. true
b. false
c. 0
d. illegal syntax
4. Which of the following boolean expressions tests to see if x is between 2 and 15 (including 2 and 15)?
a. (x<=15 || x>=2)
b. (2 <=x || x <=15)
c. (x >=2 && x <=15)
d. (2 <= x <= 15)
5. Given the following enumerated data type definition, what is the value of SAT? enum myType{SUN,MON,TUE,WED,THUR,FRI,SAT,NumDays};
a. 7
b. 6
c. 8
d. 5
6. What is the output of the following code fragment if x is 15?
if(x < 20)
if(x <10)
cout << "less than 10 ";
else
cout << "large ";
a. less than 10
b. nothing
c. large
d. no output, syntax error
7. What is the output of the following code fragment?
int i=5;
switch(i)
{
case 0: i=15;break;
case 1: i=25;break;
case 2: i=35;break;
case 3: i=40;
default: i=0;
}
a. 15
b. 35
c. 0
d. 5
8. What is wrong with the following switch statement?
int ans;
cout <<"Type y for yes on n for no ";
cin >> ans;
switch (ans)
{
case 'y':
case 'Y': cout << "You said yes "; break;
case 'n':
case 'N': cout << "You said no "; break;
default: cout <<"invalid answer ";
}
a. ans is an int
b. break; is illegal syntax
c. nothing
d. there are no break statements on 2 cases
9. What is the output of the following code fragment?
int x=0;
{
int x=13;
cout << x <<",";
}
cout << x << endl;
a. 13,13
b. 0,13
c. 13,0
d. nothing, there is no syntax error
10. What is the value of x after the following code executes?
int x=10;
if(x++ >10)
{
x =13;
}
a. 10
b. 9
c. 13
d. 11
11. How many times is
A
B
Operation
True
True
True
True
False
True
False
True
True
False
False
False
Explanation / Answer
1a
2a
3a
4c
5b
6c
7c
8c
9c
10c
11a
12c
13c
14d
15a
16d
17d
18a
19d
20c
21b
22a
23b
24a
25a
26b
27b
28b
29a
30b
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.