CBSE - MCQ Question Banks (के. मा. शि. बो . -प्रश्नमाला )

PreviousNext

Q. 192801 i) What are the two ways by which variables can be initialized ? 
     ii)State the two types of type conversions
A. process of converting one predefined type into another.
B. explicit conversion.
C. coversion of all operands upto the largest operand.
D. implicit conversion.

Right Answer is:

SOLUTION

 i) Uninitialized and  Initialized. 
 ii) Implicit and Explicit.


Q. 192802 What kind of difficulty can arise with postfix operator ?
A. process of converting one predefined type into another.
B. explicit conversion.
C. coversion of all operands upto the largest operand.
D. implicit conversion.

Right Answer is:

SOLUTION

The postfix increment/decrement operators need a little more understanding. The compiler  makes a temporary copy of x, increments x, and then evaluates the temporary copy of x.


Q. 192803 What will be the value assigned to  integer variable x  as under:-
Z=a*x*x+b*x+c  where a,b,c and x are 2,4,5 and 3 respectively?
A. process of converting one predefined type into another.
B. explicit conversion.
C. coversion of all operands upto the largest operand.
D. implicit conversion.

Right Answer is:

SOLUTION

Z       =a*x*x+b*x+c        
        
=2*3*3+4*3+5 
  
        
=6*3+12+5 
         =18+12+3 
         = 35


Q. 192804 What is the value  of i and j in the two cases given below?
a) i=7
     j= i ++    
b) i=8  
     j= --i
A. process of converting one predefined type into another.
B. explicit conversion.
C. coversion of all operands upto the largest operand.
D. implicit conversion.

Right Answer is:

SOLUTION

a) In i=8 and j=7 statement j++ will assign the current value of i(7).Then it will  increase the value of i from 7 to 8 
b) In  i=7 and j=7  (Statement will first decrease the value of i from 8 to 7. Then only will j  be assigned the new value of i ,i.e., 7. j will therefore be assigned the value of 7.


Q. 192805 Elaborate the meaning of  Mathmetical, Relational and Logical expressions ?
A. process of converting one predefined type into another.
B. explicit conversion.
C. coversion of all operands upto the largest operand.
D. implicit conversion.

Right Answer is:

SOLUTION

i) An example of a Mathematical expression is x2+3x-2.
ii) Relational expression results in either true or false. Eg. X-3>0  

iii) Logical expression returns the truth of a complex relational expression.Eg:- (x>6)OR (x<6)


Q. 192806 What will be the value returned by the following if value assigned to  integer variable k is 3 ?
a) k<2 
b) k= =2 
c) k<=3
A. process of converting one predefined type into another.
B. explicit conversion.
C. coversion of all operands upto the largest operand.
D. implicit conversion.

Right Answer is:

SOLUTION

Followings are the solutions:-
a) 0 
b) 0
c) 1


Q. 192807 Give values to the  following expression--
i)   a>=b&&(a+b)>a 
ii)    a=b
A. process of converting one predefined type into another.
B. explicit conversion.
C. coversion of all operands upto the largest operand.
D. implicit conversion.

Right Answer is:

SOLUTION

i)   a>=b&&(a+b)>a 
   Ans)      a=6,b=1 
   
ii)    a=b|| b=a 
   Ans)   a=9 b=9

 


Q. 192808 Why are header files enclosed in < > ?
A. process of converting one predefined type into another.
B. explicit conversion.
C. coversion of all operands upto the largest operand.
D. implicit conversion.

Right Answer is:

SOLUTION

Header files are enclosed within < > as it signifies that these header files are a part of C++ standard library and the compiler searches for them in the standard library path.


Q. 192809 Explain Increment and Decrement with their prefix and postfix forms ?
A. process of converting one predefined type into another.
B. explicit conversion.
C. coversion of all operands upto the largest operand.
D. implicit conversion.

Right Answer is:

SOLUTION

The following chart explain the differences along with the explanations

Operator

Symbol

Form

Explanation

