Академический Документы
Профессиональный Документы
Культура Документы
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();
}
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);
}
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
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.