Cerr or clog

Question 64

Declare the array to be an integer array and to have 3 rows and 3 columns. Assume that the constant variable arraySize has been defined to be 3:

b. int table[ arraySize ][ arraySize];

Question 66

Class members are accessed via the ________ operator in conjunction with the name of an object (or reference to an object) of the class or via the ___________ operator in conjunction with a pointer to an object of the class

a. dot (.), arrow (->)

Question 67

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 };

// assign the value pointed to by sPtr to number
number = *sPtr;

a. number = *sPtr;

Question 68

What is the output of the program?

#include <iostream>
using namespace std;
int main() {
int n = 1;
while (n<5)
cout << n++;
return 0;
}

Question 69

What punctuation ends most lines of C++ code?

a.;

Question 71

Declare an array of type double called numbers with 10 elements, and initialize the elements to the values 0.0, 1.1, 2.2,..., 9.9.
Assume that the symbolic constant SIZE has been defined as 10.

b. double numbers[ SIZE ] = { 0.0, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9 };  


Question 72

Input with the stream extraction operator >> always skips leading white-space characters in the input stream, by default

Ответ:

True False

Question 74

Write one or more statements that perform the following task for and array called “fractions”. Print array elements 6 and 9 with two digits of precision to the right of the decimal point.

d. cout << fixed << setprecision (2); cout << fractions[ 6 ] < < ' ' fractions[ 9 ] << endl;  


Question 75

The modulus operator (%) can be used only with integer operands.

Ответ:

True False

Question 76

$$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[3] << endl;

return 0;

}

E. 4.4

Question 77

What (if anything) prints when the following statement is performed?Assume the following variable declarations:

char s1[ 50 ] = "jack";
char s2[ 50 ] = "jill";
char s3[ 50 ] = "\0";

cout << strlen(s3) << endl;

Question 78

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. Assign the address of variable number1 to pointer variable fPtr.

b. fPtr = &number1;

What does the program below output?

#include<iostream>

usingnamespace std;

int main() {

int a[6] = {3,5,1,6,8,2};

int result = 0;

for (int i=0; i<6; i++)

result *= a[i];

cout << result << endl;

return 0;

} 0

Question 80

What value does size print out?
#include <iostream>
const int SIZE = 5;
struct tester
{
int array[SIZE];
enum
{
SIZE = 3
};
void size()
{
std::cout << sizeof(array) / sizeof(int);
}
};

int main(int argc, char** argv)
{
tester t;
t.size();
return 0;
}

b. 5

Question 82

What will be at output?

#include <iostream>

using namespace std;

int main() {

int a = 5;
a = *&*&*&*&a;
cout << a << "\n";

return 0;

d. 5

Question 83

A constant object must be __________; it cannot be modified after it is created

c. initialized


Question 84

What is the output of the program?
#include <iostream>
using namespace std;
int main() {
int a = 10;
if (a<10) {
cout << "A";
}
if (a%10==0) {
cout << "B";
} else {
cout << "C";
}
cout << endl;
return 0;
}

B

Question 85

Correct the mistakes

float a, b, c;

cin << a,b,c;

a. cin >> a >> b >> c;

Repeating a set of instructions a specific number of times is _____ called repetition.

Counter-controlled or definite

Question 87

Print the message "This is a C++ program" on one line:

e. std::cout << "This is a C++ program\n";

Question 88

What is the output of the program?

#include <iostream>
using namespace std;
int main() {
for (int a=10; a<91; a*=3)
cout << a-1 << " ";
cout << endl;
return 0;
}

B. 9 29 89

Question 90

Which of the following is true?

d. 1

Question 91

What will be output?

#include <iostream>
using namespace std;

int main() {

int x = 19;

if (x == 19){
int y = 20;
cout << x+y << endl;
}

y = 100;

return 0;
}

d. Compile-time error  

Question 92

When it is not known in advance how many times a set of statements will be repeated, a value can be used to terminate the repetition.

Question 93

What can be at output?

#include <iostream>

using namespace std;

int main(){

int a = 5;
a = *&*&*&*&a;
cout << *&*&*&*&a << " ";
cout << &*&*&*&a << " ";

return 0;
} d. 5 0x22ff74

Question 94

Input/output in C++ occurs as ____________ of bytes


Понравилась статья? Добавь ее в закладку (CTRL+D) и не забудь поделиться с друзьями:  



double arrow
Сейчас читают про: