0% found this document useful (0 votes)
25 views2 pages

Quiz 3 - Model - 2

The document appears to be a quiz for an introductory programming course. It contains 10 multiple choice questions related to C++ programming concepts like data types, operators, functions and variable naming. The questions cover a range of basic syntax and language rules.

Uploaded by

ahmed essam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views2 pages

Quiz 3 - Model - 2

The document appears to be a quiz for an introductory programming course. It contains 10 multiple choice questions related to C++ programming concepts like data types, operators, functions and variable naming. The questions cover a range of basic syntax and language rules.

Uploaded by

ahmed essam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

INT G005 (Intro.

to Programming) Cairo University    


....................................................................... :‫اإلسم‬
Quiz 3, Fall 2023 Faculty of Engineering    
Time: 20 minutes Preparatory Year
    Section: ………… BN: …………
.‫ حافظ على نظافة ورقتك‬.‫ظلل اجاباتك بوضوح فى الدوائر المخصصه فقط‬ 
Shade your answers clearly in the bubble sheet only. Keep your paper clean. ‫ظلل إجاباتك بوضوح‬ 
Shade your answers 8-Digit Student Code:
Answer questions 1 to 4 using the following code segment  
int n; 1           
cout << "Enter an integer: ";
cin >> n; 2           
if (n < 5) 3           
cout << "less than 5" << endl;
4           
else if (n > 10)
cout << "greater than 10" << endl; 5           
else 6           
cout << "not interesting" << endl;
7           
1-What will be the output of the fragment above if the interactive user enters
the integer value 0? 8           
(a) none of the above (b) not interesting
9           
(c) greater than 10 (d) less than 5
2- What will be the output of the fragment above if the interactive user enters 10           
the integer value 15 ?

*02*
   
(a) none of the above (b) not interesting
(c) greater than 10 (d) less than 5    
3- What will be the output of the fragment above if the interactive user enters    
the integer value 7 ?
(a) none of the above (b) not interesting
(c) greater than 10 (d) less than 5
4-What values for n will cause the output of the fragment above to be "not
interesting"?
(a)n>10 (b) n>15
(c) there is no value for n (d) n<15
5- Given the variables p, q are of char type and r, s, t are of int type. Select
the right statement?
t = (r ∗ s)/(r + s);
t = (p ∗ q)/(r + s);
a) 1 is true but 2 is false b)both 1 and 2 are true
c) 1 is false and 2 is true d) both 1 and 2 are false
6- What is the output when the following code fragment is executed?
int i = 5, j = 6, k = 7, n = 3;
cout << i + j * k - k % n << endl;
cout << i / n << endl;
(a)47 (b) 46 (c)48 (d) none of the above
2 1 3

7- A C++ code line ends with


(a) colon (:) (b) None of these
(c) semicolon (;) (d) comma (,)
8- What is the value of x after the program executes?
#include <iostream>
#include <cmath>
using namespace std;
int main() {
int x = acos(-1);
}

(a) 3.14159265358979323846 (b) 3.142


(c)3 (d) error

9- Select one of the following is not valid for the variable name…
(a) Abc (b) ABC (c) _abc (d) -abc

10-What is the value stored in y (to 3 decimal places) after executing the
following lines:
double x=1, y=2, z=-3;
y = sin(x*22.0/(7*180))+tan(z);
(A)0.160 (B)-0.125 (C) 0.083 (D) None

You might also like