Which operator can be overloaded in C++ ?
Which of the following is not a relational operator in C programming language?
Which of the following is the feature of C++?
#include <stdio.h>
int main() {
int i = 5, j = 7;
i = i++ + ++j;
printf("%d %d\n", i, j);
return 0;
}
Which of the following is alternatively correct representation of the expression, a = a + 1; where a is an integer.
#include <iostream>
class Base {
public:
virtual void foo() {
std::cout << "Base::foo()" << std::endl;
}
};
class Derived : public Base {
public:
void foo() {
std::cout << "Derived::foo()" << std::endl;
}
};
int main() {
Base *b = new Derived;
b->foo();
return 0;
}
What value returns by t2 object while calling getValue function:
#include <iostream>
class Test {
private:
int value;
public:
Test(int v = 0) { value = v; }
int getValue() const { return value; }
};
int main() {
Test t1(10);
Test t2 = t1;
std::cout << t2.getValue() << std::endl;
return 0;
}
what will be the output of the given program?
#include <bits/stdc++.h>
using namespace std;
int add(int f, int s)
{
return f + s + 61;
}
int operation(int f, int s, int (*functocall)(int, int))
{
return (*functocall)(f, s);
}
int main()
{
int a;
int (*plus)(int, int) = add;
a = operation(27, 12, plus);
cout << (a>>1);
return 0;
}
Which of the following statements about the 'break' statement is false?
In order to get an output (irrespective of its value) without any errors which
should the statement be in place of "xyz" added in class Class?
#include <bits/stdc++.h>
using namespace std;
class Class
{
int Static;
public:
void setdefault()
{
Static = 1;
}
/* xyz */
};
class Main
{
public:
void display(Class t)
{
cout << t.Static;
}
};
int main()
{
Class t;
Main d;
d.display(t);
}