C++ Interview Questions
- 0of 0 votes
AnswersWrite a C++ Program to Find the Number of Digits in a number.
- hr@ziitech.com April 08, 2022 in India| Report Duplicate | Flag | PURGE
Ziisoft Nano Technologies Software Developer C++ - 0of 0 votes
AnswersWrite a C++ Program to find Factorial of a Number using recursion.
- hr@ziitech.com April 08, 2022 in India| Report Duplicate | Flag | PURGE
Ziisoft Nano Technologies Software Developer C++ - 0of 0 votes
AnswersWrite a C++ Program to find Addition of Two Numbers.
- hr@ziitech.com April 08, 2022 in India| Report Duplicate | Flag | PURGE
Ziisoft Nano Technologies Software Developer C++ - 0of 0 votes
AnswersWrite a C++ Program to find Factorial of a Number using for loop.
- hr@ziitech.com April 08, 2022 in India| Report Duplicate | Flag | PURGE
Ziisoft Nano Technologies Software Developer C++ - 0of 0 votes
AnswersWhat will be the output of the following program?
- hr@ziitech.com April 08, 2022 in India
#include<iostream.h>
class TestDrive
{
int x;
public:
TestDrive(int xx)
{
x = xx;
}
int DriveIt(void);
};
int TestDrive::DriveIt(void)
{
static int value = 0;
int m;
m = x % 2;
x = x / 2;
if((x / 2)) DriveIt();
value = value + m * 10;
return value;
}
int main()
{
TestDrive TD(1234);
cout<< TD.DriveIt() * 10 << endl;
return 0;
}| Report Duplicate | Flag | PURGE
Ziisoft Nano Technologies Software Developer C++ - 0of 0 votes
AnswersWhat will be the output of the following program?
- hr@ziitech.com April 08, 2022 in India
#include<iostream.h>
class IndiaBix
{
int K;
public:
void BixFunction(float, int , char);
void BixFunction(float, char, char);
};
int main()
{
IndiaBix objIB;
objIB.BixFunction(15.09, ‘A’, char(‘A’ + ‘A’));
return 0;
}
void IndiaBix::BixFunction(float, char y, char z)
{
K = int(z);
K = int(y);
K = y + z;
cout<< “K = “ << K << endl;
}| Report Duplicate | Flag | PURGE
Ziisoft Nano Technologies Software Developer C++ - 0of 0 votes
AnswersWhat will be the output of the following program?
- hr@ziitech.com April 08, 2022 in India
#include<iostream.h>
class Bix
{
int x, y;
public:
void show(void);
void main(void);
};
void Bix::show(void)
{
Bix b;
b.x = 2;
b.y = 4;
cout<< x << " " << y;
}
void Bix::main(void)
{
Bix b;
b.x = 6;
b.y = 8;
b.show();
}
int main(int argc, char *argv[])
{
Bix run;
run.main();
return 0;
}| Report Duplicate | Flag | PURGE
Ziisoft Nano Technologies Software Developer C++ - 0of 0 votes
AnswerWhat will be the output of the following program?
- hr@ziitech.com April 08, 2022 in India
#include<iostream.h>
int main()
{
float Amount;
float Calculate(float P = 5.0, int N = 2, float R = 2.0);
Amount = Calculate();
cout<< Amount << endl;
return 0;
}
float Calculate(float P, int N, float R)
{
int Year = 1;
float Sum = 1 ;
Sum = Sum * (1 + P * ++N * R);
Year = (int)(Year + Sum);
return Year;
}| Report Duplicate | Flag | PURGE
Ziisoft Nano Technologies Software Developer C++ - 0of 0 votes
AnswersWhat will be the output of the following program?
- hr@ziitech.com April 08, 2022 in India
#include<iostream.h>
class IndiabixSample
{
public:
int a;
float b;
void BixFunction(int a, float b, float c = 100.0f)
{
cout<< a % 20 + c * --b;
}
};
int main()
{ IndiabixSample objBix;
objBix.BixFunction(20, 2.000000f, 5.0f);
return 0;
}| Report Duplicate | Flag | PURGE
Ziisoft Nano Technologies Software Developer C++ - 0of 0 votes
AnswersWrite a program to print out all Armstrong numbers between 1 and 500. If sum of cubes of each digit of the number is equal to the number itself, then the number is called an Armstrong number.
- hr@ziitech.com April 08, 2022 in India
For example, 153 = ( 1 * 1 * 1 ) + ( 5 * 5 * 5 ) + ( 3 * 3 * 3 )| Report Duplicate | Flag | PURGE
Ziisoft Nano Technologies Software Developer C++ - 0of 0 votes
AnswersWrite a program to calculate HCF of Two given number
- hr@ziitech.com April 08, 2022 in India| Report Duplicate | Flag | PURGE
Ziisoft Nano Technologies Software Developer C++ - 0of 0 votes
AnswersWrite a program to check given number is prime or not
- hr@ziitech.com April 08, 2022 in India| Report Duplicate | Flag | PURGE
Ziisoft Nano Technologies Software Developer C++ - 0of 0 votes
AnswerWrite a program to sum of digits of given integer number
- hr@ziitech.com April 08, 2022 in India| Report Duplicate | Flag | PURGE
Ziisoft Nano Technologies Software Developer C++ - 0of 0 votes
AnswersWrite a program to reveres any given integer number
- hr@ziitech.com April 08, 2022 in India| Report Duplicate | Flag | PURGE
Ziisoft Nano Technologies Software Developer C++ - 0of 0 votes
AnswersWrite a program to calculate the sum of first 10 natural number.
- hr@ziitech.com April 08, 2022 in India| Report Duplicate | Flag | PURGE
Ziisoft Nano Technologies Software Developer C++ - 0of 0 votes
AnswersWrite a program to print number from 1 to 10.
- hr@ziitech.com April 08, 2022 in India| Report Duplicate | Flag | PURGE
Ziisoft Nano Technologies Software Developer C++ - 0of 0 votes
Answers3. What will be the output of the following program?
- hrziisoft April 01, 2022 in India
#include<iostream.h>
double BixFunction(double, double, double = 0, double = 0, double = 0);
int main()
{
double d = 2.3;
cout<< BixFunction(d, 7) << " ";
cout<< BixFunction(d, 7, 6) << endl;
return 0;
}
double BixFunction(double x, double p, double q, double r, double s)
{
return p +(q +(r + s * x)* x) * x;
}| Report Duplicate | Flag | PURGE
Ziisoft Nano Technologies Software Developer C++ - 0of 0 votes
Answers2. What will be the output of the following program?
- hrziisoft April 01, 2022 in India
#include<iostream.h>
void MyFunction(int a, int b = 40)
{
cout<< " a = "<< a << " b = " << b << endl;
}
int main()
{
MyFunction(20, 30);
return 0;
}| Report Duplicate | Flag | PURGE
Ziisoft Nano Technologies Software Developer C++ - 0of 0 votes
Answers1. What will be the output of the following program?
- hrziisoft April 01, 2022 in India
#include<iostream.h>
int BixFunction(int a, int b = 3, int c = 3)
{
cout<< ++a * ++b * --c ;
return 0;
}
int main()
{
BixFunction(5, 0, 0);
return 0;
}| Report Duplicate | Flag | PURGE
Ziisoft Nano Technologies Software Developer C++ - 1of 1 vote
Answers. What is scope resolution operator in C++?
- hr@izetam.com February 02, 2022 in United States
Scope resolution operator in c++ is denoted by double colon (::). It can be used:
– when there is a local variable with same name as of global variable
– When a function has to be defined outside a class
– When class’s static variables needs to be accessed
– When a class inside another class has to be referred
– In case of multiple Inheritance| Report Duplicate | Flag | PURGE
C++ - 0of 0 votes
AnswersWhat is an expression in C++?
- hr@izetam.com February 02, 2022 in United States
An expression is a combination of operators, constants and variables. There seven types of expressions for examples:
– Constant expressions: 89 +10/4.0
– Integral expressions: x * y
– Floating expressions: 17.89
– Relational expressions: a<=b
– Logical expressions: a > b && a == 7
– Pointer expressions: *ptr
– Bitwise expressions: p << 5| Report Duplicate | Flag | PURGE
C++ - 0of 0 votes
AnswersWhat is a reference variable in C++?
- hr@izetam.com February 02, 2022 in United States
When a variable is declared as a reference, it becomes an alternative name for an existing variable. A variable can be declared as a reference by putting ‘&’ in the declaration.| Report Duplicate | Flag | PURGE
C++ - 0of 0 votes
AnswersWhat is conio.h in C++?
- hr@izetam.com February 02, 2022 in United States
Conio.h is a header file used for console input and output operations and is used for creating text based user interfaces.| Report Duplicate | Flag | PURGE
C++ - 0of 0 votes
AnswersHow to set decimal places in C++ ?
- hr@izetam.com February 02, 2022 in United States
For limiting the decimal places in C++ there are five functions : floor(), ceil(), trunc(), round() and setprecision(). Out of these five, only setprecision() function is used for setting the decimal places to put as output| Report Duplicate | Flag | PURGE
C++ - 0of 0 votes
AnswersWhat is type casting in C++?
- hr@izetam.com February 02, 2022 in United States
Type casting in C is used to change the data type. They are of two types: Implicit Type Conversion: It is automatic. Explicit Type Conversion: It is user-defined.| Report Duplicate | Flag | PURGE
C++ - 0of 0 votes
AnswersHow to paste in turbo C++?
- hr@izetam.com February 02, 2022 in United States
Paste in turbo C++ can be done by two techniques:
1. Shift+Insert
2. Open the file in notepad with .cpp extension. Make the changes and save it. After saving the file, you can open it from the Turbo C++ application file menu from where you stored the cpp file.| Report Duplicate | Flag | PURGE
C++ - 0of 0 votes
AnswersWhat is a class template?
- hr@izetam.com February 02, 2022 in United States
A class template is used to create a family of classes and functions. For example, we can create a template of an array class which will enable us to create an array of various types such as int, float, char, etc. Similarly, we can create a template for a function, suppose we have a function add(), then we can create multiple versions of add().| Report Duplicate | Flag | PURGE
C++