Home Random Page


CATEGORIES:

BiologyChemistryConstructionCultureEcologyEconomyElectronicsFinanceGeographyHistoryInformaticsLawMathematicsMechanicsMedicineOtherPedagogyPhilosophyPhysicsPolicyPsychologySociologySportTourism






A. reads a line of string from cin into mystring

C. Equals to operator mistake

d. Variable x should not be inside quotation

 

Question 2:

Looping in a program means

a. Jumping to the specified branch of program

B. Repeat the specified lines of code

c. Both of above

d. None of above



 

Question 3:

The difference between while structure and do structure for looping is

a. In while statement the condition is tested at the end of first iteration

b. In do structure the condition is tested at the beginning of first iteration

c. The do structure decides whether to start the loop code or not whereas while statement decides whether to repeat the code or not

D. In while structure condition is tested before executing statements inside loop whereas in do structure condition is tested before repeating the statements inside loop

 

Question 4:

Which of the following is not a looping statement in C?

a. while

B. until

c. do

d. for

Question 5:

Which of the following is not a jump statement in C++?

a. break

b. goto

c. exit

D. switch

 

Question 6:

Which of the following is selection statement in C++?

a. break

b. goto

c. exit

D. switch

 

Question 7:

The continue statement

a. resumes the program if it is hanged

b. resumes the program if it was break was applied

C. skips the rest of the loop in current iteration

d. all of above

 

Question 8:

Consider the following two pieces of codes and choose the best answer

CODE 1:

switch (x) {

case 1:

cout <<”x is 1”;

break;

case 2:

cout <<”x is 2”;

break;

default:

cout <<”value of x unknown”;

}

 

CODE 2

If (x==1){

Cout <<”x is 1”;

}

Else if (x==2){

Cout << “x is 2”;

}

Else{

Cout <<”value of x unknown”;

}

 

A. Both of the above code fragments have the same behaviour

b. Both of the above code fragments produce different effects

c. The first code produces more results than second

d. The second code produces more results than first.

 

Question 9:

Observe the following block of code and determine what happens when x=2?

switch (x){

case 1:

case 2:

case 3:

cout<< "x is 3, so jumping to third branch";

goto thirdBranch;

default:

cout<<"x is not within the range, so need to say Thank You!";

}

 

a. Program jumps to the end of switch statement since there is nothing to do for x=2

b. The code inside default will run since there is no task for x=2, so, default task is run

C. Will display x is 3, so jumping to third branch and jumps to thirdBranch.

d. None of above

 

Question 10

Which of the following is false for switch statement in C++?

a. It uses labels instead of blocks

b. we need to put break statement at the end of the group of statement of a condition

c. we can put range for case such as case 1..3

d. None of above



Question 1:

 

cin extraction stops execution as soon as it finds any blank space character

 

A. true

b. false

 

Question 2:

 

Observe the following statements and decide what do they do.

 

string mystring;

 

getline(cin, mystring);

 

a. reads a line of string from cin into mystring

b. reads a line of string from mystring into cin

c. cin can’t be used this way

d. none of above

 

Question 3:

 

Regarding stringstream identify the invalid statement

 

a. stringstream is defined in the header file <sstream>

b. It allows string based objects treated as stream

c. It is especially useful to convert strings to numerical values and vice versa.

D. None of above

 

Question 4:

 

Which of the header file must be included to use stringstream?

 

a. <iostream>

b. <string>

c. <sstring>

d. <sstream>

 

Question 5:

 

Which of the following header file does not exist?

 

a. <iostream>

b. <string>

c. <sstring>

d. <sstream>

 

Question 6:

 

If you use same variable for two getline statements

 

a. Both the inputs are stored in that variable


Date: 2016-03-03; view: 829


<== previous page | next page ==>
Invoking the Interpreter | B. The location of variable in memory is passed to the function so that it can use the same memory area for its processing
doclecture.net - lectures - 2014-2025 year. Copyright infringement or personal data (0.007 sec.)