Prefix increment

++

++x

Increment x, then evaluate x

Prefix decrement

--

--x

Decrement x, then evaluate x

Postfix increment

++

x++

Evaluate x, then increment x

Postfix decrement

--

x--

Evaluate x, then decrement x


Q. 192810 Briefly answer the following ---   
  i) Why is C++ not named ++C ?
 ii) How can a+=a+10 and a=a+10  be used in C++ 
iii) What are arguments ? 
iv) Which type of arithmetic is more exact between floating and integer ? 
v)  What is the order of evaluation of logical operators ?
A. process of converting one predefined type into another.
B. explicit conversion.
C. coversion of all operands upto the largest operand.
D. implicit conversion.

Right Answer is:

SOLUTION

 i) The name is more appropriate as C++ as C++ is built from C and it is the superset of C language. 
 ii) shorthand 
 iii) Arguments are values required by a function to work upon.
 iv) Floating point arithmetic is not exact as integer arithmetic.            
 v) order of evaluation of logical operators is NOT, AND i.e. &&, OR i.e. ||


Q. 192811 Smallest individual unit in a program is called


A. token/lexical unit.

B. keyword.

C. identifier.

D. functions.

Right Answer is: A

SOLUTION

A token is the smallest element of a C++ program that is meaningful to the compiler. It includes keywords, identifiers and literals.


Q. 192812 << and >> are called


A. cascading stream.

B. stream.

C. cascading stream of input and output operators.

D. keywords.

Right Answer is: C

SOLUTION

<< is called insertion or put to operator. It directs the contents of the variable on its right to the object on its left. >> is extraction operator. Together these are called as cascading stream of input and output operators.


Q. 192813 Error in the code below for (k=0, k<10, k++) is


A. instead of commas semicolon should be used.

B. there should be a semicolon at the end of the statement.

C. there is no error.

D. the increment should always be ++k.

Right Answer is: A

SOLUTION

In for loop the proper syntax is for (initialization; condition; increment). So it should be for (k=0; k<10; k++).


Q. 192814 If x=++6 and y=x if x increases by 1 the value of y would be


A. y=5

B. y=6

C. error.

D. y=7

Right Answer is: C

SOLUTION

The following code will result an error called Lvalue required, because the prefix operator ++in C++ works on the operand rather than the value.


Q. 192815 An expression is composed of


A. only operators.

B. only constants.

C. only variables.

D. operators, constants and variables.

Right Answer is: D

SOLUTION

An expression is composed of one or more operations. The objects of the operation(s) are referred to as operands.The operations are represented by operators.


Q. 192816 The function that returns the remainder of the division x/y is


A. double fmod( double x, double y)

B. double mod( int y, int x)

C. int fmod( double x, double y)

D. int fmod( double x, double y)

Right Answer is: A

SOLUTION

Example: fmod( 10.0, 4.0 ) returns 2.0


Q. 192817 Conversion of all operands upto the type of largest operand is


A. integral promotion.

B. type casting.

C. type promotion.

D. type conversion.

Right Answer is: C

SOLUTION

Whenever a variable or expression of smaller type is converted to operand of larger type, it is called type promotion.


Q. 192818 The database type of the expression 'z' - 5, is


A. char.

B. float.

C. int.

D. long.

Right Answer is: C

SOLUTION

i) 'z' is char and char is converted to an int using implicit conversion. ii) 5 is int. iii) therefore together the expression is int.


Q. 192819 Implicit conversion is performed by


A. programmer.

B. compiler.

C. by both programmer and compiler.

D. users.

Right Answer is: B

SOLUTION

An implicit conversion sequence is the sequence of conversions required to convert an argument in a function call to the type of the corresponding parameter in a function declaration.


Q. 192820 What is the output of the following code fragment  
      { int val =100,          int n=1570;          int sum;           sum=n+val>1500?600:300; Cout<< sum; 
}


A. 300

B. 600

C. 1570

D. 1500

Right Answer is: B

