ExamVeda
Login
Home
71
What will be the output of the following C++ code?
#include <iostream>
int const s=9;
int main()
{
    std::cout << s;
    return 0;
}
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
72
Which concept is used to implement late binding?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
73
What will be the output of the following C++ code?
#include <iostream>
 
int main(int argc, char const *argv[])
{
	cout<<"Hello World";
	return 0;
}
Discuss
Answer & Solution
Answer: Option A
Solution:
The given code is a basic C++ program that prints a message to the console.

It includes the <iostream> header, which allows the use of input and output streams like cout.

The main function is defined correctly with appropriate parameters (int argc, char const *argv[]), though these parameters are not used.

cout<<"Hello World"; correctly outputs the text "Hello World" to the standard output.

There are no syntax or runtime errors in the code, and it will compile and run successfully.

Therefore, the output will be: Hello World
74
Which of the following cannot be used with the virtual keyword?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
75
What happens if the following program is executed in C and C++?
#include <stdio.h> 
int main(void) 
{ 
	int new = 5;
	printf("%d", new); 
}
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
76
Which of the following is an exit-controlled loop?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
77
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
class Test
{
    static int x;
  public:
    Test() { x++; }
    static int getX() {return x;}
};
int Test::x = 0;
int main()
{
    cout << Test::getX() << " ";
    Test t[5];
    cout << Test::getX();
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
78
What happens if the following program is executed in C and C++?
#include<stdio.h> 
int main() 
{ 
   foo();
}  
int foo() 
{ 
   printf("Hello"); 
   return 0;  
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
79
Which of the following is C++ equivalent for scanf()?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
80
What will be the output of the following C++ code?
#include<iostream>
using namespace std;
int x = 1;
int main()
{
    int x = 2;
    {
        int x = 3;
        cout << ::x << endl;
    }
    return 0;
}
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board