0% found this document useful (0 votes)
135 views

Rainbow: C/C++ Screening Test

This document contains a 20 question multiple choice test on C/C++ programming concepts. The questions cover topics like operators, loops, functions, macros, data types, and more. Sample code snippets are provided with each question to test understanding of language syntax and behavior.

Uploaded by

Martand Singh
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
135 views

Rainbow: C/C++ Screening Test

This document contains a 20 question multiple choice test on C/C++ programming concepts. The questions cover topics like operators, loops, functions, macros, data types, and more. Sample code snippets are provided with each question to test understanding of language syntax and behavior.

Uploaded by

Martand Singh
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 4

RAINBOW C/C++ Screen Test Paper

RAINBOW
C/C++ Screening Test
1. int main()
{
int i=10;
int j=20;
int k=5;
int m= I < j < k; // k < I < j; // j < k < i; any combination (write one condition
for exam)
printf(“%d” ,m);
return 0;
}

a. 0 b. 1 c. syntax error d. Runtime error

2. int main()
{
printf(“%d”);
return 0;
}

a. 0 b. 1 c. garbage d. error

3. #define x 2+3
void main()
{
printf(“%d”,x*x);
}

a. 25 b. 11 c. error d. none of these

4. int main()
{
int a[5]={5,1,15,20,25};
int i,j,m;
i=++a[1];
j=a[1]++;
m=a[i++];
printf(“\n%d %d %d”,i,j,m);
return 0;
}

a. error b. 2 2 20 c. 3 2 15 d. 5 2 15

Page 1
RAINBOW C/C++ Screen Test Paper
5. void main()
{
Int a=5,b=2;
printf(“%d”,a+++b);
}

a. 8 b. 7 c. syntax error d. runtime error

6. main()
{
float a=.5,b=.7;
if(b < .7)
if(a < .5)
printf(“TELO”);
else
printf(“LTTE”);
else
printf(“JKLF”);
}

a. TELO b. LTTE c. JKLF d. ERROR

7. The rule of implicit type conversion is


a) int < unsigned < float < double
b) unsigned < int < float < double
c) int < unsigned < double < float
d) unsigned < int < double < float

8. The for loop


for(i=0;i<10;++i)
printf(“%d”, i & 1);
Output :
a) 0101010101 b) 0111111111 c) 0000000000 d) 1111111111

9. main()
{
enum enu
{
Mon,Tue,Wed=1,Thu,Fri=5,Sat,Sun
};
clrscr();
printf("%d%d%d%d%d%d%d",Mon,Tue,Wed,Thu,Fri,Sat,Sun);

a) Error b) 0123456 c) 0112567 d) 0112534

Page 2
RAINBOW C/C++ Screen Test Paper
10. main()
{
printf(“%d”,main);
}

a. Sysntax error b. Logical error


c. address of main function d. continuous to infinite

11. Cosider the following statement .


#define hypotenuse(a,b) sqrt(a * a + b * b);
The macro-call hypotenuse(a + 2, b + 3) is equal to:-
a) Find the hypotenuse of a triangle with sides a + 2 and b + 3
b) Find the square root of (a + b)2 + ( b + 3)2
c) is invalid
d) find the square root of 3 * a + 4 * b + 5

12. The statement printf(“%d”,sizeof(“ ”)); prints


a) 1 b) 0 c) garbage d) 2

13. main()
{
int i=5;
printf(“%d””,++i/i++);
}
a. 0 b. 1 c. error d. none of these

Consider the declaration for 14 and 15


int a=5, *b=&a;
14. The Statement
printf(“%d”,a*b);
prints:-

a) 25 b) garbage c) 5 * address of b d) an error message

15. The Statement


printf(“%d”,a**b);
prints:-

a) 25 b) garbage c) 5 * address of b d) an error message

16.
If(_____)
printf(“2011”);
else
printf(“ Rainbow“);

We Want Output as Rainbow 2011, Fill the blank condition in if statement.

Page 3
RAINBOW C/C++ Screen Test Paper
17. mian()
{
int i=5;
change(i);
printf(“%d”,i);
}
change(i)
int i;
{
printf(“%d”,++i);
}

Outputs
a) 66 b) 56 c) 65 d) 55

18. What is equle to x%y :-


a) (y-(x/y)*x) b) (x-(x/y)*y) c) (x/(x-y)*y) d) None of the above

19. main()
{
static int i=5;
printf(“%d”,i--);
if(i)
main();
}
a) syntax error b) program doesn’t terminate c) 5 4 3 2 1 d) none of these

20. void main()


{
int a=10,b;
b=a++>10;
printf(“%d %d”,a,b);
}

a. 11 0 b. 11 1 c. error d. none of these

Page 4

You might also like