Вы находитесь на странице: 1из 8

ADITI

SECTION 3: C TEST
NOTE: The questions are of multiple choice format in the paper
1. What is the output of the program given below
#include<stdio.h>
main()
{
char i=0;
for(;i>=0;i++) ;
printf("%d\n",i);
}
ans: -128
2. What is the output of the following program
#include<stdio.h>
main()
{
int i=0;
fork();
printf("%d",i++);
fork();
printf("%d",i++);
fork();
wait();
}

3. What is the memory allocated by the following definition ?


int (*x)[10];

4. What is the memory allocated by the following definition ?


int (*x)();

5. In the following program segment


#include<stdio.h>
main()
{
int a=2;
int b=9;
int c=1;
while(b)
{
if(odd(b))
c=c*a;
a=a*a;
b=b/2;
}
printf("%d\n",c);
}
How many times is c=c*a calculated?
Ans=2

6. In the program segment in question 5 what is the value of a at the end of the
while loop?
Ans :256*256
7. What is the output for the program given below
typedef enum grade{GOOD,BAD,WORST,}BAD;
main()
{
BAD g1;
g1=1;
printf("%d",g1);
}

8. Give the output for the following program.


#define STYLE1 char
main()
{
typedef char STYLE2;
STYLE1 x;
STYLE2 y;
clrscr();
x=255;
y=255;
printf("%d %d\n",x,y);
} ans= -1 -1

9. Give the output for the following program segment.


#ifdef TRUE
int I=0;
#endif
main()
{
int j=0;
printf("%d %d\n",i,j);
}

10. In the following program


#include<stdio.h>
main()
{
char *pDestn,*pSource="I Love You Daddy";
pDestn=malloc(strlen(pSource));
strcpy(pDestn,pSource);
printf("%s",pDestn);
free(pDestn);
}
(a)Free() fails
(b)Strcpy() fails

(c)prints I love You Daddy


(d)error

11. What is the output for the following program


#include<stdio.h>
main()
{
char a[5][5],flag;
a[0][0]='A';
flag=((a==*a)&&(*a==a[0]));
printf("%d\n",flag);
}

AXES TECHNOLOGY
20. Find the output of the following program
int *p,*q;
p=(int *)1000;
q=(int *)2000;
printf("%d",(q-p));
Ans: 500

21. What does the statement int(*x[])() indicate?

22. Which addressing mode is used in the following statements:


(a) MVI B,55
(b) MOV B,A
(c) MOV M,A
Ans. (a) Immediate addressing mode.
(b) Register Addressing Mode
(c) Direct addressing mode

25. What does the file stdio.h contain?


a) functin definition
b) function decleration
c) both func. defn & func. decleration.

26. sscanf is used for ?

27. Memory. Management in Operating Systems is done by


a) Memory Management Unit
b) Memory management software of the Operating System
c) Kernel
Ans: (b)

28. What does the statement strcat(S2,S1) do?


32. What is done for a Push opertion?
Ans: SP is decremented and then the value is stored.

33. Describe the following structures as LIFO/FILO/FIFO/LILO


(a) Stack
(b) Queue
AZTEC

C programs are asked in this section


1.Write a program to insert a node in a sorted linked list.
2.Write a program to implement the Fibonacci series.
3.Write a program to concatenate two circular linked lists into a single circular list.
4.A function even_odd_difference()passes the array of elements.Write a program
to calculate the
difference of the two sums of

which one sum adds the elements of odd ones and another adds the elments of
even ones.
5.Write a program to reverse a linked list.

Section C
Questions on C++ are asked here
Base class has some virtual method and derived
class has a method with the same name. If we initialize the base class pointer
with derived
object,.calling of that virtual method will result in which method being called?
a. Base method
b. Derived method..
Ans. b
Almost all questions are of this kind. Go through virtual functions concepts in C++
and how the
pointers to functions would be
handled.

Вам также может понравиться