1.What's the expected output for the following program and Why?
enum {false,true};
int main()
{
int i=1;
do
{
printf("%d
",i);
i++;
if(i < 15)
continue;
}While(false);
return 0;
}
2.The following C program segfaults of IA-64, but works fine on IA-32.
int main() { int* p; p = (int*)malloc(sizeof(int)); *p = 10; return 0; }
Why does it happen so?
3.I thought the following C program is perfectly valid (after reading about the comma operator in C). But there is a mistake in the following program, can
you identify it?
#include
int main()
{
int a = 1,2;
printf("a : %d",a);
return 0;
}
4.Explain the output of the following C program (No, the output is not 20).
#include
int main() { int a=1; switch(a) { int b=20; case 1: printf("b is %d
",b); break; default:printf("b is %d
",b); break; } return 0; }
Aptitude
1. Bus was travelling at distance of 60 mt before car in car 20 sec. car is ahead of bus by 40 mts . if car was traveling at speed of 30km/hr then wat is
speed of bus?
ANSWER is 20m/sec
2. Three men can dig 3 trenches in 5 days.then how many persons are required to dig five trenches in 5 days (working 8 hrs per day).
3. What is A.P.
4. The average of 6 numbers is 8. average of 8 numbers is 6. then wat is the average of the two numbers Which are added later to the series.
ANSWER: 0
5. 1.175*1.175+ 2345*14563/ 2345.87 ?
6. find value of x like: X* 25/89=45/87
7. In a km race, A beats B by 28 kms or 7 sec. find A's time over the course.
ANSWER: 4 min 3 sec