SOLUTION

? is a conditional operator. If yes do this Else do something else.


Q. 192821
A. 300
B. 600
C. 1570
D. 1500

Right Answer is:

SOLUTION

Result is 1 ,i.e., True.


Q. 192822 What does the type conversion rule state in an assignment statement?
A. 300
B. 600
C. 1570
D. 1500

Right Answer is:

SOLUTION

In an assignment statement, the type conversion rule states : The value of the right side (expression side) of the assignment is converted to the type of the left side(target variable).


Q. 192823 State any four valid integer expressions ?
A. 300
B. 600
C. 1570
D. 1500

Right Answer is:

SOLUTION

i) a+b-c+count 
ii)  a%b
 
iii) a/b
iv) –a+b*c


Q. 192824 What is type conversion ?
A. 300
B. 600
C. 1570
D. 1500

Right Answer is:

SOLUTION

The process of converting one predefined type into another is called Type conversion. It is also known as type-casting. C++ provides two types of type-casting -

(i) Implicit type-casting

(ii) Explicit type-casting


Q. 192825 How are Integer Expressions formed ?
A. 300
B. 600
C. 1570
D. 1500

Right Answer is:

SOLUTION

Integer expressions are formed by connecting i) integer constants ii) and/or integer variables iii)  and/or integer arithmetic operators.


Q. 192826 What is a conditional operator ?
A. 300
B. 600
C. 1570
D. 1500

Right Answer is:

SOLUTION

The conditional operator in C++ is (? :). It stores a value depending upon a condition and requires three operands. It works like an if-else statement.


Q. 192827 State the types of logical operators with their symbols ?
A. 300
B. 600
C. 1570
D. 1500

Right Answer is:

SOLUTION

a) Logical OR ||
b) Logical AND &&
c) Logical NOT !


Q. 192828 Explain the use of prefix and then change the value?
A. 300
B. 600
C. 1570
D. 1500

Right Answer is:

SOLUTION

In the prefix version – first change the value ie.- increase or decrease) the value and then use it in the expression.

 


Q. 192829 Explain  the use of postfix and  then  change the value?
A. 300
B. 600
C. 1570
D. 1500

Right Answer is:

SOLUTION

In the postfix version, first use the value and then change it either by increasing or decreasing it.


Q. 192830 Describe the  postfix operator?
A. 300
B. 600
C. 1570
D. 1500

Right Answer is:

SOLUTION

When an increment and decrement operator follows the operand it is called the postfix form. In this C++ first uses the value of the operand in evaluating the expression, before  incrementing or decrementing the operator’s value.

 


Q. 192831 What are the two types of Unary operators ?
A. 300
B. 600
C. 1570
D. 1500

Right Answer is:

SOLUTION

Two type of unary operators are :-
i) unary +  and  ii)  unary – (minus)

 


Q. 192832 Distingish between Binary and Unary operators ?
A. 300
B. 600
C. 1570
D. 1500

Right Answer is:

SOLUTION

Binary operators need 2 operands (i.e. values) whereas Unary operators need one operand.


Q. 192833 What are Arithmetical operators ?
A. 300
B. 600
C. 1570
D. 1500

Right Answer is:

SOLUTION

There are 5 arithmetical operators. These are -

  i) + 
  ii) – 
  iii) *
  iv) division as  / and
  v) remainder as %


Q. 192834 The statement which is used to return from a function is


A. goto statement.

B. return statement.

C. break statement.

D. continue statement.

Right Answer is: B

SOLUTION

In computer programming, a return statement causes execution to leave the current subroutine and resume at the point in the code immediately after where the subroutine was called — known as its return address.


Q. 192835 The loops in C++ are


A. for, goto and switch.

B. goto, switch and while.

C. for, switch and do-while.

D. for, while and do-while.

Right Answer is: D

SOLUTION

C++ provides three kinds of loops: for loop, while loop, and do-while loop. All three loops construct of C++ repeat a set of statements as long as a specified condition remains true.


