1 Crore+ students have signed up on EduRev. Have you? Download the App |
In C++, which keyword is used to indicate the end of a function's execution and return a value?
Which of the following statements is true regarding function overloading in C++?
Which of the following is not a valid function declaration in C++?
What is the scope of a variable declared inside a function in C++?
What will be the output of the following code?
#include <iostream>
int myFunction(int x, int y) {
return x + y;
}
int main() {
int result = myFunction(5, 3);
std::cout << result << std::endl;
return 0;
}
What will be the output of the following code?
#include <iostream>
void myFunction(int x) {
std::cout << "Value: " << x << std::endl;
}
int main() {
int value = 10;
myFunction(value);
return 0;
}
What will be the output of the following code?
#include <iostream>
int add(int x, int y) {
return x + y;
}
int multiply(int x, int y) {
return x * y;
}
int main() {
int result = add(2, multiply(3, 4));
std::cout << result << std::endl;
return 0;
}
What will be the output of the following code?
#include <iostream>
int myFunction(int& x) {
x += 5;
return x;
}
int main() {
int value = 10;
int result = myFunction(value);
std::cout << result << std::endl;
return 0;
}
What will be the output of the following code?
#include <iostream>
int add(int x, int y) {
return x + y;
}
int add(int x, int y, int z) {
return x + y + z;
}
int main() {
int result = add(2, 3);
std::cout << result << std::endl;
return 0;
}
What will be the output of the following code?
#include <iostream>
int myFunction(int x) {
return x * 2;
}
int myFunction(int x, int y) {
return x + y;
}
int main() {
int result1 = myFunction(2);
int result2 = myFunction(2, 3);
std::cout << result1 << " " << result2 << std::endl;
return 0;
}
What will be the output of the following code?
#include <iostream>
void myFunction(int x) {
if (x <= 0)
return;
std::cout << x << std::endl;
myFunction(x - 1);
}
int main() {
myFunction(5);
return 0;
}
What will be the output of the following code?
#include <iostream>
int myFunction(int x) {
if (x <= 1)
return x;
return myFunction(x - 1) + x;
}
int main() {
int result = myFunction(4);
std::cout << result << std::endl;
return 0;
}
What will be the output of the following code?
#include <iostream>
int myFunction(int x) {
if (x <= 1)
return x;
return myFunction(x - 1) * x;
}
int main() {
int result = myFunction(4);
std::cout << result << std::endl;
return 0;
}
What will be the output of the following code?
#include <iostream>
void myFunction(int x) {
std::cout << "Value: " << x << std::endl;
}
int main() {
int value = 10;
myFunction(value++);
return 0;
}
What will be the output of the following code?
#include <iostream>
int myFunction(int x) {
return x * x;
}
int myFunction(int& x) {
return ++x;
}
int main() {
int value = 5;
int result = myFunction(value);
std::cout << result << std::endl;
return 0;
}
What will be the output of the following code?
#include <iostream>
int myFunction(int x, int y) {
return x - y;
}
int main() {
int result = myFunction(5, 3) * 2;
std::cout << result << std::endl;
return 0;
}
What will be the output of the following code?
#include <iostream>
void myFunction(int x) {
std::cout << "Value: " << x << std::endl;
}
void myFunction(int* x) {
std::cout << "Pointer: " << *x << std::endl;
}
int main() {
int value = 10;
myFunction(&value);
return 0;
}
What will be the output of the following code?
#include <iostream>
int myFunction(int x) {
if (x == 0)
return 0;
return x + myFunction(x - 1);
}
int main() {
int result = myFunction(4);
std::cout << result << std::endl;
return 0;
}
What will be the output of the following code?
#include <iostream>
void myFunction(int x) {
if (x <= 0)
return;
myFunction(x - 1);
std::cout << x << " ";
}
int main() {
myFunction(5);
return 0;
}
What will be the output of the following code?
#include <iostream>
int myFunction(int x) {
if (x <= 1)
return x;
return myFunction(x - 1) + myFunction(x - 2);
}
int main() {
int result = myFunction(5);
std::cout << result << std::endl;
return 0;
}
What will be the output of the following code?
#include <iostream>
int myFunction(int x) {
if (x <= 0)
return 1;
return myFunction(x - 1) * x;
}
int main() {
int result = myFunction(0);
std::cout << result << std::endl;
return 0;
}
What will be the output of the following code?
#include <iostream>
void myFunction(int& x) {
x *= 2;
}
int main() {
const int value = 10;
myFunction(value);
std::cout << value << std::endl;
return 0;
}
What will be the output of the following code?
#include <iostream>
void myFunction(int* x) {
*x = 20;
}
int main() {
int value = 10;
myFunction(&value);
std::cout << value << std::endl;
return 0;
}
What will be the output of the following code?
#include <iostream>
int myFunction(int x) {
if (x == 0)
return 0;
return x + myFunction(x - 1);
}
int main() {
int result = myFunction(0);
std::cout << result << std::endl;
return 0;
}
70 videos|45 docs|15 tests
|
70 videos|45 docs|15 tests
|