Loop forever

D. counter-controlled

Question7

Why can typecasting be dangerous?

A. You might temporarily lose part of the data - such as truncating a float when typecasting to an int.

 

Question8

Comments cause the computer to print the text after the // on the screen when the program is executed.

Ответ:

True False

Question9

What does the program below output?

#include <iostream>

using namespace std;

int main() {

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

int result = 1;

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

result *= a[i];

cout << result << endl;

return 0;

}

C. 2880

 

Question11

Find the error(s) in the following and correct it (them).
Assume the following prototype is declared in class Time:

void ~Time( int );

c. ~Time( );

Question16

Print the message "This is a C++ program" with each word separated from the next by a tab:

Question17

What will this do: for(;;)?

Loop forever

Question18

Find the error in the following program segment and correct the error:

arraySize = 10; // arraySize was declared const

 

b. const int arraySize=10;

Question19

Correct mistake in the statement below:

using namespase std;

. using namespace std;

Question22

What is the output of the program?

#include<iostream>

usingnamespace std;

int main() {

char *a = "international";

cout << a+5;

return 0;

}c. national

Question24

The keyword is used in a function header to indicate that a function does not return a value or to indicate that a function contains no parameters

Question25

The default case is required in the switch selection statement

Ответ:

True False

Question26

Class members specified as _________ are accessible anywhere an object of the class is in scope

Public

Question27

Which of the following is a correct comment?

d. /* Comment */

Question29

When used, the _________ stream manipulator causes positive numbers to display with a plus sign.