Q. 192836 The number of loops provided by C++ are


A. two.

B. three.

C. four.

D. five.

Right Answer is: B

SOLUTION

C++ provides three loops: for, while and do-while.


Q. 192837 The two types of selection statements are


A. if and else.

B. if and not.

C. if and switch.

D. goto and switch.

Right Answer is: C

SOLUTION

An if statement is a selection statement that allows more than one possible flow of control. A switch statement is a selection statement that transfers control to different statements within the switch body depending on the value of the switch expression.


Q. 192838 The conditional operator can be used as an alternative to


A. if statement.

B. else statement.

C. if-else statement.

D. go statement.

Right Answer is: C

SOLUTION

The conditional operator (?:) takes three operands. It tests the result of the first operand and then evaluates one of the other two operands based on the result of the first. It is similar to if-else statement.


Q. 192839 The types of selection statement in C++ are


A. two.

B. three.

C. four.

D. five.

Right Answer is: A

SOLUTION

The two types of selection statements are :- if and switch statement.


Q. 192840 The condition on which the execution of the loop depends is known as


A. entry condition.

B. out condition.

C. exit condition.

D. control condition.

Right Answer is: C

SOLUTION

The set of statements that are repeated again and again is called the body of the loop. The condition on which the execution or exit of the loop depends is called the exit condition.


Q. 192841 The iteration construct is also known as


A. closed construct.

B. open construct.

C. decision construct.

D. looping construct.

Right Answer is: D

SOLUTION

The iteration construct means repetition of a set of statements depending upon a condition test. Till the condition is true, a set-of-statements are repeated again and again. This construct is also known as looping construct.


Q. 192842 The repetition of a set-of-statements depending upon a condition-test is known as


A. sequence construct.

B. decision construct.

C. iteration construct.

D. order construct.

Right Answer is: C

SOLUTION

The iteration construct means repetition of a set of statements depending upon a condition test. Till the condition is true, a set-of-statements are repeated again and again.


Q. 192843 When the execution of the statements is done sequentially, it is known as


A. sequence construct.

B. order construct.

C. inline construct.

D. straight construct.

Right Answer is: A

SOLUTION

The sequence construct means the statements are being executed sequentially. This represents a default flow of statements.


Q. 192844 The instructions given to a computer to perform any kind of action are known as


A. flow of control.

B. sequence construct.

C. database.

D. statement.

Right Answer is: D

SOLUTION

Statements are the instructions given to the computer to perform any kind of action, be it data movements, making statements, making decisions or repeating actions.


Q. 192845 The looping construct is also known as


A. document construct.

B. sequence construct.

C. decision construct.

D. iteration construct.

Right Answer is: D

SOLUTION

The looping construct is known as iteration construct because it helps in repeating the task until exit condition met.


Q. 192846 The execution of statements depending upon a condition-test is


A. sequence construct.

B. iteration construct.

C. selection construct.

D. operation construct.

Right Answer is: C

SOLUTION

In selection construct, if a condition evaluates to true, a course-of-action is followed otherwise another course of action is followed.


Q. 192847 The number of ways in which flow of control in a program can be done, is


A. two.

B. three.

C. four.

D. five.

Right Answer is: B

SOLUTION

There are three ways: sequentially, selectively and iteratively.


Q. 192848 A sequence of statements enclosed by a pair of braces ( { } ) is known as


A. executable statements.

B. compound statements.

C. simple statements.

D. complex statements.

Right Answer is: B

SOLUTION

Compound statements contain (groups of) other statements; they affect or control the execution of the other statements in some way.


Q. 192849 All executable statements in C++ are terminated by a


A. .

B. ;

C. :

D. : -

Right Answer is: B

SOLUTION

A semi-colon (;) terminates statements in C++.


Q. 192850 The instructions given to a computer to perform any kind of action are known as


A. flow of control.

B. sequence construct.

C. database.

D. statements.

Right Answer is: D

SOLUTION

