You are on page 1of 3

RIMIT COLLEGE

Class Test - 03
Angul
C PROGRAMMING LAB TEST Full Mark:

NAME: ________________________________
ROLL NO.: __________________________
STREAM: _________________________

(Write your answers in the block provided)

1.Fill the Blanks(5X1)


1.The Following Syntax is _________
If conditional
code….
elsif conditional
code…..
else
code
end
2. _______________It is necessary that always if should come with

else block
3. Use of else statement is _________________________

4. ______________ loop is most suitable to first perform the


operation and then test sthe condition

5. ___________________operators are known as ternary operators.

2.MCQ(5X1)
1. Find the output of the given C program.
#include<stdio.h>
int main()
{
int a=0;
if(a++)
{
printf("x"); a) z
printf("y"); b) Compile time error
} c) xyz
printf("z"); d) xy
return 0;
}

2.Which of the following condition has topmost priority?


A. IF B. ELSIF
C. ELSE D. THEN

3. What is the output of this C code?


int main() A. Before continue after continue
{ B. Before continue
printf("before continue "); C. after continue
D. Compile time error
continue;
printf("after continue\n");
}
4.What is the output of this C code(when 1 is entered)?
void main()
{
double ch;
printf("enter a value btw 1 to 2:");
scanf("%lf", &ch);
switch (ch)
{ A. Compile time error
case 1: B. 1
printf("1"); C. 2
break; D. Varies
case 2:
printf("2");
break;
}
}

5. The following code 'for(;;)' represents an infinite loop. It can be terminated by.
A. break B. exit(0)
C. abort() D. All of the mentioned

3.MSQ(5X1)
1. We can use the keyword ‘break’ simply within _________.
A. while B. for
C. if-else D. do-while

2. Which of the following is valid if-else statement?


A. if (if (a == 1)){} B. if (func1 (a)){}
C. if (a){} D. if ((char) a){}

3. The keyword 'break' can be simply used within:


A. do-while B. if-else
C. for D. while

4. Which of the following is not used to come out of a loop only for that iteration?
A. break B. continue
C. return D. None of the mentioned

5. Choose a correct statement about a C Switch Construct.


A. default case is optional B. break; causes the control
inside switch. to exit the switch
C.You can not use duplicate immediately and avoid fall
CASE Constants inside a down to other CASE statements.
Switch construct. D. Non of the above.
4.MATCHING(5X1)
Group-I
Group-II
(i) the way to suddenly come out of or ANS-
(i) American Standard Code for
Quit any Loop in C Language.?
(ii) for(; ;); Information Interchange (i) ---
(iii) What does ASCII stand for? (ii) for loop works exactly first time
(iv) The advantage of ‘switch’ statement (iii) Hello
(ii) ---
over ‘if’ is that it leads to more structured OK
program. (iv) for loop works infinite number
a) True of times (iii) ---
b) False (v)False
(v) #include <stdio.h> (vi) break; statement
void main() (iv) ---
(vii) American Standard Code for
{ Interchanging Information
int a=10; (viii) quit; statement (v) ---
switch(a){
(ix)True
case 5+5:
printf("Hello\n"); (x)OK
default:
printf("OK\n");
}
}

You might also like