Technical Test based on C/C++

01. What is the output of the following program?

void main()

{

int x = 10;

printf ("%d %d", ++x, ++x);

}


02. What is the output of the following program if its command line arguments were . . . sample 1 5 7

main(int argc, char *argv[])

{

int x;

x = argv[1] + argv[2] + argv[3];

printf ("%d", x);

}


03 . What is the output of the following program?

main()

{

struct emp

{

char name[20];

int empno;

};

struct emp e1 = {"harrypotter", 1311};

struct emp e2 = e1;

if (e1==e2)

printf ("e1 and e2 are same");

else

printf ("e1 and e2 are different");

}


04. What is the output of the following program?

void main()

{

int a = -3, b = 2, c= 0, d;

d = ++a && ++b || ++c;

printf ("a = %d, b = %d, c = %d, d = %d", a, b, c, d);

}


05. What is the output of the following program?

main()

{

printf ("Hermione" "Granger");

}


Which statement gets affected when i++ is changed to ++i?


The operator that cannot be overloaded is


Q : What will be the result of this given statement.

for (; ;)


Identify the operator that is NOT used with pointers


Consider the following statements

char *ptr;

ptr = “hello”;

cout << *ptr;

What will be printed?


Given a class named Book, which of the following is not a valid constructor?


Consider the following statements:

int x = 22,y=15;

x = (x>y) ? (x+y) : (x-y);

What will be the value of x after executing these statements?


What is the output of given code fragment?

int f=1, i=2;

while(++i<5)

f*=i;

cout<<f;


What will be the values of x, m and n after the execution of the following statements?

int x, m, n;

m = 10;

n = 15;

x = ++m + n++;


Which of the following will produce a value 10 if x = 9.7?


Consider the following class definitions:

class a

{

};

class b: protected a

{

};

What happens when we try to compile this class?


Which of the following expressions is illegal?


What would be the output of the following program?

int main()

{

int x,y=10,z=10;

x = (y = =z);

cout<<x;

return 0;

}


What will be the output of following program?

#include<iostream.h>

void main()

{

float x;

x=(float)9/2;

cout<<x;

}


What would be the output of the following?

#include<iostream.h>

void main()

{

char *ptr=“abcd”

char ch;

ch = ++*ptr++;

cout<<ch;

}


What will be the result of the expression 13 & 25?


What will be the output of the following program?

#include<iostream.h>

void main()

{

float x=5,y=2;

int result;

result=x % y;

cout<<result;

}


RunTime Polymorphism is achieved by ______


You can read input that consists of multiple lines of text using


Pure virtual functions


Use of virtual functions implies


















































































































































































Description:

The test will include C/C++ questions.
also Some GK questions about computers are included in test.
there will be 15 questions.
There will be no Negative marking.
The timing of test will be 15 minutes.
One question will be of 1 mark.

ok

best of luck









Discussion

Huang Qi

Question 17 answer should be option 1.

1723 days 18 hours 42 minutes ago

Huang Qi

Question 11 answer should be option 1.

1723 days 18 hours 43 minutes ago

Huang Qi

Question 6 answers should be option 3 and 4.

1723 days 18 hours 44 minutes ago

Huang Qi

Question 6 answers are option 3 and 4.

1723 days 18 hours 44 minutes ago

Raj Kamal Ghosh

qs 1 is wrong answer.

2300 days 3 hours 34 minutes ago

jasleen Kaur
Jasleen Kaur@IET Bhaddal Technical Campus,Ropar
13 Followers
Tests: 5

Your Facebook Friends on WizIQ

More Tests By Author

Aptitude Test
15 Questions | 521 Attempts

Lets GUESS Something
15 Questions | 127 Attempts

Technical test - Operating system
15 Questions | 4723 Attempts