Statements are the instructions given to the computer to perform any kind of action, be it data movements, making statements, making decisions or repeating actions.


Q. 192851 The statement which abandons the current iteration of the loop by skipping over the rest of the statements in the loop-body , is known as


A. continue statement.

B. break statement.

C. goto statement.

D. return statement.

Right Answer is: A

SOLUTION

The continue statement immediately transfers control to the evaluation of the test-expression of the loop for the next iteration of the loop.


Q. 192852 The output of the following program segment is 

for(int i = 10; i>6; i = i-2)  cout << i<< endl;


A. 10 8 6.

B. 8 6.

C. 10 8.

D. 10 8 7 6.

Right Answer is: C

SOLUTION

The variable is initialised from 10 and then two is subtracted each time. This continues till the time i>6.


Q. 192853 The output of the following code fragment is

for(int i = 1; i<10; i++)   cout<


A. 1 2 3 4 5 6 7 8 9.

B. 0 1 2 3 4 5 6 7 8.

C. 1 2 3 4 5 6 7 8 10.

D. 3 4 5 6 7 8 9 10.

Right Answer is: A

SOLUTION

Here the variable is initialized from 1 and will continue up to 9 as,  i<10.


Q. 192854 The output of the following program segment is for(int = -3, sum =0;  i<11; i++) sum++; cout << sum;


A. -3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11.

B. -2,-1,0,1,2,3,4,5,6,7,8,9,10,11.

C. -2,-1,0,1,2,3,4,5,6,7,8,9,10.

D. an error message.

Right Answer is: D

SOLUTION

It will produce an error message ’Declaration terminated incompletely’ during compilation as the declaration int = -3 does not declare a variable.


Q. 192855 In a control structure switch-case, the statement which gets executed when there is no match, is


A. break statement.

B. continue statement.

C. switch statement.

D. default statement.

Right Answer is: D

SOLUTION

The switch statement body consists of a series of case labels and an optional default label. The default label can appear only once.


Q. 192856 The function that breaks out of the program, abandoning the rest of the execution of the program is known as


A. entry( ) function.

B. quit( ) function.

C. exit( ) function.

D. close( ) function.

Right Answer is: C

SOLUTION

The exit( ) function causes the program to terminate as soon as it is encountered, no matter where it appears in the program listing.


Q. 192857 The simplest statement in C++ program is a/an


A. empty statement.

B. blank statement.

C. free statement.

D. closed statement.

Right Answer is: A

SOLUTION

The simplest statement is an empty or null statement. It takes the form: ; // it is a null statement, just a semi-colon.


Q. 192858 The statement i- -; is equivalent to


A. i=i+1.

B. i=i-1.

C. i=i+i.

D. i=i+0.

Right Answer is: B

SOLUTION

i-- is equal to i-1. -- is a decrement operator which decrements value by 1. For example a--is equal to a-1.


Q. 192859 The statement i++; is equivalent to


A. i=i+1.

B. i=i-1.

C. i=i+i.

D. i=i+0.

Right Answer is: A

SOLUTION

i++ is equal to i+1. ++ is an increment operator which increments value by 1.


Q. 192860 In a do while loop, evaluation is done at the


A. bottom of the loop.

B. top of the loop.

C. middle loop.

D. top or bottom of the loop.

Right Answer is: A

SOLUTION

In most computer programming languages, a do while loop, sometimes just called a do loop, is a control flow statement that allows code to be executed repeatedly based on a given Boolean condition. Here, the evaluation is done at the bottom of the loop.


Q. 192861 In while loop, the evaluation is done at the


A. bottom of the loop.

B. top of the loop.

C. middle loop.

D. top or bottom of the loop.

Right Answer is: B

SOLUTION

In most computer programming languages, a while loop is a control flow statement that allows code to be executed repeatedly based on a given Boolean condition. Here the evaluation is done at the top of the loop.


Q. 192862 In a for loop, evaluation is done at the


A. bottom of the loop.

B. top of the loop.

C. middle loop.

