- •Int main(int argc, char** argv)
- •Int main() {
- •Int main(int argc, char** argv)
- •Int main(int argc, char** argv)
- •Int main() {
- •Int main()
- •Int main() {
- •Int main()
- •Int main() {
- •Int main() {
- •Int main() {
- •Int main(){
- •Int main() {
- •Int main(int argc, char** argv)
- •Int main() {
- •Int main() {
- •Int main(int argc, char** argv)
Int main(int argc, char** argv)
{
Foo f;
f.x = 11;
std::cout << (0?3:f) << std::endl;
return 0;
}
Выберите один ответ. a. 11
b. 21
c. 0
d. undefined
e. 3
Question 27
Баллов: 1
When does the code block following while(x<100) execute?
Выберите один ответ. a. When x is less than one hundred
b. Infinite loop
c. When x is greater than one hundred
d. When x is equal to one hundred
e. While it wishes
Question 28
Баллов: 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. Declare the variable fPtr to be a pointer to an object of type double.
Выберите один ответ. a. double *&fPtr;
b. double *fPtr;
c. double &fPtr;
Question 29
Баллов: 1
The process of placing the elements of an array in order is called ________ the array
Выберите один ответ. a. sorting
b. replacing
c. relocation
d. searching
Question 30
Баллов: 1
Which header file do you need to include to use typecasting?
Выберите один ответ. a. fstream.h
b. ctype.h
c. math.h
d. iostream.h
e. None
Страница: (Назад) 1 2 3 4 5 6 7 8 9 10 (Далее)
Preparation for Final Exam MCQ Quiz BIG - Попытка 1
Страница: (Назад) 1 2 3 4 5 6 7 8 9 10 (Далее)
Question 31
Баллов: 1
Which properly declares a variable of struct foo?
Выберите один ответ. a. struct foo;
b. int foo;
c. foo var;
d. var foo;
e. foo;
Question 32
Баллов: 1
Which of the following accesses a variable in structure b?
Выберите один ответ. a. b-var;
b. b->var;
c. struct b;
d. b.var;
e. b>var;
Question 33
Баллов: 1
The ________ enables access to a global variable with the same name as a variable in the current scope
Выберите один ответ. a. var
b. local
c. register
d. unary scope resolution operator ( :: )
e. name
Question 34
Баллов: 1
What is the output of the program?
#include<iostream>
usingnamespace std;
int main() {
int *x = newint[10];
for (int i=0; i<10; i++)
x[i] = i+5;
cout << *(x+1) << endl;
return 0;
}
Выберите один ответ. a. 6
b. 002BF7E0
c. 7
d. 1
e. 5
Question 35
Баллов: 1
Correct mistake in the program below:
int main {
cout << “anyonghaseyo” << endl;
return 0;
}
Выберите один ответ. a.
int main {
cout << “anyonghaseyo” << endl;
}
b.
int main() {
cout << “anyonghaseyo” << endl;
return 0;
}
c.
void main() {
cout << “anyonghaseyo” << endl;
return 0;
}
d.
int main() {
cout << “anyonghaseyo” << endl;
}
e.
int main {
cout << “anyonghaseyo” << endl;
return 0;
}
Question 36
Баллов: 1
A program must call function close explicitly to close a file associated with an ifstream, ofstream or fstream object.
Ответ:
True
False
Question 37
Баллов: 1
What will be output ?
#include <iostream>
using namespace std;
void f ();
int main(){
for (int i = 0; i< 3; i++)
f ();
return 0;
}
void f (){
int num = 99;
cout << num << " ";
num++;
}
Выберите один ответ. a. 98 99 100
b. 99 99 99
c. 99 100 101
d. 98 99 100
Question 38
Баллов: 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";
Выберите один ответ. a. if ( c < 7 ); { cout << "c is less than 7\n";}
b. if ( c < 7 ) { cout << "c is less than 7\n"}
c. if ( c < 7 ) cout << "c is less than 7\n"
d. if ( c < 7 ) cout << "c is less than 7\n";
e. if ( c < 7 ) then cout << "c is less than 7\n";
Question 39
Баллов: 1
Which of the following is the boolean operator for logical-and?
Выберите один ответ. a. |&
b. &&
c. |
d. &
e. AND
Question 40
Баллов: 1
Which of the following gives the memory address of the first element in array foo, an array with 100 elements?
Выберите один ответ. a. foo[1];
b. &foo;
c. foo();
d. foo;
e. foo[0];
Страница: (Назад) 1 2 3 4 5 6 7 8 9 10 (Далее)
Preparation for Final Exam MCQ Quiz BIG - Попытка 1
Страница: (Назад) 1 2 3 4 5 6 7 8 9 10 (Далее)
Question 41
Баллов: 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. Append the first 10 characters from the string in s2 to the string in s1.
Выберите один ответ. a. catstrn( s1, s2, 10 );
b. string_cat( s1, s2, 10 );
c. strncat( s1, s2, 10 );
Question 42
Баллов: 1
Input/output in C++ occurs as ____________ of bytes
Выберите один ответ. a. arrays
b. strings
c. streams
Question 43
Баллов: 1
A pointer that is declared to be of type void * can be dereferenced
Ответ:
True
False
Question 44
Баллов: 1
Find the error in the following program segment and correct the error:
Assume that int b[ 10 ] = { 0 };
for ( int i = 0; <= 10; i++ )
b[ i ] = 1;
Выберите один ответ. a. for ( int i = 0; <=10; i++ )
b[ i ] = 1;
b. for ( int i = 0; < 10; i++ );
b[ i ] = 1;
c. for ( int i = 0; <= 9; i++ )
b[ i ] = 1;
Question 45
Баллов: 1
The selection statement is used to execute one action when a condition is true or a different action when that condition is false.
Question 46
Баллов: 1
Use a for statement to print the elements of array numbers using pointer/subscript notation with pointer nPtr
Выберите один ответ. a. cout << fixed << showpoint << setprecision( 1 );
for ( int m = 0; m < SIZE; m++ )
cout << nPtr << ' ';
b. cout << fixed << showpoint << setprecision( 1 );
for ( int m = 0; m < SIZE; m++ )
cout << *nPtr[ m ] << ' ';
c. cout << fixed << showpoint << setprecision( 1 );
for ( int m = 0; m < SIZE; m++ )
cout << nPtr[ m ] << ' ';
Question 47
Баллов: 1
An object's non-static member functions have access to a "self pointer" to the object called the __________ pointer.
Выберите один ответ. a. local
b. this
c. proper
d. friend
Question 48
Баллов: 1
If I do not want to use return in my function myFunc() what I have to speciafy as return type?
Выберите один ответ. a. void
b. whitespace
c. null
d. NULL
Question 49
Баллов: 1
Which of the following gives the memory address of integer variable a?
Выберите один ответ. a. ^a;
b. *a;
c. &a;
d. a;
e. address(a);
Question 50
Баллов: 1
Which of the following is not a keyword?
Выберите один ответ. a. union
b. mutable
c. typedef
d. volatile
e. cast
Страница: (Назад) 1 2 3 4 5 6 7 8 9 10 (Далее)
Preparation for Final Exam MCQ Quiz BIG - Попытка 1
Страница: (Назад) 1 2 3 4 5 6 7 8 9 10 (Далее)
Question 51
Баллов: 1
Add variable x to variable sum and assign the result to variable sum
Ответ:
Question 52
Баллов: 1
The ________ qualifier is used to declare read-only variables
Выберите один ответ. a. read-only
b. static
c. unchangeable
d. const
e. read
Question 53
Баллов: 1
Output the string "Enter your name: "
Выберите один ответ. a. cout << "Enter your name: ";
b. cin << "Enter your name: ";
c. cout >> "Enter your name: ";
Question 54
Баллов: 1
Which of the following is a limit on inline functions?
Выберите один ответ. a. Inline functions cannot be used more than three times in a one code file.
b. Inline functions must be less than ten lines.
c. Inline functions must return a value.
d. The compiler may choose to ignore an inline directive.
e. Inline functions cannot return a value
Question 55
Баллов: 1
By default, memory addresses are displayed as long integers
Ответ:
True
False
Question 56
Баллов: 1
A __________ should be used to declare the size of an array, because it makes the program more scalable
Выберите один ответ. a. constant variable
b. number
c. constant
d. static variable
Question 57
Баллов: 1
The escape sequence \n, when output with cout and the stream insertion operator, causes the cursor to position to the beginning of the next line on the screen.
Ответ:
True
False
Question 58
Баллов: 1
What does the inline keyword do?
Выберите один ответ. a. Allows one-line function declarations
b. Indicates a function declaration
c. Causes all function calls to be replaced by the code from the function
d. Indicates a short function.
e. Tells the compiler to use the function only within the same source code file
Question 59
Баллов: 1
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.
(limit > 0) && ((limit/count) > 7)
Выберите один ответ. a. false
b. None of the given choices.
c. Both true and false
d. true
e. Error
Question 60
Баллов: 1
Identify and correct the errors in the following code:
while ( c <= 5 )
{
product *= c;
c++;
Выберите один ответ. a. while ( c <= 5 )
{
product *= c;
c++;
}
b. while ( c <= 5 )
{
product *= c;
c++
}
c. while ( c <= 5 );
{
product *= c;
c++;
Страница: (Назад) 1 2 3 4 5 6 7 8 9 10 (Далее)
Preparation for Final Exam MCQ Quiz BIG - Попытка 1
Страница: (Назад) 1 2 3 4 5 6 7 8 9 10 (Далее)
Question 61
Баллов: 1
$$1 Select the best answer to the output of the program:
#include<iostream>
usingnamespace std;
