Fundamentals of



Download 9.46 Mb.
Page16/57
Date09.01.2017
Size9.46 Mb.
#8172
1   ...   12   13   14   15   16   17   18   19   ...   57

Q.25 find the output of the following program

#include



void main()

{

int i=1;



switch(i)

{ printf(“:ello\n”) case 1:



case 2:


printf(:i\n”)


printf(\nBye\n”)

break;


}

}





(a)Hi

(c)Hello Hi

(b)Bye

(d) Hello Bye



Q. 26 find the output of the following program

#include



void main()

{

char j=1;



while(j<5)

{

printf(%d j++)

}

printf(\n”)

}


(a)1 2 3 4 127

(c)1 2 3 4 5 127 128 0 1 2 3 infinite times

(b) 1 2 3 4 255 (d) 1 2 3 4





Q.27 To repeat a set of the statements for 25 times ,which kind of statement will be required?


(a)Iterative

(c)Either (a) or (b) can be used

(b)Selective



(d)None of the above



Q.28 To perform one of the many operations selected based on a condition, which kind of statement will be required?


(a)Iterative

(c)Either (a) or (b) can be used
Q.29 =nitializaions in thefor” loop are optional

(b)Selective

(d)None of the above


(a)true

(d)None of the above

(b)False (c)Depends on the condition





Q 30 The maximum number of initializations allowed in a forloop are

(a)1 (b)2 (c)3 (d)None of above


Q 31 The minimum number of initializations allowed in a for” loop are

(a)0 (b)1 (c)2 (d)None of above


Q 32 The maximum number of conditions allowed in a for” loop are

(a)1 (b)2 (c)3 (d)None of above


Q 33 The minimum number of conditions allowed in a forloop are

(a)0 (b)1 (c)2 (d)None of above


Q 34 The maximum number of update/increment/decrement allowed in a for” loop are

(a)1 (b)2 (c)3 (d)None of above
Q 35 The minimum number of update/increment/decrement allowed in a forloop are


(a)1 (b)2 (c)3 (d)None of above


Q.36 The for loop execution has statements inside the loop executed before checking the condition for the first time

(a)True (b)False (c)Depends on the condition (d)None of the above
Q 37 The while” loop can be replaced by for” loop in all the cases

(a)True (b)False (c)Depends on the condition (d)None of the above





Q 38 The while” loop is an entry controlled

loop

(a)True (b)False


(c)Depends on the condition (d)None of the above



Q 39 The” do-whileloop is an entry controlled loop

(a)True (b)False (c)Depends on the condition (d)None of the above


Q 40 The while” loop is an exit controlled loop

(a)True (b)False (c)Depends on the condition (d)None of the above
Q 41 The ”do- while” loop is an exit controlled loop

(a)True (b)False (c)Depends on the condition (d)None of the above
Q.42 There is no semicolon (;) after the condition in the syntax of the while” loop

(a)True (b)False (c)Depends on the condition (d)None of the above


Q 43 There is no semicolon ( ) after the condition in the syntax of the “do-while” loop

(a)True (b)False (c)Depends on the condition (d)None of the above
Q.44 In the if-else” statement else is optional

(a)True (b)False (c)Depends on the condition (d)None of the above


Q.45 There can be a condition in the brackets associated with the switch statement

(a)True (b)False (c)Depends on the condition (d)None of the above
Q.46 Only expression or a variable is allowed in the brackets associated with the switch statement

(a)True (b)False (c)Depends on the condition (d)None of the above


Q 47 “break” statement is compulsory after every case in the switch-case” statement

(a)True (b)False (c)Depends on the condition (d)None of the above


Q 48 default statement is compulsory after every case in the “switch-case statement

(a)True (b)False (c)Depends on the condition (d)None of the above


Q.49 The label in “switch-case” statement can be a condition or expression

(a)True (b)False (c)Depends on the condition (d)None of the above


Q 50 The label in “switch-case” statement can be only a value

(a)True (b)False (c)Depends on the condition (d)None of the above
Q 51 ”break ” statement when executed the control is transferred

(a)Outside the loop ,to the next statement after the loop (b)beginning of the loop i.e. to the first statement in the loop (c)outside the function, to the next function in the program (d)beginning of the function i.e. to the first statement in the function


Q 52 continue ” statement when executed the control is transferred

(a)Outside the loop ,to the next statement after the loop (b)beginning of the loop i.e. to the first statement in the loop (c)outside the function, to the next function in the program (d)beginning of the function i.e. to the first statement in the function


Q 53 goto statement transfers the control to (a)Outside the loop ,to the next statement after the loop (b)beginning of the loop i.e. to the first statement in the loop (c)Label specified with the statement

(d)None of the above
Q.54 Find the output of the following program

#include<stdio.h>

void main()

{

int i,j;



for(i=1;i<=2;i++)

{

for(j=1;j<=2;j++)

{

printf(:ello”)

}


printf(:i\n”)

}

}



(a)Hello Hello Hi

Hello Hello Hi
(c) Hello Hello Hi

(b) Hello Hello Hi Hello Hello Hi Hello Hello Hi



(d)Hello Hi

Hello Hi

Hello Hi

Hello Hi



Q.55 Find the output of the following program

#include



void main()

{

int i,j;



for(i=1;i<=2;i++)

{

for(j=1;j<=3;j++)

{


printf(“:ello”)

}


printf(\n”)

}

}



(a)Hello Hello Hello Hello Hello Hello Hello Hello Hello

(c) Hello Hello

Hello Hello



Download 9.46 Mb.

Share with your friends:
1   ...   12   13   14   15   16   17   18   19   ...   57




The database is protected by copyright ©ininet.org 2024
send message

    Main page