Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
C quiz
1. Q1. In C, if you pass an array as an argument to a function, what actually gets passed?
A.Value of elements in array
B. First element of the array
C. address of the first element of array
D.Address of the last element of array
Ans.c
Q2. The keyword used to transfer control from a function back to the calling function is
A.switch B. goto
C. go back D.return
Ans.d
Q3.Which of the following is not logical operator?
A.& B. &&
C. || D. !
Ans. A
&- address operator
&&-and operator
||- or operator
!- not operator
Q4.Which of the following cannot be checked in a switch-case statement?
A.Character B. Integer
C. Float D.enum
Ans. C
Q5.Which of the following are unary operators in C?
1. !
2. sizeof
3. ~
4. &&
A.1, 2 B. 1, 3
C. 2, 4 D.1, 2, 3
Ans- d
Unary operator means single operand
Q6.Point out which are not valid C constants:
2. A.124.567
B.0xbc40
C.0Xbc40
D.0x12.45
Ans-d
Q7.How will you print n on the screen?
A.printf("n"); B. echo "n";
C. printf('n'); D.printf("n");
Ans. D
If we want to print n on the screen we use double slash
Or if we want to print on the screen we use double slash
Q8.Which of the following is the correct order of evaluation for the below expression?
z=x+y*z/4%2-1
A.* / % + - = B. = * / % + -
C. / * % - + = D.* % / - + =
Ans.a
Precedence order of * , /, % are same.
Associativity of +, -
= has least precedence
Q9.What will be the output of the program?
#include<stdio.h>
int main()
{
const int x=5;
const int *ptrx;
ptrx = &x;
*ptrx = 10;
printf("%dn", x);
return 0;
}
A.5 B. 10
C. Error D.Garbage value
Ans.c
Q10.Which of the following is the correct usage of conditional operators used in C?
3. A.a>b ? c=30 : c=40; B. a>b ? c=30;
C. max = a>b ? a>c?a:c:b>c?b:c D.return (a>b)?(a:b)
Ans.c
Q11.How many times "India" is get printed?
#include<stdio.h>
int main()
{
int x;
for(x=-1; x<=10; x++)
{
if(x < 5)
continue;
else
break;
printf("India");
}
return 0;
}
A.Infinite times B. 11 times
C. 0 times D.10 times
Ans.c
Q12.FIND OUTPUT OF THE PROGRAM
{
Int a,b;
a=5.999999;
b=5.000001;
printf(“%d %d”,a,b);
}
A.56
B.55
C.65
D.66
Ans.b