YCP’S AIT, Mumbai
Theory Examination Question Paper
For Pre-DAC June 2019 Batch
Module Name – Prog. In C
Date :18th Jun 2019 Duration : 45Min Max. Marks : 30
________________________________________________________________________________________________
1. What is the output of the following program: d) It interprets files at runtime
main()
{ 6. Identify the unconditional control structure-
int c= -- 2; a) do-while
printf(“c=%d”,c); b) switch-case
} c) goto
a) c=1 d) if
b) c=2
c) compiler error 7. int I; I=2; I++; if(I=4) { printf(“I=4”); } else {
d) linker error printf(“I=3”); } what is the output of the program?
a) I=4
2. What is a variable decleration? b) I=3
a) The assignment of properties to a variable c) Unpredictable
b) The assignment of memory space to a variable d) None
c) The assignment of properties and memory space to
a variable 8. main() { int i=0, j=0 ; for(j=1;j<10;j++) {i=i+1;}}
d) The assignment of properties and identification to a a) 1
variable b) 3
c) 9
3. What is the output of the following program: d) 10
main()
{ 9. int x=2,y=2, z=1;
unsigned int i; what is the value of x after the following statement?
for( i=1; i>-2;i--) If ( x=y%2) z+=10; else z+=20;
printf(“ C Aptitude”); a) 0
} b) 2
a) C Aptitude c) 1
b) No output d) none
c) Compiler error
d) Linker error 10. Pointer variable may be assigned
a) an address value represented in hexadecimal
4. Consider the following code: b) an address value represented in octal
f(unsigned int x, unsigned int y) c) the address of another variable
{ d) an address value represented in binary
while(x!=y)
{ 11. What is the output of the program?
if(x>y) x=x-y; main()
else y=y-x;} {
printf(“%d”,x); int rows=3 , colums=4;
} int a[rows][colums]={1,2,3,4,5,6,7,8,9,10,11,12};
what does the above code do? int i,j,k; for( i=0; i<rows; i++) for ( j=0; j<colums; j++)
a) Compute the GCD(greatest common divisor) of if ( a[i][j] <k) k=a[i][j]; printf(“%d\n”,k);
two number }
b) Divide the largest number by the smallest number
c) Compute the LCM of two number a) syntax error
d) None of the above b) runtime error
c) 1
5. What does invoking the C compiler accomplish? d) none of these
a) It links together object files.
b) It creates machine code. 12. char base[5]= “a”; const char *ptr;
c) It only provides code evaluation. You must use the given the above, which of the following statement is
linker to assemble and link program. legal?
TCM / F / 11 Rev. –00 Page 1 of 3
YCP’S AIT, Mumbai
a) ptr= base; }
b) *ptr=”a”; }
c) *ptr=base; a) 5 1,4 2,3 3,2 3,1 4
d) ptr=’a’; b) 4 0,3 0,2 0,1 0,0 0
c) 4 1,3 2,2 3,1 4,0 5
13. Identify the correct statement: d) None of these
a) A function can be defined more than once in a
program. 19. void main(){
b) Function definition cannot appear in any order. clrscr();
c) Function cannot be distributed in many files. printf(“%d”,sizeof(3.8));
d) Once function cannot be defined within another getch();
function definition. }
Which of the following is true?
14. Parameters are used a) 4
a) to return values from the called function b) 8
b) to send values from the calling function c) 10
c) options a and b d) Compiler error
d) to specify the data type of the return value e) None of these
15. What is the output of the following code: 20. void main(){
#include<stdio.h> int a=5;{
main() a++;
{ }
int a=5; clrscr();
printf(“%d%d%d%d%d”,a++,a--,++a,--a,a); printf("%d",a);
} getch();
a) 55665 }
b) 56655 Which of the following is true?
c) 45654 a) 5
d) 45545 b) 6
c) 7
16. What is the output of the following code? d) Compiler error
#include<stdio.h> e) None of these
void main()
{ 21. What is the output of the program given below
int arr[ ]={0,1,2,3,4,5,6}; #include<stdio.h>
int i,*ptr; main()
for(ptr = arr+4, i=0; i<=4; i++) {
printf(“\n%d”,ptr[-i]); char i=0;
} for(;i>=0;i++) ;
a) error printf(”%d\n”,i);
b) 65432 }
c) 0 garbage garbage garbage garbage a) Compile Time Error
d) 43210 b) –128
c) 0
[Link] does a preprocessor do? d) Runtime Error
a) Compiles a program e) None
b) It loads program into memory for execution
c) It links all the required modules and file to the 22. void main( ){
program int x=10, y=20;
d) It provides an expanded source to the compiler if(!(!x) && x)
printf(“x=%d”,x);
18. What is the output of the following code? else
#include<stdio.h> printf(“y=%d”,y);
void main() }
{ a) 10
int i=5,j=0; b) 20
while(i-- && ++ j) c) 1
{ d) 0
printf(“\n%d\t%d\n”, i , j );
TCM / F / 11 Rev. –00 Page 2 of 3
YCP’S AIT, Mumbai
e) e)Both can occur multiple times, but a definition
must occur first
23. void main( ){
int a=30, b=40, x; 27. int a=10,b;
x=(a!=10) && (b=50); b=a++ + ++a;
printf(“x= %d”,x); printf("%d,%d,%d,%d",b,a++,a,++a);
} what will be the output when following code is executed
a) 10 a) 12,10,11,13
b) 50 b) 22,10,11,13
c) 1 c) 22,11,11,11
d) 0 d) 12,11,11,11
e) 22,13,13,13
24. void main( ) {
int i=2; 28. String constants should be enclosed between ___
printf(“i-- = %d”, i--); a) Single quotes
} b) Double quotes
a) i-- = 2 c) Both a and b
b) i-- = 3 d) None of these
c) i-- = 1
d) none of the above 29. void main( ){
float x=12.25, y=13.65;
25. void main( ){ if(x=y)
static int c=5; printf(“x and y are equal”);
printf(“%d\t”,c--); else
if(c) printf(“x and y are not equal”);
main( ); }
} a) x and y are not equal
b) x and y are equal
a) 5 4 3 2 1 c) No output
b) 1 2 3 4 5
c) 5 4 3 3 3 30. void main( ) {
d) none of the above float y=0.9;
long double z= 0.9;
26. What is a difference between a declaration and a if(y = = z)
definition of a variable? printf(“hello world”);
a) Both can occur multiple times, but a declaration else
must occur first. printf(“hai world”);
b) There is no difference between them. }
c) A definition occurs once, but a declaration may a) hello world
occur many times. b) hai world
d) A declaration occurs once, but a definition may c) no output
occur many times.
TCM / F / 11 Rev. –00 Page 3 of 3