In: Computer Science
PLEASE ANSWER AS MANY AS YOU CAN, BUT TRY TO FINISH THEM ALL
In a switch statement, the expression following the word case can be a variable
True
False
4. Assume C is a char variable, the following statement will read a space character into c when the user enters a space character and presses the enter/ return key.
cin >> c;
True
False
5. Which statement will read an entire line of input into the following string object?
string address;
getline (cin, address) ;
cin >> address;
None of these
cin
cin. get (address) ;
6. Assume a and b are two bool variables, which is an equivalent of the following expression?
!(a || b)
!a||b
None of these
!a||!b
!a&&!b
7. This manipulator is used to establish a field width for the value immediately following it:
field_width
iomanip
setw
set_field
None of these
8. Given the following code segment, what is output after
“result =” ?
intx=1, y=0, z=1;
y=y+z;
x=x+y;
cout << “result= ”
<<( y<x? y : x)
<< endl;
3
None of these
1
0
2
9. What will the following segment of code output?
score =40;
if (score >95)
cout<< “Congratulations!\n”;
cout << “Thats a high score!\n”;
cout << “This is a test question!” << endl;
That’s a high score!
This is a test question!
NONE OF THESE
Congratulations!
That’s a high score!
Congratulations!
That’s a high score!
This is a test question!
I WILL UPVOTE, PLEASE HELP
Q:-3 In a switch statement, the expression following the word case can be a variable.
Answer:-----
True
4. Assume C is a char variable, the following statement will read a space character into c when the user enters a space character and presses the enter/ return key.
cin >> c;
Answer:-----
True
5. Which statement will read an entire line of input into the following string object?
string address;
getline (cin, address) ;
cin >> address;
None of these
cin
cin. get (address) ;
Answer:-----
getline (cin, address) ;
6. Assume a and b are two bool variables, which is an equivalent of
the following expression?
!(a || b)
!a||b
None of these
!a||!b
!a&&!b
Answer:------
!a&&!b
7. This manipulator is used to establish a field width for the value immediately following it:
field_width
iomanip
setw
set_field
None of these
Answer:------
setw
8. Given the following code segment, what is output after “result =” ?
intx=1, y=0, z=1;
y=y+z;
x=x+y;
cout << “result= ”
<<( y<x? y : x)
<< endl;
Answer:------
1
9. What will the following segment of code output?
score =40;
if (score >95)
cout<< “Congratulations!\n”;
cout << “Thats a high score!\n”;
cout << “This is a test question!” << endl;
That’s a high score!
This is a test question!
NONE OF THESE
Congratulations!
That’s a high score!
Congratulations!
That’s a high score!
This is a test question!
Answer:---------
That’s a high score!
This is a test question!