Dept. of Industrial Relations and Placements, Communication and soft skills Subject Name:- C Language 1) The Real constants in C can be expressed in which of the following forms a)Fractional form only b)Exponential form only c)ASCII form only d) a & b 2) The program, which translates high-level program into its equivalent machine language program, is called a)Transformer b)Language processor c)Converter d) none of the above 3) Consider the following statements. i)Multiplication associates left to right ii)Division associates left to right iii)Unary Minus associates right to left iv)subtraction associates left to right a)only i and ii are true b)all are false c)all are true d)only iii and iv are true 4) What will be the value of variable a in the following code? unsigned char a; a = 0xFF + 1; printf("%d", a); a)0xFF b)0x100 c)0 d)0*0 5) What is the output of the following program? #include <stdio.h> void main() { printf("\n10!=9 : %5d",10!=9); } a) 10 b) Error c) None of the above 6) What is the output of the following program? #include<stdio.h> void main()
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Dept. of Industrial Relations and Placements, Communication and soft skills
Subject Name:- C Language
1) The Real constants in C can be expressed in which of the following formsa)Fractional form only b)Exponential form only c)ASCII form only d) a & b
2) The program, which translates high-level program into its equivalent machine language program, is calleda)Transformer b)Language processor c)Converter d) none of the above
3) Consider the following statements.
i)Multiplication associates left to right ii)Division associates left to rightiii)Unary Minus associates right to left iv)subtraction associates left to righta)only i and ii are true b)all are false c)all are true d)only iii and iv are true
4) What will be the value of variable a in the following code?unsigned char a;a = 0xFF + 1;printf("%d", a);a)0xFF b)0x100 c)0 d)0*0
5) What is the output of the following program?#include <stdio.h>void main(){printf("\n10!=9 : %5d",10!=9);}
a) 10b) Errorc) None of the above
6) What is the output of the following program? #include<stdio.h>void main(){int x=10;(x<0)?(int a =100):(int a =1000);printf(" %d",a);}
a)Error b)1000 c)100 d)None of these options
7) Which of the following shows the correct hierarchy of arithmetic operations in C(a), **, * or /, + or - (b), **, *, /, +, - (c), **, /, *, +, - (d), / or *, - or +
8) What is the output of the following code?#include<stdio.h>
13) What is the output of the following program code #include<stdio.h>void abc(int a[]){a++;a[1]=612;}main(){char a[5];abc(a);printf("%d",a[4]);}
a)100 b)612 c)Error d)None of these options
14) which of the following is true about recursive functioni). it is also called circular definitionii). it occurs when a function calls another function more than onceiii). it occurs when a statement within the function calls the function itself iv). a recursive function cannot have a return statement within it"a) i and iii b) i and ii c) ii and iv d)i, iii and iv
15) What will happen if you assign a value to an element of an array whose subscript exceeds the size of the array?a)The element will be set to 0 b)Nothing, its done all the timec)Other data may be overwritten d)Error message from the compiler
16) What is the output of the following code? #include<stdio.h>void main(){int arr[2][3][2]={{{2,4},{7,8},{3,4},}, {{2,2},{2,3},{3,4}, }}; printf("\n%d",**(*arr+1)+2+7);}a)16 b)7 c)11 d) Error
17) If int s[5] is a one dimensional array of integers, which of the following refers to the third element in the array?a)*( s + 2 ) b)*( s + 3 ) c)s + 3 d)s + 2
18) What is the output of the following code? void main(){int i = 100, j = 200;const int *p=&i;p = &j;printf("%d",*p);}a)100 b)200 c)300 d)None of the above
19) What is the output of the following code? #include<stdio.h>void main(){int arr[] = {10,20,30,40,50};int *ptr = arr;printf("\n %d\t%d\t",*ptr++,*ptr);}a)10 20 b)10 10 c)20 20 d)20 10
20) Which of these are reasons for using pointers?1.To manipulate parts of an array2.To refer to keywords such as for and if3.To return more than one value from a function 4.To refer to particular programs more convenientlya)1 & 3 b)Only 1 c)Only 3 d)All of the above
21) During initializing a uniona)Only one member can be initialised. b)All the members will be initialised.
C)Initialisation of a union is not possible. d)None of these options22) What would be the output of the following program?
33) What is the output of the codemain(){printf("%x",-1<<4);}
34) What is the output of the code main() { char string[]="Hello World"; display(string); } void display(char *string)
{ printf("%s",string); }
35) What is the output of the codemain(){int c=- -2;printf("c=%d",c);}
36) What is the output of the code#define int charmain(){int i=65;printf("sizeof(i)=%d",sizeof(i));}
37) What is the output of the codemain(){int i=10;i=!i>14;Printf ("i=%d",i);}
38) What is the output of the code #include<stdio.h>main(){int a[2][2][2] = { {10,2,3,4}, {5,6,7,8} };int *p,*q;p=&a[2][2][2];*q=***a;printf("%d----%d",*p,*q);}
39) What is the output of the codemain(){struct xx{int x=3;char name[]="hello";};struct xx *s;printf("%d",s->x);printf("%s",s->name);}
40) What is the output of the code#include<stdio.h>
main(){struct xx{int x;struct yy{char s;struct xx *p;};struct yy *q;};}
41) What is the output of the codemain(){int i=5;printf("%d%d%d%d%d%d",i++,i--,++i,--i,i);}
42) What is the output of the codemain(){char *p="hai friends",*p1;p1=p;while(*p!='\0') ++*p++;printf("%s %s",p,p1);}
43) What is the output of the code#define clrscr() 100main(){clrscr();printf("%d\n",clrscr());}
44) What is the output of the codevoid main(){char far *farther,*farthest;printf("%d..%d",sizeof(farther),sizeof(farthest));}
45) What is the output of the codemain(){
int i=400,j=300;printf("%d..%d");}
46) What is the output of the code
main(){char *p;p="Hello";printf("%c\n",*&*p);}
47) ) What is the output of the codemain(){int i=1;while (i<=5){printf("%d",i);if (i>2)goto here;i++;}}fun(){here:printf("PP");}