**Test on C++ Placement Technical Question Answers**

C++ Programming questions and answers with explanation for interview, competitive examination and entrance test. Prepare for your next C++ interview by reviewing the top 40 C++ coding interview questions and answers.

**What will be the output of the following C code?**

#include <stdio.h>

void m(int *p, int *q)

{

int temp = *p;

*p = *q;

*q = temp;

}

void main()

{

int a = 6, b = 5;

m(&a, &b);

printf("%d %d\n", a, b);

}

*

**Choose a correct statement about a C Switch Construct. ***

A jar was full of honey A person used to draw out 20% of the honey from the jar and replaced it with a sugar solution He repeated the same process 4 times and thus there was only 512 gm of honey left in the jar, the rest part of the jar was filled with the sugar solution The initial amount of honey in the jar was filled with the sugar solution The initial amount of honey in the jar was: *

Two pipes A and B can fill a tank in 15 minutes and 20 minutes respectively Both the pipes are opened together but after 4 minutes, pipe A is turned off What is the total time required to fill the tank? *

C language was invented in which laboratories.? *

Every C Variable must have.? *

Identify the wrong C Keywords below. *

What will be the output of the following C code?

#include <stdio.h>

void m(int p, int q)

{

int temp = p;

p = q;

q = temp;

}

void main()

{

int a = 6, b = 5;

m(a, b);

printf("%d %d\n", a, b);

}

*

#include <stdio.h>

void m(int p, int q)

{

int temp = p;

p = q;

q = temp;

}

void main()

{

int a = 6, b = 5;

m(a, b);

printf("%d %d\n", a, b);

}

*

If you do not specify a storage class for a Variable.? *

Left most bit 0 in Singed representation indicates.? *

In a pot, there is a mixture of milk and water in the ratio 4 : 5 If it is filled with an additional 8 liters of milk, the pot would be full and ratio of milk and water would become 6 : 5 Find the capacity of the pot ? *

A bag contains 6 white and 4 black balls .2 balls are drawn at random Find the probability that they are of same color. *

A grocer has a sale of Rs 6435, Rs 6927, Rs 6855, Rs 7230, and Rs 6562 for 5 consecutive months How much sale must he have in the sixth month so that he gets an average sale of Rs, 6500? *

A problem is given to three students whose chances of solving it are 1/2, 1/3, and 1/4 respectively What is the probability that the problem will be solved? *

Find the odd man out 6, 9, 15, 21, 24, 28, 30 *

The average of runs of a cricket player of 10 innings was 32 How many runs must he make in his next innings so as to increase his average of runs by 4 ? *

The range of float variable is.? *

**A can contains a mixture of two liquids A and B in the ratio 7 : 5 When 9 liters of mixture are drawn off and the can is filled with B, the ratio of A and B becomes 7 : 9 How many liters of liquid A were contained by the can initially?***

**Two consecutive discounts x% and y% is equivalent to the discount***

**Single Line Comment // is also called.?**

*****

**Choose a correct statement.**

*****

**What is the Bitwise operator used to set a particular bit to Zero 0.?***

**Tickets numbered 1 to 20 are mixed up and then a ticket is drawn at random What is the probability that the ticket drawn has a number which is a multiple of 3 or 5?***

**In 10 years, A will be twice as old as B was 10 years ago If A is now 9 years older than B, the present age of B is?***

**A tap can fill a tank in 6 hours After half the tank is filled, three more similar taps are opened What is the total time taken to fill the tank completely?**

*****

**What will be the output of the following C code?**

#include <stdio.h>

int x = 0;

void main()

{

int *ptr = &x;

printf("%p\n", ptr);

x++;

printf("%p\n ", ptr);

} *

**What will be the output of the following C code?**

#include <stdio.h>

void main()

{

int x = 0;

int *ptr = &x;

printf("%d\n", *ptr);

}

*

**Which among the following is a Local Variable.?**

*****

**What will be the output of the following C code?**

#include <stdio.h>

void main()

{

int x = 0;

int *ptr = &x;

printf("%d\n", *ptr);

}

*

**C Language is a successor to which language.?***

**A water tank is two-fifths full Pipe A can fill a tank in 10 minutes and pipe B can empty it in 6 minutes If both the pipes are open, how long will it take to empty or fill the tank completely?***

**The range of float variable is.?***

**The true discount on a bill of Rs 2160 is Rs 360 What is the banker's discount?***

**Range of signed char and unsigned char are.?**

*****

**A bag contains 4 white, 5 red, and 6 blue balls Three balls are drawn at random from the bag The probability that all of them are red, is:***

**What will be the output of the following C code?**

#include <stdio.h>

int x = 0;

void main()

{

int *const ptr = &x;

printf("%p\n", ptr);

ptr++;

printf("%p\n ", ptr);

} *

**What will be the output of the following C code?. #include <stdio.h>. void m(int p, int q).**{. printf("%d %d\n", p, q);. }. void main(). {. int a = 6, b = 5;. m(a);. }. *