ExamVeda
Login
Home
51
How many types of representation are in the string?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
52
What will be the output of the following C++ code?
#include <iostream>
#include <cstring>
using namespace std;
int main ()
{
    char str1[10] = "Hello";
    char str2[10] = "World";
    char str3[10];
    int  len ;
    strcpy( str3, str1);
    strcat( str1, str2);
    len = strlen(str1);
    cout << len << endl;
    return 0;
}
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
53
What will be the output of the following C++ code?
#include <iostream>
#include <string>
using namespace std;
class Box{
    int capacity;
public:
    Box(){}
    Box(double capacity){
	this->capacity = capacity;
    }
    bool operator<(Box b){
	return b.capacity < this->capacity? true : false;
    }
};
int main(int argc, char const *argv[])
{
    Box b1(10);
    Box b2 = Box(14);
     if(b1 < b2){
	cout<<"B1's capacity is small";
    }
    else{
	cout<<"B2's capacity is small";
    }
    return 0;
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
54
Which header file is used to declare the complex number?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
55
Pick out the correct statement.
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
56
Pick the other name of operator function.
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
57
Which header file is used to include the string object functions in C++?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
58
Constructors are used to . . . . . . . .
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
59
What will be the output of the following C++ code?
#include <iostream>
#include <string>
using namespace std;
class complex
{
    int i;
    int j;
    public:
    complex(){}
    complex(int a, int b)
    {
	i = a;
	j = b;
    }
    complex operator+(complex c)
    {
	complex temp;
	temp.i = this->i + c.i;
	temp.j = this->j + c.j;
	return temp;
    }
 void operator+(complex c)
    {
	complex temp;
	temp.i = this->i + c.i;
	temp.j = this->j + c.j;
	temp.show_poss();
    }
 void show(){
    cout<<"Complex Number: "<<i<<" + i"<<j<<endl;
    }
 void show_poss(){
    cout<<"Your result after addition will be: "<<i<<" + i"<<j<<endl;
    }
};
int main(int argc, char const *argv[])
{
    complex c1(1,2);
    complex c2(3,4);
    c1 + c2;
    return 0;
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
60
What is the header file for the string class?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board