ExamVeda
Login
Home
1
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 + ++x;
    cout << z;
    return 0;
}
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
2
What will be the output of the following C++ code?
#include <iostream>
#include <string>
using namespace std;
class B
{
	int b;
     public:
	B(){}
	B(int i){
		b = i;
	}
	int show(){
		return b;
	}
};
 
class C
{
	B b;
     public:
	C(int i){
		b = B(i);
	}
	friend void show();
};
 
void show()
{
	C c(10);
	cout<<"value of b is: "<<c.b.show()<<endl;
}
 
int main(int argc, char const *argv[])
{
	show();
	return 0;
}
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
3
What will be the output of the following C++ code?
#include 
using namespace std;
class CDummy
{
    public:
    int isitme (CDummy& param);
};
int CDummy::isitme (CDummy& param)
{
    if (¶m == this)
        return true;
    else
        return false;
}
int main ()
{
    CDummy a;
    CDummy *b = &a;
    if (b->isitme(a)) 
    {
        cout << "execute";
    }
    else
    {
        cout<<"not execute";
    }
    return 0;
}
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
4
How are types therein user-defined conversion?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
5
What is string objects in C++?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
6
What will be the output of the following C++ code?
#include <iostream>
#include <string>
using namespace std;
class A
{
	static int a;
    public:
	void show()
        {
		a++;
		cout<<"a: "<<a<<endl;
	}
};
 
int A::a = 5;
 
int main(int argc, char const *argv[])
{
	A a;
	return 0;
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
7
Pick out the other definition of objects.
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
8
Where does keyword ‘friend’ should be placed?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
9
Which operator should be overloaded in the following code to make the program error free?
#include <iostream>
#include <string>
using namespace std;
class Box{
    int capacity;
public:
    Box(){}
    Box(double capacity){
	this->capacity = capacity;
    }
};
int main(int argc, char const *argv[])
{
    Box b1(10);
    Box b2 = Box(14);
    if(b1 == b2){
	cout<<"Equal";
    }
    else{
 	cout<<"Not Equal";
    }
    return 0;
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
10
What is a binary operator?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board