You are on page 1of 1

Alayen University Second Stage

Technical Engineering College Computer Programming 2 B2


Computer Technical Engineering Department Time: 90 minutes
Monthly Exam No: 1 Total Marks: 20

First Question: Choose The Right Choice For Each of the Following: 12 marks
1) Objects have B. illegal constant
A. states C. int
B. behaviors D. none of above
C. states and behaviors 8) executing the statement “hello”> “hen” will give
D. none of above A. true
2) The starting point of all C++ programs is the B. false
A. First line of code C. 0
B. main () function D. none of above
C. #include 9) if we have to do one of two choices we use
D. none of above A. if control structure
3) return B. if – else control structure
A. not accepted identifier name C. if – elseif control structure
B. keyword D. none of above
C. accepted identifier name 10) in case of fixed number of iterations (counter) we
D. none of above use loop
4) choose the right declaration of variables A. for
A. int x; z; c; B. while
B. int x, z, c; C. do while
C. int x. z, c, D. none of above
D. none of above 11) If a user-defined function, such as myFunction() is
5) the following number 0246 is declared inside the main() function it is
A. int A. legal
B. octal B. illegal
C. hexadecimal C. possible
D. none of above D. none of above
6) the following number 2.4689 is 12) changes made inside the function are reflected on
A. int other functions when we use
B. illegal A. call by value
C. float B. call by reference
D. none of above C. both of them
7) const int WIDTH = 10; D. none of above
A. legal constant
Second Question: write the output for the following programs: 8 marks
p1- #include <iostream> p2- #include <iostream>
using namespace std; using namespace std;
int main() { void myFunction(string country = "Iraq")
{
for (int i = 1; i <= 5; i++) {
cout << country << "\n"; }
// condition to continue int main()
{
if (i == 3) { break; }
myFunction("Sweden");
cout << i << endl; myFunction("India");
myFunction();
}
myFunction("USA");
return 0; } return 0; }

best wishes for you all Dr. Eng. Maher Ali Ibrahim

You might also like