D. top or bottom of the loop.

Right Answer is: B

SOLUTION

In computer science, a for loop is a programming language statement, which allows code to be repeatedly executed at the top of the loop. A for loop is classified as an iteration statement.


Q. 192863 Error in the following code while (i<10) && (i>24) is


A. the logical operator && cannot be used with while statement.

B. the while loop is an exit condition loop.

C. the test condition is always false.

D. the test condition is always true.

Right Answer is: C

SOLUTION

Here, the condition controlling the execution of the loop is always false. It will never be true.


Q. 192864 The selection construct is also known as


A. document construct.

B. sequence construct.

C. decision construct.

D. iteration construct.

Right Answer is: C

SOLUTION

The selection construct is known as decision construct because it helps in making decision about which set-of-statements is to be executed.


Q. 192865 The statement i++; is equivalent to


A. i=i+1.

B. i=i-1.

C. i=i+i.

D. i=i+0.

Right Answer is: A

SOLUTION

i++ is equal to i+1. ++ is an increment operator which increments value by 1.


Q. 192866 << and >> are called


A. cascading stream.

B. stream.

C. cascading stream of input and output operators.

D. keywords.

Right Answer is: C

SOLUTION

<< is called insertion or put to operator. It directs the contents of the variable on its right to the object on its left. >> is extraction operator. Together these are called cascading stream of input and output operators.


Q. 192867 A continue statement causes execution to skip to


A. return 0; statement.

B. the first statement after the loop.

C. the statement following the continue statement.

D. the next iteration of the loop.

Right Answer is: D

SOLUTION

Continue statement ends the current iteration of a loop. Program control is passed from the continue statement to the end of the loop body and continue next iteration.


Q. 192868 Smallest individual unit in a program is called


A. token/lexical unit.

B. keyword.

C. identifier.

D. functions.

Right Answer is: A

SOLUTION

A token is the smallest element of a C++ program that is meaningful to the compiler. It includes keywords, identifiers and literals.


Q. 192869 If there is more then one statement in the block of a for loop, the bracket, which is placed at the beginning and the ending of the loop block, is


A. parenthesis ().

B. braces {}.

C. brackets [].

D. arrows <>.

Right Answer is: B

SOLUTION

{} are used for more than one statement in the block of a for loop. When there is a single statement then () are used. Example: for (i=0;i<10;i++). It will execute the code within for loop 10 times.


Q. 192870 int n,i;
cin>>n; i=0; do {
cout<< n<< ”x”<< i<< ”=”<< n*i<< endl; }


A. 5

B. 0

C. 3

D. 2

Right Answer is: B

SOLUTION

Any number * 0= 0


Q. 192871 Identify the error int sum=0; int i=1; do while(i<10) {sum=sum+1; i=i+1; }


A. int i=1;

B. while condition after closing braces.

C. int sum;

D. (i<10)

Right Answer is: B

SOLUTION

The while condition should be after closing braces so that the statements executed at least once. the correct code is: int sum=0; int i=1; do {sum=sum+1; i=i+1; }while(i<10);


Q. 192872 Identify the error i=1; while i<10; { cout<<5*i; i++; }


A. int i=1;

B. while(i<10)

C. both (a) and (b)

D. cout<<5*i;

Right Answer is: C

SOLUTION

  Both a) and b) are correct so answer is c
int i=1;
While(i<10)  


Q. 192873 The loop that executes a section of code a fixed number of times is


A. for loop.

B. do loop.

C. if-else loop.

D. switch statement.

Right Answer is: A

SOLUTION

The for loop executes a section of code a fixed number of times. It defines number of times we want to execute the code.


Q. 192874 i<=15; in 'for' loop is


A. update expression.

B. Test expression.

C. Initialization expression.

D. Declaring expression.

Right Answer is: B

SOLUTION

for loop is having following form:
for(initialization expression; test expression ; update expression)

Example:
for(i =0; i<=15; i++)


Q. 192875 Multiple expressions in For loop are separated by


