Страница: (Назад) 1 2 3 4 5 6 7 8 9 10 (Далее)
Question11
Баллов: 1
What is the output of the program?
#include <iostream>
using namespace std;
int main() {
int a = 17;
if (a<10) {
cout << "A";
}
if (a%17==0) {
cout << "B";
} else {
cout << "C";
}
cout << endl;
return 0;
}
Выберите один ответ.
| a. AC | |
| b. C | |
| c. A | |
| + | d. B | |
| e. AB |
Question12
Баллов: 1
Which of the following classes handlers file input?
Выберите один ответ.
| a. iomanip | |
| b. instream | |
| c. ofstream | |
| + | d. ifstream | |
| e. inputfile |
Question13
Баллов: 1
How many times is Hello World printed by this program?
#include <iostream>
struct BS
{
BS()
{
std::cout << "Hello World" << std::endl;
}
unsigned int color;
};
struct mid1: virtual public BS { };
struct mid2: virtual public BS { };
struct mid3: public BS { };
struct mid4: public BS { };
struct DR: public mid1, public mid2,
public mid3, public mid4 { };
int main(int argc, char** argv)
{
DR d;
return 0;
}
Выберите один ответ.
| a. 1 | |
| b. 3 | |
| + | c. 2 | |
| d. code is ill-formed |
Question14
Баллов: 1
Which of the following adds one string to the end of another?
Выберите один ответ.
| a. ++; | |
| + | b. stradd(); | |
| c. strcat(); | |
| d. append(); | |
| e. stringadd(); |
Question15
Баллов: 1
__________ must be used to initialize constant members of a class
Выберите один ответ.
| + | a. Member initializers | |
| b. Classes | |
| c. Initializes |
Question16
Баллов: 1
Write a single statement that performs the specified task. Assume that floating-point variables number1 and number2 have been declared and that number1 has been initialized to 7.3. Assume that variable ptr is of type char *. Assume that arrays s1 and s2 are each 100-element char arrays that are initialized with string literals. Print the value of the object pointed to by fPtr.
Выберите один ответ.
| a. cout << "The value of &fPtr is " << &fPtr << endl; | |
| + | b. cout << "The value of *fPtr is " << *fPtr << endl; | |
| c. cout << "The value of fPtr is " << fPtr << endl; |
Question17
Баллов: 1
What is the output of the program?
#include <iostream>
using namespace std;
int main() {
int a=10, b=3;
int * c = &a;
*c = 5;
cout << a << " " << b;
return 0;
}
Выберите один ответ.
| a. 3 5 | |
| b. 5 3 | |
| c. 5 5 | |
| + | d. 10 3 | |
| e. None of the given choices. |
Question18
Баллов: 1
Give the function header for the following function. Function hypotenuse that takes two double-precision, floating-point arguments, side1 and side2, and returns a double-precision, floating-point result.
Выберите один ответ.
| + | a. double hypotenuse(double side1, double side2) | |
| b. float hypotenuse(float side1, float side2) | |
| c. double float hypotenuse(double float side1, double float side2) | |
| d. float hypotenuse(double side1, double side2) | |
| e. not sure |
Question19
Баллов: 1
What does the program below output?
#include<iostream>
Using namespace std;
int main() {
int a[6] = {3,5,1,6,8,2};
int idx = 0;
for (int i=0; i<6; i++)
if (a[idx]<a[i])
idx = i;
cout << a[idx] << endl;
return 0;
}
Выберите один ответ.
| a. 1440 | |
| b. None of the given answers. | |
| c. 25 | |
| d. 8 | |
| + | e. 1 |
Question20
Баллов: 1
What is the result of the following code?
x=0;
switch(x)
{
case 1: cout<<"One";
case 0: cout<<"Zero";
case 2: cout<<"Hello World";
}
Выберите один ответ.
| a. Hello World | |
| b. ZeroHello World | |
| c. One | |
| d. OneZero | |
| + | e. Zero |






