Professional Documents
Culture Documents
pre dac paper
pre dac paper
Pre-DAC
Module Name – Prog. In C
Duration : 45Min Max. Marks : 30
1. What is the output of the following program: c) It only provides code evaluation. You must use the
main() linker to assemble and link program.
{ d) It interprets files at runtime
int c= -- 2;
printf(“c=%d”,c); 6. Identify the unconditional control structure-
} a) do-while
a) c=1 b) switch-case
b) c=2 c) goto
c) compiler error d) if
d) linker error
7. int I; I=2; I++; if(I=4) { printf(“I=4”); } else
2. What is a variable decleration? { printf(“I=3”); } what is the output of the
a) The assignment of properties to a variable program?
b) The assignment of memory space to a variable a) I=4
c) The assignment of properties and memory space to b) I=3
a variable c) Unpredictable
d) The assignment of properties and identification to a d) None
variable
8. main() { int i=0, j=0 ; for(j=1;j<10;j++) {i=i+1;}}
3. What is the output of the following program: a) 1
main() b) 3
{ c) 9
unsigned int i; d) 10
for( i=1; i>-2;i--)
printf(“ C Aptitude”); 9. int x=2,y=2, z=1;
} what is the value of x after the following statement?
a) C Aptitude If ( x=y%2) z+=10; else z+=20;
b) No output a) 0
c) Compiler error b) 2
d) Linker error c) 1
d) none
4. Consider the following code:
f(unsigned int x, unsigned int y) 10. Pointer variable may be assigned
{ a) an address value represented in hexadecimal
while(x!=y) b) an address value represented in octal
{ c) the address of another variable
if(x>y) x=x-y; d) an address value represented in binary
else y=y-x;}
printf(“%d”,x); 11. What is the output of the program?
} main()
what does the above code do? {
a) Compute the GCD(greatest common divisor) of int rows=3 , colums=4;
two number int a[rows][colums]={1,2,3,4,5,6,7,8,9,10,11,12};
b) Divide the largest number by the smallest number int i,j,k; for( i=0; i<rows; i++) for ( j=0; j<colums; j++)
c) Compute the LCM of two number if ( a[i][j] <k) k=a[i][j]; printf(“%d\n”,k);
d) None of the above }
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
17.What 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