#include <iostream>
using namespace std;
void print(int i)
{
cout << i;
}
void print(double f)
{
cout << f;
}
int main(void)
{
print(5);
print(500.263);
return 0;
}Select an option to see the answer and solution.
Practice every MCQ with options. Use Show answers when you want the correct option and solution.
176
Questions
4/9
Page
Pick an option on a question to see the right answer and solution.
#include <iostream>
using namespace std;
void print(int i)
{
cout << i;
}
void print(double f)
{
cout << f;
}
int main(void)
{
print(5);
print(500.263);
return 0;
}Select an option to see the answer and solution.
#include <iostream>
using namespace std;
#define SquareOf(x) x * x
int main()
{
int x;
cout << SquareOf(x + 4);
return 0;
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
#include <iostream>
#include <stdarg.h>
using namespace std;
int add (int num, ...)
{
int sum = 0;
va_list args;
va_start (args,num);
for (int i = 0; i < num; i++)
{
int num = va_arg (args,int);
sum += num;
}
va_end (args);
return sum;
}
int main (void)
{
int total = add(8, 1, 2, -1, 4, 12, -2, 9, 7);
cout << "The result is " << total;
return 0;
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
#include <iostream>
#include <stdarg.h>
using namespace std;
void dumplist(int, ...);
int main()
{
dumplist(2, 4, 8);
dumplist(3, 6, 9, 7);
return 0;
}
void dumplist(int n, ...)
{
va_list p;
int i;
va_start(p, n);
while (n-->0)
{
i = va_arg(p, int);
cout << i;
}
va_end(p);
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
#include <iostream>
#include <string>
using namespace std;
namespace
{
int var = 10;
}
int main()
{
cout<<var;
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
#include <iostream>
using namespace std;
int operate (int a, int b)
{
return (a * b);
}
float operate (float a, float b)
{
return (a / b);
}
int main()
{
int x = 5, y = 2;
float n = 5.0, m = 2.0;
cout << operate(x, y) <<"\t";
cout << operate (n, m);
return 0;
}Select an option to see the answer and solution.
#include <iostream>
using namespace std;
#define PR(id) cout << "The value of " #id " is "<<id
int main()
{
int i = 10;
PR(i);
return 0;
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
#include <iostream>
using namespace std;
int fun(int=0, int = 0);
int main()
{
cout << fun(5);
return 0;
}
int fun(int x, int y) { return (x+y); }Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.