Test 1 S 2021

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

Computer Science & Engineering Department

CSCE 1001 “Fundamentals of Computing”

$
Instructor: Mikhail TEST I Spring 2021
ID: ............................
Last Name : ........................................................... .....

First Name: ........................................................... Section No.:

* Exam time is 75 minutes.


* Put the answers on the same question sheet
* Write your name, ID, section no. in the indicated places.
* By submitting an answer sheet, you admit reading the Academic Integrity Policy below and
you declare you adhering to it.
Academic Integrity Policy
Cheating in Exams is a violation of the honesty policy of AUC. Whispering, talking, looking at someone else’s
paper, or copying from any source is considered cheating. Any one who does any of these actions or her/his
answers indicates that she/he did any of them, will receive a punishment ranging from zero in this exam to
failing the course. If repeated, it may lead to dismissal from AUC.
I have read the honesty policy and exam instructions and I am presenting this exam as entirely my
effort.
Signature

-------------------------------------------------------------------------------------------------------------------
-
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;

compute the value of the variable in the left-hand side:

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 =

4- Write each of the following mathematical expressions in C++ statements : (12-


points)

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;

EXPRESSION TRU FALS


E E
a + 5 > b + 10
! (a==b+2) && (c==4)
a + b/c > b + c || a- b>2 + c
! (x< y +z && x>y + z)
! (x<= y +z || x>y + z)

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)

(a)-Can the computer perform mathematical operations like solving


simultaneous equations?

(b)- Differentiate between: - Source file and Object file

(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 ____

____ score = 55.0;


if (score ___ 50.0)
      cout << __ Pass\n” __

____ cout << “Fail” ____ endl;

B- (26-points)
C++ Code Segment Code is Correct Code contains one mistake
(The output of tracing) (Explain how to fix the
mistake)
 

You might also like