A. semicolon.

B. double quotes.

C. comma.

D. single quotes.

Right Answer is: C

SOLUTION

Example:

for(i=1, sum =0; i<= n; i++)

here two varialbe i and sum is initialised with for loop both these variables are seperated by comma.


Q. 192876 The body of the loop may executed atleast one in


A. While loop

B. For loop

C. do while

D. All of the above

Right Answer is: C

SOLUTION

do-while is exit controlled loop, it evaluates the test expression after executing its loop body statements. This means that a body of loop executed at least once.


Q. 192877 Jump statements are:


A. break.

B. continue.

C. switch

D. both a and b

Right Answer is: D

SOLUTION

Jump statements are used to transfer program control unconditionally. There are following jump statements:
break, continue, goto, return


Q. 192878 appropriate loop when number of iterations are known


A. while

B. for

C. do while

D. all of the above

Right Answer is: B

SOLUTION

for loop is the simplest loop among all loops. All its loop-control elements are gathered in one place(on the top of loop).Therefore it is convnient to use for loop when number of iterations are known.


Q. 192879 Continue statement causes a break in


A. switch statement.

B. If else.

C. next iteration.

D. none of the above.

Right Answer is: C

SOLUTION

The continue statement skips the remaining statements in the body of the loop, and continues with the next iteration of the loop.


Q. 192880 To abandon execution of the rest of the program use


A. library function main.

B. break.

C. continue.

D. exit function.

Right Answer is: D

SOLUTION

exit function : is terminates entire program. Here it is used in for loop when the value of i is eqauls to 100 then exit(0) will be executed and the program will be terminated.

#include
#include
#include // requires to include for exit() function
main()
{
clrscr();
for (int i=1;i<=100; i++)
{
cout << i < if (i==30)
exit(0); // it will termiate entire program
}
cout << "hello" < getch();
}  


Q. 192881 Goto cannot forward jump over a____except in a block.


A. A constant.

B. Switch statement.

C. break statement.

D. A variable definition.

Right Answer is: D

SOLUTION

You cannot use a goto statement to jump over initializations. A goto statement is allowed to jump within the scope of a variable length array, but not past any declarations of objects with variably modified types.


Q. 192882 Return statement is used to return from


A. function.

B. Iteration loop.

C. program.

D. do while  loop.

Right Answer is: A

SOLUTION

A return statement ends the processing of the current function and returns control to the caller of the function.


Q. 192883 Statement that can transfer control anywhere in the program is


A. If.

B. Goto.

C. for statement.

D. do while.

Right Answer is: B

SOLUTION

A goto statement causes your program to unconditionally transfer control anywhere in the program or to the statement associated with the label specified on the goto statement.


Q. 192884 Unconditional statements are called


A. Assignment statements.

B. Jump statements.

C. block statements.

D. looping statement.

Right Answer is: B

SOLUTION

Jump statement unconditionally transfer program control within a function.


Q. 192885 Switch statement is used for


A. One statement selection.

B. Multiple branch Selection.

C. Switch selection.

D.  None of the above.

Right Answer is: B

SOLUTION

switch statement is a multiway decisions that tests whether a variable or expression matches one of a number of constant integer values, and branches accordingly.


Q. 192886 Block is treated as


A. Multiple statements unit.

B. Single unit.

C. selection unit.

D. none of them.

Right Answer is: B

SOLUTION

A block is a single unit that contain group of statements which are separated by semicolon(;).


Q. 192887 Return,Goto, exit ( ), break and continue are all


A. general statements.

B. Selection Statements.

C. Iteration statements.

D. jump statements.

Right Answer is: D

SOLUTION

Jump statements unconditionally transfer program control within a function. There are following jump statements: goto, return, continue, break and one library function exit( ).


Q. 192888 For,While, Do While statements all are


A. Selection statements.

B. Iteration statements.

C. Conditional statements.

D. Decision making statements.

Right Answer is: B

SOLUTION

