Document
Document
Document
Read Carefully the Question It is NOT Allowed to use any digital media It is NOT Allowed to use the internet
Required
1.Name in English:
Employee FillEmp()
{
Employee em(3, 4);
return em;
}
int main()
{
Employee emp(7, 8);
emp = FillEmp();
cout << emp.GetId() ;
cout << emp.GetSalary() << endl;
return 0;
}
What is the output of the previous program?
(2 Points)
34
78
Compile error
Non of the above
28.What will be the output of the following C++ code? #include <iostream.h> int main () { int n; for (n = 5; n > 0; n--) {
(2 Points)
a) 543
b) 54
c) 5432
d) 53
29.What will be the output of the following C++ code? #include <iostream.h> void Sum(int a, int b, int & c) { a = b + c;
y, y); cout << x << " " << y; return 0; }
(2 Points)
a) 2 3
b) 6 9
c) 2 15
d) compile time error
30.What will be the output of the following C++ code? #include <iostream.h> int func(int m = 10, int n) { int c; c = m +
(2 Points)
a) 15
b) 10
c) compile time error
d) 30
31.What will be the output of the following C++ code? #include <iostream.h> int func(int m , int n = 10) { int c; c = m +
{ cout << func(5); return 0; }
(2 Points)
a) 15
b) 11
c) compile time error
d) 30
32.What will be the output of the following C++ code? #include <iostream.h> class rect { int x, y; public: void val (int, i
t a, int b) { x = a; y = b; } int main () { rect Rect; Rect.val (3, 4); cout << "rect area: " << Rect.area(); return 0; }
(2 Points)
a) rect area: 24
b) rect area: 12
c) compile error
d) rect area: 56
33.What will be the output of the following C++ code? #include <iostream.h> class CDummy { public: int isitme (CDum
this) return 1; else return 0; } int main () { CDummy a; CDummy *b = &a; if (b->isitme(a)) { cout << "execute"; } else { c
(2 Points)
a) execute
b) not execute
c) error
d) both execute & not execute
34.Which of the following, when used as the /* body */ of method sum, will enable
that method to compute 1 + 2 + + n correctly for any n > 0?
//return 1 + 2 + ... + n
int sum(int n)
{
/* body */
}
I) return n + sum(n - 1);
II) if (n == 1)
return 1;
else
return n + sum(n - 1);
III) if (n == 1)
return 1;
else
return sum(n) + sum(n - 1);
(2 Points)
a) I only
b) II only
c) III only
d) I and II only
e) I, II, and III
Never give out your password.Report abuse
This content is created by the owner of the form. The data you submit will be sent to the form owner. Microsoft is no
mers, including those of this form owner. Never give out your password.
Powered by Microsoft Forms
|
The owner of this form has not provided a privacy statement as to how they will use your response data. Do not pro
| Terms of use