You are on page 1of 1

Alayen University Second Stage

Technical Engineering College Computer Programming 2 evening


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. lose of data
A. states C. no loss of data
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) 9temp B. false
A. not accepted identifier name C. 0
B. keyword D. none of above
C. accepted identifier name 9) if we have to do one choice we
D. none of above A. use if control structure
3) choose the right statement B. use if – else control structure
A. cin << x; C. use if – elseif control structure
B. cin << “ hello friend”; D. use none of above
C. cin >> x; 10) in case of variable number of iterations (counter) and
D. none of above the loop must execute 1 to many times we use loop
4) choose the right choice A. for
A. int x = 5; B. while
B. int x = 5,0; C. do while
C. int x = 5.0; D. none of above
D. none of above 11) If a user-defined function, such as myFunction() is
5) the following number 24L is declared before the main() function it is
A. int A. legal
B. float B. illegal
C. hexadecimal C. possible
D. long D. none of above
6) the statement #define WIDTH 10 12) changes made inside the function are reflected on
A. legal constant other functions when we use
B. illegal constant A. call by value
C. int B. call by reference
D. none of above C. both of them
7) the implicit type conversion causes D. none of above
A. danger
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 fname)
for (int i = 1; i <= 10; i++) { {
cout << fname << " Refsnes\n";
// condition to continue }
if (i == 4) { break; } int main()
{
cout << i << endl; myFunction("Lian");
} myFunction("Jouvy");
myFunction("Anja");
return 0; } return 0; }

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

You might also like