0% found this document useful (0 votes)
199 views8 pages

C Kandar

The document contains 25 multiple choice questions about C programming. The questions cover topics like data types, operators, functions, arrays, strings, loops, pointers, structures and more. For each question there are 4 answer options and the correct answer is to be chosen. Negative marks are deducted for wrong answers but there are no marks deducted for an unanswered question.

Uploaded by

Gaurav Patil
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
199 views8 pages

C Kandar

The document contains 25 multiple choice questions about C programming. The questions cover topics like data types, operators, functions, arrays, strings, loops, pointers, structures and more. For each question there are 4 answer options and the correct answer is to be chosen. Negative marks are deducted for wrong answers but there are no marks deducted for an unanswered question.

Uploaded by

Gaurav Patil
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 8

TECHNOZANCE ‘11

C-KANDAR
1) Each question carries 1 mark
2) Time 30 minutes
3) Negative ½ mark for each wrong answer, 0 for unanswered ones.

Q. 1. What is the output of the following program-


main()
{
float me = 1.1;
double you = 1.1;
if(me==you)
printf("I love U");
else
printf("I hate U");
}
a) I love U
b) I hate U
c) “I love U”
d) Error

Q. 2. What is the output of the following program-

main()
{
int i=-1,j=-1,k=0,l=2,m;
m=i++&&j++&&k++||l++;
printf("%d %d %d %d %d",i,j,k,l,m);
}

a) -1 -1 0 2 1
b) -1 -1 0 2 0
c) 00131
d) 00130
Q. 3. Which of the following is a valid function call (assuming the function exists)?
a) funct;
b) funct x, y;
c) funct();
d) int funct();

Q. 4. What is the final value of x when the code int x; for(x=0; x<10; x++) is run?
a) 10
b) 9
c) 0
d) 1

Q. 5. The statement
int **a;

a) is illegal
b) is legal but meaningless
c) is syntactically and semantically correct
d) none

Q. 6. The program fragment


int a = 5, b=2 ;
printf("%d", a+++++b);

a) prints 7
b) prints 8
c) prints 9
d) none
Q. 7. Which follows the case statement?
a) :
b) ;
c) -
d) A newline

Q. 8. Which of the following gives the memory address of a variable pointed to by


pointer a?
a) a;
b) *a;
c) &a;
d) address(a);

Q. 9. What variables stores the number of arguments to a program?


a) argc
b) argv
c) count
d) arglen

Q. 10. Consider the following program

void main()
{
putchar('M');
first();
putchar('m');
}

first(){ ???????}

second()
{
putchar('d');
}

If "Madam" is the reqiured output then the body of first() must be


a) empty
b) second(); putchar('a');
c) putchar('a'); second(); printf("%c",'a');
d) none

Q. 11. Which of the following set of statements is correct?

a) typedef long a;
extern int a c;

b) typedef long a
extern a int c;

c) typedef long a;
extern a c;

d) All are correct.

Q. 12. What will be output if you will compile and execute the following c code?
void main()
{
int a=5;
float b;
printf("%d",sizeof(++a+b));
printf(" %d",a);
}

a) 2 6
b) 4 6
c) 2 5
d) 4 5

Q. 13. What will be output if you will compile and execute the following c code?
void main()
{
char c='0';
printf("%d %d",sizeof(c),sizeof('0'));
}

a) 1 1
b) 2 2
c) 1 2
d) 2 1
Q. 14. What will be output if you will compile and execute the following c code?
void main()
{
float f;
f=3/2;
printf("%f",f);
}

a) 1.5
b) 1.500000
c) 1.000000
d) Compiler error

Q. 15.   __________ is the standard symbol for representing a conditional structure in


flowcharts?

a) diamond
b) rectangle
c) circle
d) arrow

Q. 16. In C programming, what does i equal at the end of the following piece (snippet) of
code?

i = 1;
i *= 5;
i += 3;

a) 8
b) 1
c) 5
d) 3
Q. 17. Which of the following statement is correct about the program given below:

#include<stdio.h>
void main()
{
int arr[3][3]={1,2,3,4};
printf(“%d\n”,*(*(*(a))));
}

a) It will output a garbage value.


b) It will output a value 1.
c) It will output a value 3.
d) None of these.

Q. 18. Which files will get closed when the following program?

#include<stdio.h>
void main()
{
FILE *mad,*crazy,*fool;
mad=fopen(“crazy.c”,”r”);
crazy=fopen(“fool.c”,”w”);
fool=fopen(“mad.c”,”r”);
fclose(mad,crazy,fool);
}

a) mad.c c) fool.c
b) crazy.c d) all 3 files will get closed.

Q. 19. We want to round off x,a float , to an int value. What is the correct way to do so?
a) y= (int)(x+0.5);
b) y= int(x+0.5);
c) y= (int) x+0.5;
d) y= (int) ((int) x+0.5);
Q. 20. Are the three declarations same?
char **facebook;
char *facebook[];
char facebook[][];

a) Yes b) No. c) May be

Q. 21. How many times will the following loop be executed if the input data item is
01234 ?

while((c=getchar())!=0)
{
}

a) Infinite b) Never
c) Once d) 4 times.

Q. 22. Consider the declaration:


int a=5,*b=&a;
then
printf (“%d”,a*b);
results in:

a) Garbage Value b) Error


c) 25 d) None of these.
Q.23. Identify Error on compilation of the following code
fun(int a,int b)
{
int a;
a=20;
return a*b;
}

a) Missing Parentheses in the return statement.


b) The Function should be defined as int fun(int a,int b)
c) Redeclaration of a.
d) Both B and C

Q. 24. What is the correct output of the following program:


#include<stdio.h>
#include<string.h>
void main()
{
char str[]=”the\black\0\swan”;
printf(“%d %s”,strlen(str),str);
}

a) 12 thelackswan b) 8 thlack
c) 8 theblack d) 9 the\black

Q. 25. Which of the following function can be used to find the first occurance of a given
string in another string?

a) strchr()
b) strstr()
c) strnset()
d) strspn()

You might also like