How many sequence of statements are present in c++?
AnswerWhat is the output of this program?
#include <iostream>
using namespace std;
main()
{
double a = 21.09399;
float b = 10.20;
int c ,d;
c = (int) a;
d = (int) b;
cout << c <<' '<< d;
return 0;
}
Answer
What is the output of this program?
#include <iostream>
using namespace std;
int main()
{
int a = 5, b = 6, c;
c = (a > b) ? a : b;
cout << c;
return 0;
}
Answer
What is the output of this program?
#include <iostream>
using namespace std;
int main ()
{
int x, y;
x = 5;
y = ++x * ++x;
cout << x << y;
x = 5;
y = x++ * ++x;
cout << x << y;
return 0;
}
Answer
What is the output of this program?
#include <iostream>
using namespace std;
int main()
{
int i, j;
j = 10;
i = (j++, j + 100, 999 + j);
cout << i;
return 0;
}
Answer
What is the output of this program?
#include <iostream>
using namespace std;
int main()
{
int a = 5, b = 6, c, d;
c = a, b;
d = (a, b);
cout << c << ' ' << d;
return 0;
}
Answer
What is the use of dynamic_cast operator?
AnswerWhat is the output of this program?
#include <iostream>
using namespace std;
int main()
{
int a;
a = 5 + 3 * 5;
cout << a;
return 0;
}
Answer
What is this operator called ?: ?
AnswerWhich operator is having the highest precedence?
AnswerWhich operator is having right to left associativity in the following?
AnswerWhich of the following accesses a variable in structure *b?
AnswerWhich of the following is a properly defined structure?
AnswerWhat is the output of this program?
#include <iostream>
using namespace std;
struct sec {
int a;
char b;
};
int main()
{
struct sec s ={25,50};
struct sec *ps =(struct sec *)&s;
cout << ps->a << ps->b;
return 0;
}
Answer
What will be the output of this program?
#include <iostream>
using namespace std;
int main()
{
struct ShoeType {
string style;
double price;
};
ShoeType shoe1, shoe2;
shoe1.style = "Adidas";
shoe1.price = 9.99;
cout << shoe1.style << " $ "<< shoe1.price;
shoe2 = shoe1;
shoe2.price = shoe2.price / 9;
cout << shoe2.style << " $ "<< shoe2.price;
return 0;
}
Answer
What is the output of this program?
#include <iostream>
using namespace std;
struct Time {
int hours;
int minutes;
int seconds;
};
int toSeconds(Time now);
int main()
{
Time t;
t.hours = 5;
t.minutes = 30;
t.seconds = 45;
cout << "Total seconds: " << toSeconds(t) << endl;
return 0;
}
int toSeconds(Time now)
{
return 3600 * now.hours + 60 * now.minutes + now.seconds;
}
Answer
What is the output of this program?
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
struct student {
int num;
char name[25];
};
student stu;
stu.num = 123;
strcpy(stu.name, "John");
cout << stu.num << endl;
cout << stu.name << endl;
return 0;
}
Answer
The declaration of structure is also called as?
AnswerWhat will happen when the structure is declared?
AnswerWhat will be used when terminating a structure?
Answer© 2017 QuizBucket.org