Professional Documents
Culture Documents
Test 1 S 2021
Test 1 S 2021
Test 1 S 2021
$
Instructor: Mikhail TEST I Spring 2021
ID: ............................
Last Name : ........................................................... .....
-------------------------------------------------------------------------------------------------------------------
-
DO NOT USE THIS SECTION
Question Points Grade
1 10
2 10
3 15
4 12
5 10
18
6
7 10
8
34
Total 119
1 - Check the validity of the following Identifiers: (10-points)
Not Invali
C++ Identifier Valid Reason if invalid
recommended d
studentGPA
Student_Grade
Student-ID
FLOAT
Student’sAdress
return
_FinalGrade
GradesT1+T2
A___grades
__leter_Grade
2 (a)- Convert the following Decimal Numbers into their corresponding Binary
representation: (4-points)
(a) 262
(b) 85.75
2 (b)- Find out the Decimal Equivalent of the following binary numbers: (6-points)
(c) 110101
(d) 1011001.11
(e) 111011001
3- Given: (15-points)
float a = -8, b = 4, c;
int x = 2, y = 3.5, z, s, t;
const int two = 2;
c = (x + y) / x * b; c=
z = y % x + sqrt(b)/b; z=
s = (two * a + pow(2, x)) / (two * b); s=
s = (two * b + pow(x, two)) / two – b; s=
t = y / x * a + two * pow(two+1, 3.0); t =
2
b+
c
x=−c+
a
b−
c
3
b+
b
x=b+ 3
a−3
3
b
2
b c
x=
a 3c
1
−b
c
c
x=b
a
d
5- Evaluate each of the following logical expressions (10 points)
giving that: int a=4, b=2, c=10;
6- - Trace the following and show the output by checking the box of the correct answer :(18-
points)
A B C
7 Answer the following (10 points)
(c)- If you change from C++ to Pascal, would you need to change also, your
compiler? Why?
(d)- If you don’t want to use any compiler, what are your options to write an
application program?
(e)- What are the purposes of declaring a type for each variable we use in a
program?
8-
A- Provide the missing things, where indicated by a highlight, in the following C++
piece of code: (8-points)
___ The following piece of code displays Fail in case score is less than 50.0
otherwise it displays Pass ____
B- (26-points)
C++ Code Segment Code is Correct Code contains one mistake
(The output of tracing) (Explain how to fix the
mistake)