Question 1 of 25
Hints left: 3
Q1
Which is used to return the number of characters in the string?
Q2
What does a mutable member of a class mean?
Q3
What will be the output of the following C++ code? #include <stdio.h> #include<iostream> using namespace std; int main() { int x = 5, y = 5, z; x = ++x; y = --y; z = x++ + y--; cout << z; return 0; }
Q4
Pick the incorrect statement about Character-Array.
Q5
What does the data type defined by union will do?
Q6
What will be the output of the following C++ code? #include <iostream> #include <string> #include <cstring> using namespace std; int main() { string s('a'); cout<<s; return 0; }
Q7
What will be the output of the following C++ code? #include <iostream> using namespace std; int main() { int a = 0; int b = 10; if ( a && b ) { cout << "true"<< endl ; } else { cout << "false"<< endl ; } return 0; }
Q8
What does a class in C++ holds?
Q9
Which operator works only with integer variables?
Q10
In which direction does the assignment operation will take place?
Q11
What will be the output of the following C++ code? #include <stdio.h> #include<iostream> using namespace std; int main() { int num1 = 5; int num2 = 3; int num3 = 2; num1 = num2++; num2 = --num3; cout << num1 << num2 << num3; return 0; }
Q12
Why we use the "dynamic_cast" type conversion?
Q13
Pick the correct statement about string objects in C++.
Q14
Which of the following is correct way of concatenating two string objects in C++? way 1: string s1 = "hello"; string s2 = "world"; string s3 = s1 + s2; way 2: string s1 = "hello"; string s2 = "world"; string s3 = s1.append(s2); way 3: string s1 = "hello"; string s2 = "world"; string s3 = strcat(s1,s2);
Q15
In the case of friend operator overloaded functions how many maximum object arguments a binary operator overloaded function can take?
Q16
What will be the output of the following C++ code? #include <iostream> #include <string> using namespace std; int main(int argc, char const *argv[]) { string str; cin>>str; cout<<str; return 0; }
Q17
Which category of data type a class belongs to?
Q18
What is the name of | operator?
Q19
What will be the output of the following C++ code? #include <iostream> #include <string> using namespace std; class test { public: operator string () { return "Converted"; } }; int main() { test t; string s = t; cout << s << endl; return 0; }
Q20
What will be the output of the following C++ code? #include <iostream> using namespace std; class sample { private: int a, b; public: void test() { a = 100; b = 200; } friend int compute(sample e1); }; int compute(sample e1) { return int(e1.a + e1.b) - 5; } int main() { sample e; e.test(); cout << compute(e); return 0; }
Q21
What is the size of the heap?
Q22
What will be the output of the following C++ code? #include <iostream> #include <string> using namespace std; int main () { string str ("helloworld."); cout << str.substr(3).substr(4) << endl; return 0; }
Q23
What will be the output of the following C++ code? #include <iostream> #include <string> using namespace std; int main(int argc, char const *argv[]) { char str[] = "Hello World"; cout<<str[0]; return 0; }
Q24
What happens when objects s1 and s2 are added? string s1 = "Hello"; string s2 = "World"; string s3 = (s1+s2).substr(5);
Q25
What will be the output of the following C++ code? #include <iostream> #include <string> using namespace std; class A { mutable int a; public: int assign(int i) const { a = i; } int return_value() const { return a; } }; int main(int argc, char const *argv[]) { A obj; obj.assign(5); cout<<obj.return_value(); }