Quiz
Programming in C
This quiz has a time limit, so it opens in the usual player.
Questions in this quiz (44)
1A C variable name can start with a ____
- ANumber
- BPlus Sign (+)
- CUnderscore
- DAsterisk (*)
2Name the loop that executes at least once.
- Afor
- Bif
- Cdo-while
- Dwhile
3A pointer pointing to a memory location of the variable even after deletion of the variable is known as _____
- Afar pointer
- Bdangling pointer
- Cnull pointer
- Dvoid pointer
4Which of the following correctly shows the hierarchy of arithmetic operations in C?
- A/ + * -
- B* - / +
- C+ - / *
- D/ * + -
5The output of the following code is:
main()
{ int z, a = 5, b = 3; z = a * 2 + 26 % 3;
printf("%d", z);
}- A10
- B0
- C12
- DNone of the above
6The output of the following code is:
void main()
{ char a = 'B';
switch (a)
{ case 'A' : printf("a");
case 'B' : printf("b");
default : printf("c");
}
}- AB
- Bb
- Cbca
- Dbc
7What is the output of this C code?
main()
{ int x=35;
printf("%d %d %d",x==35,x=50,x>40);
}- A1 50 1
- B0 50 0
- CRuntime error
- DCompile time error
8Which among the following is NOT a logical or relational operator?
- A!=
- B==
- C||
- D=
9Which of the following is not a correct variable type?
- Afloat
- Breal
- Cint
- Ddouble
10Which of the following is true?
- A1
- B66
- C0.1
- D-1
- EAll of the above
11Evaluate !(1 && !(0 || 1)).
- ATrue
- BFalse
- CUnevaluatable
- DError
12Which of the following is the proper declaration of a pointer?
- Aint x;
- Bint &x;
- Cptr x;
- Dint *x;
13Which of the following gives the memory address of integer variable a?
- A*a;
- Ba;
- C&a;
- Daddress(a);
14Which of the following gives the value stored at the address pointed to by pointer a?
- Aa;
- Bval(a);
- C*a;
- D&a;
15Which conversion is not possible?
- Aint to float
- Bfloat to int
- Cchar to float
- DAll are possible
16What variables stores the number of arguments to a program in command line arguments?
- Aargc
- Bargv
- Ccount
- Darglen
17What is argv[0]?
- AThe number of arguments to the program
- BThe name of the program
- CThe first argument to the program
- DThis syntax is illegal
18The parameter passing mechanism for an array is
- Acall by value
- Bcall by value-result
- Ccall by reference
- Dnone of these
19Consider the statement
int val[2] [4] = { 1, 2, 3, 4, 5, 6, 7, 8} ;
4 will be the value of- Aval[0][ 3]
- Bval[0][4]
- Cval[1][1]
- Dnone of the above
20The following program fragment
int a = 4, b = 6;
printf (" %d ", a == b);- Aoutputs an error message
- Bprints 0
- Cprints 1
- Dnone of the above
21The following program fragment
int a = 4, b = 6;
printf ("%d", a = b) ;- Aoutputs an error message
- Bprints 0
- Cprints 1
- D6
22main( )
{ int a = 5, b = 2;
printf("%d", a+++b);
}- Aresults in syntax error
- Bprints 7
- Cprints 8
- Dnone of above
23Let x be an integer which can take a value of 0 or 1. The statement if(x = =0) x = 1; else x = 0; is equivalent to which one of the following?
- Ax=1+x;
- Bx=1—x;
- Cx=x—1;
- Dx=1%x;
24Which command is used to skip the rest of a loop and carry on from the top of the loop again?
- Abreak;
- Bresume;
- Ccontinue;
- Dskip ;
- Eexit;
25Which of the following is not a storage class in C?
- Aauto
- Bstruct
- Cextern
- Dstatic
- Eregister
26Which of following is not a valid name for a C variable?
- AHairaj
- BHello_raj
- CHello raj
- DBoth (a) and (b) above
- ENone of the above.
27How many times the below loop will get executed?
main()
{ int i;
for(i=9;i;i=i-2)
{ printf("\n%d",i);
}
}- A5
- B6
- CCompilation Error
- DInfinite
28What will be the output
main()
{ int i;
i = 10;
if(i == 20 || 30)
{printf("True");
}
else
{printf("False");
}
}- ATrue
- BFalse
- CSyntax Error
- DRun time Error
29What the below statement will print if a=10 and b = 20?
printf("%d",a==b);- A20
- B10
- C1
- D0
30What is the output of the following code?
void main(){
printf("%d%d%d",50,100);
}- A50,100
- B50,100,garbage
- C50,100,0
- D0,50,100
31What is the output of the following program?
void main(){
printf("%d%d",100,200,300);
}- A100 200
- B200 300
- C300 200
- D100 200 300
32What is the output of the following program?
void main(){
printf("2+3=%d",2+3);
}- A2+3=0
- B2+3=2+3
- C2+3=5
- D5=2+3
33What is the output of the following program?
void main(){
int a;
a=3+5*5+3;
printf("%d",a);
}- A43
- B64
- C31
- Dnone of these
34what is the output of following program?
void main(){
int a;
float f;
a=12/5;
f=12/5;
printf("%d%f",a,f);
}- A2,2.000000
- B2,2.00
- C2,2
- Dnone of these
35What is the output of following program?
void main(){
int a;
a='a'>'A';
printf("%d",a);
}- A0
- B1
- Cgarbage
- Dnone of these
36What is the output of following program?
void abc(int a){
++a;
}
void main(){
int a=10;
abc();
abc();
printf("%d",a);
}- A10
- B11
- C12
- D13
37What is the output of following program?
void main(){
int i=10;
printf("%d%d%d",++i, i++, ++i);
}- A11 11 13
- B13 11 11
- C11 12 13
- D13 12 11
38what is the output of following program?
void main(){
printf("One");
if(2>1)
printf("Two");
else
printf("Three");
printf("Four");
}- AOne Two Three
- BTwo Three Four
- COne Two Four
- DOne Three Four
39what is the output of following program?
void main(){
float a;
a=6.7;
if(a==6.7)
printf("A");
else
printf("B");
}- AA
- BB
- Cerror
- Dnothing display on screen
40what is the output of following program?
void main(){
int a;
a=10;
a*=10+2;
printf("%d",a);
}- A102
- B100
- C120
- D22
41what is the output of following program?
void main(){
int a;
a=100;
printf("%d%d",++a,a++);
}- A101 101
- B101 102
- C102 100
- D102 101
42What is the output of the following program?
void main(){
int a;
a=100>90>80;
printf("%d",a);
}- A0
- B1
- Cerror
- Dnone of these
43What will be the output of the following program
void main( ){
int a=10;
printf("%d",a);
{ int a=20;
printf("%d",a);
}
printf("%d",a);
}- A10 10
- B20 10
- C10 20 10
- D10 10 10
44What is the output of following program?
void f1(){
int a=0;
++a;
printf("%d",a);
}
main(){
int a=10;
f1();
f1();
f1();
printf("%d",a);
return 0;
}- A0 1 1 10
- B10 0 1 10
- C1 2 3 4
- D1 1 1 10
Information
- Description
- First year First Year Quiz on Programming in C, created by Faheem Ahmed on 26/03/2018.
- Author
- Faheem Ahmed
- Language
- English
- Views
- 1,695
- Tags
- Rating
- No ratings yet Rate this quiz