Question36
Write single C++ statements that output integer variable power with cout and <<
b. cout << power << endl;
Question37
Any source-code file that contains int main() can be used to execute a program.
Ответ:
True False
Question39
In one statement, assign the sum of the current value of x and y to z and postincrement the value of x:
d. z = x++ + y;
Question40
The symbol for the stream insertion operator is ____________.
<<
Question41
All programs can be written in terms of three types of control structures:
Question42
Which of the following gives the memory address of integer variable a?
&a;
Question43
All arguments to function calls in C++ are passed by value
Ответ:
True False
Question44
Find the error in the following program segment. Assume the following declarations and statements:
int *zPtr; // zPtr will reference array z
int *aPtr = 0;
void *sPtr = 0;
int number;
int z[ 5 ] = { 1, 2, 3, 4, 5 };
++zPtr;
a.
zPtr = z;
++zPtr;
Question46
Is the following piece of code valid?
#include <iostream>
using namespace std;
int main(){
int *steve;
steve = &steve;
return 0;
}
Ответ:
True False
Question47
What is the output of the program?
#include<iostream>
usingnamespace std;
int main() {
char str[] = "Hello, World!!!";
cout << strlen(str);
return 0;
}
Question49
Баллов: 1
Identify and correct the errors in the following statement (assume that the statement using std::cout; is used):
if (c < 7);
cout << "c is less than 7\n";
if (c < 7) cout << "c is less than 7\n";
Question50
How many times is a do while loop guaranteed to loop?
Question51
Which one is correct?
|
|
int *a; a new int[20];
Question53
What is the output of the program?
#include <iostream>
using namespace std;
int main() {
for (int a=10; a<91; a*=3)
cout << a << " ";
cout << endl;
return 0;
}
10 30 90
Question54
$$1 What is the output of the program below?
#include<iostream>
usingnamespace std;
int main() {
float a[7] = {1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7};
cout << a[1] << endl;
return 0;
}
. 2.2
Question55
Determine the value, true or false, of each of the following Boolean expressions, assuming that the value of the variable count is 0 and the value of the variable limit is 10.
(count == 0) && (limit < 20)
. true
Question56
A variable that is known only within the function in which it is defined is called a ________.