Forwarded from علم البيانات | DS2 Quizes (𝙴𝚗𝚐. 𝙷𝚊𝚣𝚎𝚖 𝙵. 𝙰𝚕-𝙷𝚞𝚝𝚑𝚊𝚒𝚏𝚒)
Which of the following is the correct way to define a function with value parameters?
Anonymous Quiz
19%
int sum(int &x);
57%
int sum(int x);
8%
int sum(const int x);
17%
None of the above
🌚1
Forwarded from علم البيانات | DS2 Quizes (𝙴𝚗𝚐. 𝙷𝚊𝚣𝚎𝚖 𝙵. 𝙰𝚕-𝙷𝚞𝚝𝚑𝚊𝚒𝚏𝚒)
What is the output of the following code?
void myFunction(int x, int y) {
x = x + y;
}
int main() {
int a = 5;
int b = 10;
myFunction(a, b);
cout << a << endl;
return 0;
}
Forwarded from علم البيانات | DS2 Quizes (𝙴𝚗𝚐. 𝙷𝚊𝚣𝚎𝚖 𝙵. 𝙰𝚕-𝙷𝚞𝚝𝚑𝚊𝚒𝚏𝚒)
What is the output of the following code?
void myFunction(int x, int y) {
x = x + y; } int main() { int a = 5; int b = 10; myFunction(a, b); cout << a << endl; return 0; }
void myFunction(int x, int y) {
x = x + y; } int main() { int a = 5; int b = 10; myFunction(a, b); cout << a << endl; return 0; }
Anonymous Quiz
4%
10
45%
15
46%
5
5%
Error
Forwarded from علم البيانات | DS2 Quizes (𝙴𝚗𝚐. 𝙷𝚊𝚣𝚎𝚖 𝙵. 𝙰𝚕-𝙷𝚞𝚝𝚑𝚊𝚒𝚏𝚒)
What is the output of the following code?
void myFunction(int &x, int y=10) {
x= x + y;
return x;
}
int main() {
int a = 5;
int b = 10;
myFunction(a);
cout << a << endl;
return 0;
}
Forwarded from علم البيانات | DS2 Quizes (𝙴𝚗𝚐. 𝙷𝚊𝚣𝚎𝚖 𝙵. 𝙰𝚕-𝙷𝚞𝚝𝚑𝚊𝚒𝚏𝚒)
What is the output of the following code?
void myFunction(int &x, int y=10) {
x= x + y; return x; } int main() { int a = 5; int b = 10; myFunction(a); cout << a << endl; return 0; }
void myFunction(int &x, int y=10) {
x= x + y; return x; } int main() { int a = 5; int b = 10; myFunction(a); cout << a << endl; return 0; }
Anonymous Quiz
38%
5
12%
10
10%
25
39%
Error
Forwarded from علم البيانات | DS2 Quizes (𝙴𝚗𝚐. 𝙷𝚊𝚣𝚎𝚖 𝙵. 𝙰𝚕-𝙷𝚞𝚝𝚑𝚊𝚒𝚏𝚒)
What is the output of the following code?
int myFunction(int x, int y){
return x + y;
}
int main() {
int a = 5;
int b = 10;
int c = myFunction(a, b);
cout << c << endl;
return 0;
}
Forwarded from علم البيانات | DS2 Quizes (𝙴𝚗𝚐. 𝙷𝚊𝚣𝚎𝚖 𝙵. 𝙰𝚕-𝙷𝚞𝚝𝚑𝚊𝚒𝚏𝚒)
What is the output of the following code?
int myFunction(int x, int y){
return x + y; } int main() { int a = 5; int b = 10; int c = myFunction(a, b); cout << c << endl; return 0; }
int myFunction(int x, int y){
return x + y; } int main() { int a = 5; int b = 10; int c = myFunction(a, b); cout << c << endl; return 0; }
Anonymous Quiz
3%
5
4%
10
82%
15
10%
Error
Forwarded from علم البيانات | DS2 Quizes (𝙴𝚗𝚐. 𝙷𝚊𝚣𝚎𝚖 𝙵. 𝙰𝚕-𝙷𝚞𝚝𝚑𝚊𝚒𝚏𝚒)
Which of the following is NOT a valid variable type in C++?
Anonymous Quiz
3%
int
5%
float
15%
string
77%
None of the above
Forwarded from علم البيانات | DS2 Quizes (𝙴𝚗𝚐. 𝙷𝚊𝚣𝚎𝚖 𝙵. 𝙰𝚕-𝙷𝚞𝚝𝚑𝚊𝚒𝚏𝚒)
the difference between a global variable and a local variable:
...........are declared inside a function, while .......... are declared outside of any function.
...........are declared inside a function, while .......... are declared outside of any function.
Anonymous Quiz
15%
global variables / local variables
8%
global variables / global variables
75%
local variables / global variables
2%
None of the above
Forwarded from علم البيانات | DS2 Quizes (𝙴𝚗𝚐. 𝙷𝚊𝚣𝚎𝚖 𝙵. 𝙰𝚕-𝙷𝚞𝚝𝚑𝚊𝚒𝚏𝚒)
Which of the following variables type in C++ that can only be accessed within the function it's declared in?
Anonymous Quiz
17%
global variable
58%
local variable
10%
Constant variable
15%
All of above.
Forwarded from علم البيانات | DS2 Quizes (𝙴𝚗𝚐. 𝙷𝚊𝚣𝚎𝚖 𝙵. 𝙰𝚕-𝙷𝚞𝚝𝚑𝚊𝚒𝚏𝚒)
What is the output of the following code?
int myFunction(int x, int y = 10) {
return x + y;
}
int main() {
int a = 5;
int b = myFunction(a);
cout << b << endl;
return 0;
}
Forwarded from علم البيانات | DS2 Quizes (𝙴𝚗𝚐. 𝙷𝚊𝚣𝚎𝚖 𝙵. 𝙰𝚕-𝙷𝚞𝚝𝚑𝚊𝚒𝚏𝚒)
What is the output of the following code?
int myFunction(int x, int y = 10) {
return x + y; } int main() { int a = 5; int b = myFunction(a); cout << b << endl; return 0; }
int myFunction(int x, int y = 10) {
return x + y; } int main() { int a = 5; int b = myFunction(a); cout << b << endl; return 0; }
Anonymous Quiz
22%
5
8%
10
54%
15
16%
Error
Forwarded from علم البيانات | DS2 Quizes (𝙴𝚗𝚐. 𝙷𝚊𝚣𝚎𝚖 𝙵. 𝙰𝚕-𝙷𝚞𝚝𝚑𝚊𝚒𝚏𝚒)
Which of the following is the correct way to define a function with reference parameters?
Anonymous Quiz
13%
(int x)
65%
(int &x)
8%
(const int x)
15%
None of the above
Forwarded from علم البيانات | DS2 Quizes (𝙴𝚗𝚐. 𝙷𝚊𝚣𝚎𝚖 𝙵. 𝙰𝚕-𝙷𝚞𝚝𝚑𝚊𝚒𝚏𝚒)
Which of the following is the correct way to define a function with default parameters?
Anonymous Quiz
37%
int subFun(int y ,int &x = 0);
30%
int subFun(int x = 0, int y);
10%
int subFun(const int x = 0, int y);
24%
None of the above
Forwarded from علم البيانات | DS2 Quizes (𝙴𝚗𝚐. 𝙷𝚊𝚣𝚎𝚖 𝙵. 𝙰𝚕-𝙷𝚞𝚝𝚑𝚊𝚒𝚏𝚒)
What is the output of the following code?
void myFunction(int &x, int y) {
x = x + y;
}
int main() {
int a = 5;
int b = 10;
myFunction(a, b);
cout << a << endl;
return 0;
}
Forwarded from علم البيانات | DS2 Quizes (𝙴𝚗𝚐. 𝙷𝚊𝚣𝚎𝚖 𝙵. 𝙰𝚕-𝙷𝚞𝚝𝚑𝚊𝚒𝚏𝚒)
What is the output of the following code?
void myFunction(int &x, int y) {
x = x + y; } int main() { int a = 5; int b = 10; myFunction(a, b); cout << a << endl; return 0; }
void myFunction(int &x, int y) {
x = x + y; } int main() { int a = 5; int b = 10; myFunction(a, b); cout << a << endl; return 0; }
Anonymous Quiz
36%
5
8%
10
45%
15
11%
Error
Forwarded from علم البيانات | DS2 Quizes (𝙴𝚗𝚐. 𝙷𝚊𝚣𝚎𝚖 𝙵. 𝙰𝚕-𝙷𝚞𝚝𝚑𝚊𝚒𝚏𝚒)
What is the output of the following code?
void myFunction(int &x, int y) {
x = x + y;
}
int main() {
int a = 5;
int b = 10;
cout << a << endl;
myFunction(a, b);
return 0;
}
Forwarded from علم البيانات | DS2 Quizes (𝙴𝚗𝚐. 𝙷𝚊𝚣𝚎𝚖 𝙵. 𝙰𝚕-𝙷𝚞𝚝𝚑𝚊𝚒𝚏𝚒)
What is the output of the following code?
void myFunction(int &x, int y) {
x = x + y; } int main() { int a = 5; int b = 10; cout << a << endl; myFunction(a, b); return 0; }
void myFunction(int &x, int y) {
x = x + y; } int main() { int a = 5; int b = 10; cout << a << endl; myFunction(a, b); return 0; }
Anonymous Quiz
58%
5
29%
15
3%
10
11%
Error
Forwarded from علم البيانات | DS2 Quizes (𝙴𝚗𝚐. 𝙷𝚊𝚣𝚎𝚖 𝙵. 𝙰𝚕-𝙷𝚞𝚝𝚑𝚊𝚒𝚏𝚒)
true or false:
To use a predefined function in a program, you need to know only the name of the function and how to use it.
To use a predefined function in a program, you need to know only the name of the function and how to use it.
Anonymous Quiz
59%
true
41%
false
Forwarded from علم البيانات | DS2 Quizes (𝙴𝚗𝚐. 𝙷𝚊𝚣𝚎𝚖 𝙵. 𝙰𝚕-𝙷𝚞𝚝𝚑𝚊𝚒𝚏𝚒)
Forwarded from علم البيانات | DS2 Quizes (𝙴𝚗𝚐. 𝙷𝚊𝚣𝚎𝚖 𝙵. 𝙰𝚕-𝙷𝚞𝚝𝚑𝚊𝚒𝚏𝚒)
true or false:
Parameters allow you to use different values each time the function is called.
Parameters allow you to use different values each time the function is called.
Anonymous Quiz
84%
true
16%
false