BÀI THI TRẮC NGHIỆMDan Quayle once said, "Who’s responsible for the riots?. 20.Given the following function prototype: void fooint arr[]; Which statement correctly passes the array to th
Trang 1BÀI THI TRẮC NGHIỆM
Dan Quayle once said, "Who’s responsible for the riots? The rioters." A
cout << "Dan Quayle once said, "Who\’s responsible for the riots? The rioters " ";
Trang 3C
D
5.
Trang 6variable named num?
A
cout << num;
Trang 7the top of the program?
three integers passed in?
A
Trang 8C
D
13.
Trang 93 2 2 3 B
3 2 1 1 C
3 2 1 2 D
3 2 1 3
14.
Trang 132 3 10 4 D
10 4 2 3
18.
A
10 4 10 4 B
2 3 10 4 C
10 4 10 3
Trang 14X=3 Y=3 C
X=2 Y=3 D
X=2 Y=2
Trang 1520.Given the following function prototype:
void foo(int arr[]);
Which statement correctly passes the array to the function?
int arr[10]; foo(arr[10]);
Trang 16two-dimensional array of type double?
Trang 183 1 1 B
3 2 1 C
1 2 3 D
1 2 1
26.
Trang 19int main(){
Foo f;
f->printMessage(); return 0;
Trang 20There are no public accessor methods.
members of the structure?
struct Point {
int x;
int y;
};
Trang 2230.Under the principle of information hiding, which class definition best encapsulated the variable named "x"?
A
B
C
Trang 2331.
Trang 25val1=2 val2=1 val1=2 val2=2 val1=2 val2=2 B
val1=0 val2=1 val1=0 val2=2 val1=0 val2=2
Trang 28In default constructor Printing
35.
Trang 31upon declaring the variable of type Foo?
Trang 32Foo x = {1, {2}}; D
Foo x = {1, 2};
39.
A
B
Trang 33C
D
40.
Trang 34There should be no semicolon after the right curly brace in the
definition of the Foo class
int operator %(const Number &x, const Number &y);
Trang 37Dan Quayle once said, "Who’s responsible for the riots? The rioters." A
cout << "Dan Quayle once said, "Who\’s responsible for the riots? The rioters " ";
Trang 42Before foo, X=1 In foo, X=2, After foo, X=2
Trang 43the top of the program?
Trang 44three integers passed in?
A
Trang 45C
D
16.
Trang 46X=3 Y=2 B
X=3 Y=3 C
X=2 Y=2 D
X=2 Y=3
17.
Trang 4710 4 10 3 B
10 4 2 3 C
10 4 10 4 D
2 3 10 4
18.
Trang 48void foo(int &);
Which of the following calls would give an error message?
Trang 49B
C
D
Trang 50A
5 4 3 2 1 B
5 2 3 4 1 C
1 2 3 4 5 D
5 2 3 4 5
21.
Trang 51A
B
Trang 52C
D
all elements in the array?
Trang 531 2 1 B
1 2 3 C
3 1 1 D
3 2 1
24.
Trang 55int arr[10];
D
int[11] arr;
encapsulated the variable named "x"?
A
B
Trang 56D
27.
Trang 60"ID" cannot be all uppercase
A
We can specify member variables to be public or private within a class, but not within a struct
B
A class allows member functions in addition to member variables while
a struct does not
Trang 62Money m1(10,50), m2(10,50);
A
B
Trang 63In default constructor Printing
Trang 64In default constructor
In default constructor Printing
Printing
34.
Trang 65val1=2 val2=1 val1=2 val2=2 val1=3 val2=2 B
val1=2 val2=1 val1=2 val2=2 val1=2 val2=2
Trang 66val1=0 val2=1 val1=0 val2=2 val1=0 val2=2 D
val1=1 val2=1 val1=2 val2=2 val1=3 val2=2
35.
Trang 692 dollars and 50 cents 4 dollars and cents
upon declaring the variable of type Foo?
struct Stuff {
Trang 70Foo x = {1, 2}; C
Foo x = {1, {2}}; D
Foo x = {1, {2}};
39.
Trang 71A
B
C
Trang 73There should be no semicolon after the right curly brace in the
definition of the Foo class
D
The constructor must have a return type of void in the implementation
41.
Trang 75A 6 7 B 6 8
Trang 76C 7 8 D 7 9
43.
Trang 77A 8 B 10 C 15 D 30
Trang 78BÀI THI TRẮC NGHIỆM
Trang 79C
D
3.
Trang 827.How can we input a value from the keyboard and store it in the variable named num?
Dan Quayle once said, "Who’s responsible for the riots? The rioters."
Trang 840 1 2 3 3 B
0 1 2 3 4 1 C
0 1 2 3 4 D
0 1 2 3 1
12.
Trang 8910 4 10 4
void foo(int &);
Which of the following calls would give an error message? A
B
C
D
18.
Trang 90X=3 Y=2 B
X=3 Y=3 C
X=2 Y=3 D
X=2 Y=2
19.
Trang 92void foo(int arr[]);
Which statement correctly passes the array to the function? A
int arr[10]; foo(arr[0]);
Trang 941 2 3 4 5 D
5 2 3 4 1
24.
A
Trang 95B
C
D
25.
Trang 97There are no private variables
There is a semicolon missing after the right curly brace
members of the structure?
struct Point {
int x;
int y;
};
Trang 98Point p; p:x = 10; p:y = 20; B
Point p; p.x = 10; p.y = 20; C
Point p; p::x = 10; p::y = 20; D
Point p; p->x = 10; p->y = 20;
29.
Trang 99encapsulated the variable named "x"?
A
Trang 100C
D
Trang 103Printing
Trang 104In default constructor Printing
In default constructor Printing
C
In default constructor
In default constructor Printing
Trang 105val1=1 val2=1 val1=2 val2=2 val1=3 val2=2 B
val1=2 val2=1 val1=2 val2=2 val1=2 val2=2
Trang 106val1=0 val2=1 val1=0 val2=2 val1=0 val2=2 D
val1=2 val2=1 val1=2 val2=2 val1=3 val2=2
35.
Trang 1085 5 B
10 5 C
10 10
Trang 109upon declaring the variable of type Foo?
Trang 112A 6 7 B 6 8
Trang 113C 7 8 D 7 9
42.