Iteration construct depends upon condition test which can be either true or false. There are following iteration construct: for, while and do-while.


Q. 192889 If and Switch statements together are referred to as


A. selection statements.

B. jump statements.

C. repetitive statements.

D. loop statements.

Right Answer is: A

SOLUTION

They are together referred to as Selection construct. It means the execution of statement depending upon a condition test. It evaluates it to Truth value. It can also called as decision making statement.


Q. 192890 Break statement will Abort the loop and transfer


A. control to the end of  the program.

B. control to the next statement.

C. control to the next statement outside the loop.

D. none of the above.

Right Answer is: C

SOLUTION

A break statement enables a program to skip over part of the code and jumps to the statement following the loop.


Q. 192891 int i=5;
 {
cout << " * " ;    i++;  }
while(i==4);  
 


A. *

B. **

C. ****

D. *****

Right Answer is: A

SOLUTION

Output here will be one star  i.e. * while condition evaluated false so loop is terminated.


Q. 192892 What is the output of :- int i=2; while (i ==2); cout<<”square of” i << is “i*i”;


A. square of 2 is 1

B. square of 2 is 4

C. square of 3 is 9

D. square of 2 is 4.5

 

Right Answer is: B

SOLUTION

initial value of i = 2 and while condition evaluates to true, so cout statement is executed
therefore i*i = 2*2 =4


Q. 192893 Following code will take:-

while (ch!= ‘&’){
cin >> ch ;
if(ch==’ ‘)
Space++;
if(ch==’n’)
Newline++
}


A. takes less processing time.

B. takes more processing time.

C. takes extremely less processing time.

D. takes average processing time.

Right Answer is: B

SOLUTION

There are 2 if statements, so takes more processing time.


Q. 192894 Continue statement


A. forces termination.

B. forces next iteration.

C. forces exit and continue.

D. forces next termination.

Right Answer is: B

SOLUTION

A continue statement ends the current iteration of a loop. Program control is passed from the continue statement to the end of the loop body. Thus forces next iteration.


Q. 192895 Compound statement is


A. Block statement.

B. Set statement.

C. Group statement.

D. collective statement.

Right Answer is: A

SOLUTION

A compound statement consists of zero or more statements enclosed in curly braces ({ }). A compound statement can be used anywhere a statement is expected. Compound statements are commonly called "blocks."


Q. 192896 Time Delay loop can be created by


A. putting semicolon after paranthesis in for statement.

B. terminating for loop by colon.

C. just by terminating paranthesis.

D. putting a fullstop after paranthesis.

Right Answer is: A

SOLUTION

Time delay loop can be made by putting semicolon(;) after closing parenthesis of loop

Example:
for(t=0; t<300; t++);


Q. 192897 Empty or null statement is shown by


A. colon :

B. double quotes “ “

C. semicolon ;

D. single quotes ‘ ‘

Right Answer is: C

SOLUTION

An empty statement does nothing.

empty statement
;

An empty statement is used when there are no operations to perform in a context where a statement is required.  


Q. 192898 In for(a=1,total=0;++a) Null statement in this construct can be attached by


A. braces.

B. single quote.

C. double quotes.

D. ending parenthesis in for statement by a semicolon.

Right Answer is: D

SOLUTION

For attaching null with given for loop, the code will be written as:

for(a=1,total=0;++a)
;


Q. 192899 By using Program Control statements computer can perform


A. only decision making tasks.

B. only repetitive tasks.

C. any types of tasks.

D. both repetive tasks as well as decision making tasks.

Right Answer is: D

SOLUTION

Repetitive and decision making tasks Eg:- Calculating pay structure for all say 10,000 employees of an organization. Or making voters list depending on age


Q. 192900 Empty or null statement is shown by


A. colon ( : ).

B. double quotes (" " ).

C. semicolon( ;).

D. single quotes ( ' ' ).

Right Answer is: C

SOLUTION

The simplest statement is empty, or null statement and is shown as: semicolon( ;)


PreviousNext