ExamVeda
Login
Home
41
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main()
{
    char name[30];
    cout << "Enter name: ";
    gets(name);
    cout << "Name: ";
    puts(name);
    return 0;
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
42
Which keyword can be used in template?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
43
Which are done by compiler for templates?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
44
What will be the output of the following C++ code?
#include <iostream> 
#include <vector> 
 
using namespace std; 
 
int main() 
{ 
    vector<int> v1;
    vector<int> v2; 
    for (int i = 1; i <= 5; i++) 
        v1.push_back(i);
    for (int i = 6; i <= 10; i++) 
        v2.push_back(i);
    v1.swap(v2);
    for(int i=0;i<v1.size();i++)
    	cout<<v1[i]<<" ";
    for(int i=0;i<v2.size();i++)
    	cout<<v2[i]<<" ";
    cout<<endl;
    return 0; 
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
45
How many types of linkages are there in C++?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
46
Which of the following is correct about the shift?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
47
What will be the output of the following C++ code?
#include <vector> 
#include <algorithm> 
#include <iostream> 
 
using namespace std;
 
int main() 
{ 
    vector<int> v; 
    for(int i=0;i<10;i++)
 	v.push_back(i+1);
    for(int i=0;i<10;i++)
	cout<<v[i]<<" ";
    cout<<endl;
    random_shuffle(v.begin(), v.end());
    for(int i=0;i<10;i++)
	cout<<v[i]<<" ";
    return 0;
}
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
48
What is any in C++?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
49
What will be the output of the following C++ code?
#include<iostream>
#include "math.h"
using namespace std;
double MySqrt(double d)
{
    if (d < 0.0)
    throw "Cannot take sqrt of negative number";     
    return sqrt(d);
}
int main()
{
    double d = 5;
    cout << MySqrt(d) << endl;
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
50
Choose the correct formatted code.
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board