You are on page 1of 1

Alayen University Second Stage

Technical Engineering College Computer Programming 2 A1


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) C++ is 7) the following number 0x286 is
A. case-sensitive A. int
B. case-not sensitive B. octal
C. special programming C. hexadecimal
D. none of above D. long
2) for 8) the statement #define WIDTH 10
A. not accepted identifier name A. legal constant
B. keyword B. illegal constant
C. accepted identifier name C. int
D. none of above D. none of above
3) choose the right statement 9) int sum = (int)x + 1; is
A. cout << “ hello friend”; A. dangerous
B. cuot << “ hello friend”; B. explicit type conversion
C. cout >> “ hello friend”; C. implicit type conversion
D. none of above D. none of above
4) the size of type int is 10) if we have to do one choice we use
A. = size of double A. if control structure
B. > size of double B. if – else control structure
C. < size of double C. if – elseif control structure
D. none of above D. none of above
5) choose the right choice 11) we use this statement (variable != sentinel) in loop
A. float x = 5; A. for
B. float x = 5,0; B. while
C. float x = 5.0; C. do while
D. none of above D. none of above
6) Variables that are declared inside a function or block 12) changes made inside the function are reflected on
A. global variables other functions when we use
B. local variables A. call by value
C. default variables B. call by reference
D. none of above C. both of them
D. none of above
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 = "Norway")
{
for (int i = 1; i <= 5; i++) {
cout << country << "\n";
// condition to continue }
int main() {
if (i == 3) { continue; }
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