ExamVeda
Login
Home
1
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
void Values(int n1, int n2 = 10)
{
    using namespace std;
    cout << "1st value: " << n1;
    cout << "2nd value: " << n2;
}
int main()
{
    Values(1);
    Values(3, 4);
    return 0;
}
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
2
What is the maximum number of arguments or parameters that can be present in one function call?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
3
How to print the value of the i variable inside namespace B?
namespace A{
	int var = 10;
	namespace B{
		int i = 15;
	}
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
4
What is the use of Namespace?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
5
How can you access the arguments that are manipulated in the function?
Discuss
Answer & Solution
Answer: Option A
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>
using namespace std;
namespace first
{
    int var = 5;
}
namespace second
{
    double var = 3.1416;
}
int main ()
{
    int a;
    a = first::var + second::var;
    cout << a;
    return 0;
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
7
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main()
{
    int age = 0;
    try 
    {
        if (age < 0) 
        {
            throw "Positive Number Required";
        }
        cout << age;
    }
    catch(const char *Message)
    {
        cout << "Error: " << Message;
    }
    return 0;
}
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
8
What is the correct syntax of defining a namespace?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
9
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main()
 {
    char* buff;
    try 
    {
         buff = new char[1024];
         if (buff == 0)
           throw "Memory allocation failure!";
        else
           cout << sizeof(buff) << "Byte successfully allocated!"<<endl;
     }
    catch(char *strg)
    {
        cout<<"Exception raised: "<<strg<<endl;
     }
     return 0;
}
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
10
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int gcd (int a, int b)
{
    int temp;
    while (b != 0) 
    {
        temp = a % b;
        a = b;
        b = temp;
    }
    return(a);
}
int main ()
{
    int x = 15, y = 25;
    cout << gcd(x, y);
    return(0);
}
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board