Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
39 views
16 pages
Computer Science Final Exam (2008)
Uploaded by
Chantal Ramez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save Computer Science Final Exam (2008) For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
39 views
16 pages
Computer Science Final Exam (2008)
Uploaded by
Chantal Ramez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save Computer Science Final Exam (2008) For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
Download
Save Computer Science Final Exam (2008) For Later
You are on page 1
/ 16
Search
Fullscreen
Page 0 German University in Cairo 1d, Feb 2008 Computer Science and Engineering Department Prof. Dr. Slim Abdennadher Introduction to Computer Science, WS 2007-2008 FinalTerm Exam Bar Code Instructions: Read carefully before proceeding. 1) Duration of the exam: 3 hours (180 minutes). 2) (Non-programmable) Calculators are allowed. 3) No books or other aids are permitted for this test 4) This exam booklet contains 14 pages, including this one, Three extra sheets of scratch paper are attached and have to be kept attached, Note that if one or more pages are missing, you will lose their points. Thus, you must check that your exam booklet is complete. 5) Write your solutions in the space provided. If you need more space, write on the back of the sheet containing the problem or on the three extra sheets and make an arrow indicating that. Seratch sheets will not be graded unless an arrow on the problem page indicates that the solution extends to the scratch sheets, 6) When you are told that time is up, stop working on the test Good Luck! Don't write anything below ;-) Exercise TT273]4 7 ] PosbleMarks [6 [6 | 6 [ 6 [wl o6 | 5 | [wm Final Marks o -| odIntroduetion to Computer Science, FinalTerm Exam, 14. Feb 2008 Paget Exercise 1 (6 Marks) a) Convert the binary number 11010112 to a decimal number (base 10). Show your workout. Solution: 242484214 "= 64432484241 = 1070 'b) Convert the decimal number 122; to a number in base 7, Show your workout, Solution: Division Quotient Remainder 22/77 3 uy? 2 3 270 2 12210 = 2331 c) Convert the hexadecimal number AF 10Byg toa binary number. Show your workout, Solution: A F 1 0 8B 1010 1111 0001 0000 1011 ‘Thus AF1OBs = 10101111000100001011,Introduction to Computer Science, FinalTerm Exam, 14. Feb 2008 Page 2 Exercise 2 (6 Marks) Show how the decimal number 6.969 is stored in a computer that uses 16 bits to represent real numbers (10 for the mantissa and 6 for the exponent, both including the sign bit). Show your work as indicated below. a) Show the binary representation of the decimal number 6.969. Solution: 6.96919 = 110.111110. 0.969%2 = 1938 0.93842 = L876 087642 = L752 0.75242 = 1504 0.50442 = 1.008 0.008 + 2 1016 'b) Show the binary number in normalized scientific notation. Solution: 6.9699 = 110.111110) = 110111110 x 2% ¢) Show how the binary number will be stored in the 16 bits below. Sign oF Mantissa Sign of Exponent mantissa exponent Lit Obits Lit Sits Solution: 0 0111110. 0 ooo Sign of Mantissa Sign of Exponent mantissa exponent Lit Obits Lit ShitsIntroduction to Computer Science, FinalTerm Exam, 14. Feb 2008 Page 3 Exercise 3 (6 Marks) a) How many bits at least will be needed to store the unsigned number 31, Justify your answer. Solution: S bits since $119 = 11111, 'b) How many bits at least to store the number —31 in sign-magnitude notation? Justify your answer. Solution: Gits since the range for signed mumbers in sign-magnitude notation: [~ =31=-(2°=1). ) How many bits at least to store the number ~32 in two's complement notation? Justify your answer. 11), 2°11] and Solution: 6 bits since the range for signed numbers in two's complement notation: [-2"~ =32=-(2°) 1-4] andIntroduction to Computer Science, FinalTerm Exam, 14. Feb 2008 Page 4 Exercise 4 (6 Marks) Assume that our computer stores decimal numbers using 8 bit Perform the subtraction (-28)10-()o using 2's complement notation. Give the result of thesubtraction in decimal. Show your workout, i.e. all steps performed. Solution: © Convert 28 and 5 to binary: 2810 = 000111002 51g = 000001013, * Two's complement representation of -28 289 = 11100100 # Two's complement representation of —5, Sig = 11111011 ‘© Perform the addition (—28)q — (5)io in binary: 11100100 + 11111011 = 111011111 # Remove the overflow: oni # The binary number 11000011 represents the negativedecimal value ~33. The corresponding positive number of 11011111 is 00100001 which corresponds to 38.Introduction to Computer Science, FinalTerm Exam, 14. Feb 2008 Pages Exercise 5 (10 Marks) Given the following the following truth table, where A, B and C are the input variables and X is the output variable PPeeeeces| =)-Fele|-lTeleye} —elle|-fe)1eI4) =)=)=]=Jeheh ele] x4 a) Use the sum-of-products algorithm to find the Boolean expression that describes the output of the truth table. Solution: = AB'C' + AB'C + ABC! + ABC 'b) What is the functionality of the circuit? You should express it in form of an arithmetic operation. Solution: Assuming that the input variables correspond to a decimal number V from 0 until 7, the circuit will perform the following operation, where the division is an integer division: N 7 Another possible solution could be: The circuit checks whether a4 ) Draw the Boolean circuit. Note that each gate can have only two inputs.Introduction to Computer Science, FinalTerm Exam, 14. Feb 2008 Page 6 Exercise 6 (10 Marks) A circuit should be designed to decrement a decimal number having a range from 0 until 7. The result of ‘the subtraction should be represented in sign-magnitude. a) How many input and output variables are needed? Solution: We need 3 input variables and 4 output variables, If the input will be also represented in sign-magnitude, then 4 input variables will be needed. b) Construct the truth table for this cireuit Solution: +l--feJofee =l-lefe)==JeJehed +[=}-J4]-F>)-J
4-19] =lelel=|-IeJeJelo] al-l>]-J>)-)4/1¢] ) Use the sum-of products algorithm to find the Boolean expressions that correspond to the the truth table. Solution: S = ABC Ol = AB'C + ABC'+ ABC 02 = A'BC + AB'C'+ ABC O3 = A'BIC' + A'BC'+ ABIC' + ABC!Introduction to Computer Science, FinalTerm Exam, 14. Feb 2008 Exercise 7 Simplify the Boolean expressions using the Boolean algebra, Please mention the applied rules. T+0=2 Te r+l=1 r+(yta)=(e+y)+2 aly +2)Say +02 (x+y) =a'y' Distributivity DeMorgan’s Law a) The simplified expression consists of two gates. (A+ B)*(A+C) Solution: (A+ B)*(A+C)= — Distributivity A+BC b) The simplified expression consists of three gates. A+ Ale B+ Ale Ble C+ Ale BIeC'e D Solution: A+AMHB+ A's BAC + Ale Be C'4D (AFA) *(A4 B)4 Ale Ble C+ A's Be Cle D = 1(A+ B)+ A's Ble C+ Als Be Cl PagoT (6 Marks) let+ye=(@+y)e+2)] fete" 1 (A+ B)xl+ A's B'eC + Ae B'eC'sD= — [Commutativity] ALB+A'B'eC+AeB'eCl'sD= [evl=a] A+B+BIAC +A Bis Cle [Commutativity] A+(B+B')*(B+A'C)+ A's Be C's [e+ yz=(e+ ye +2)] At14(B+A'C)+ A's Bia Cl [e+a'=1] A+(BH+AIC) #1444 B'xC'+D= — [Commutativity] AF B+ACHA SB aC [re1=a] A+AC+B+AlB'eC'+D= — [Commutativity] (AFA)*(AF+C)4B+ ABC [et yz=(@+We+2)] 1s(A+C)4B+A'eB'sC'eD= [x +2'=1] (AF C)*14 BHA BI aCe [Commutativity] ALC+B+A'eB'eC'eD= — [2¥l=al A+C+B+BsC! [Commutativity] ALC+(B+B)4(B+ACD)= [et yz=(e+y)e+2)] A+C414(B+A'C'D) [e+a'=1] A+C+(B+A'C'D)*1= — [Commutativity] A+C4+B4A4C [rxt=a] CHB+A+AC'D= — [Commutativity] CHB+(A+ A) *(AFC'D) CHB+14(A+C'D) (e+ yet]Introduction to Computer Science, FinalTerm Exam, 14. Feb 2008 C+B+(A+CD)x1= C+B+A4C! B+A+C+CD= B+At(C+C)a(C4+D B+Atie(C+D)= B+A+(C+D)* B+A+C4D Page 8 [Commutativity] [e+1=2] [Commutativity] [e+yz=(e+u)(@+2)] [e+a'=1] [Commutativity] [rv1=a]Introduction to Computer Science, FinalTerm Exam, 14. Feb 2008 Page 9 Exercise 8 (5 Marks) Prove the following (Ax(B'sC'+ B+0)) '+(B+C)*(B'+C') Hint: There are different. ways to prove that two Boolean expressions are equivalent. In this case, it ‘would be easier to use the Boolean algebra rules given in Exercise 7. Solution: (Ax(B'eC'+ Be C))!'= A'+ (Bix C!4 BC) A'+((B'C!)'* (BC)! Al +((B" +0") *(B'+C" A'+((B+C)*(B'+C') A'4(B+C)*(BI+C")Introduction to Computer Science, FinalTerm Exam, 14. Feb 2008 Page 10 Exercise 9 (10 Marks) Write an algorithm that takes as a parameter a list containing a sequence of integers and outputs a list with its mirror image. The mirror image of a sequence contains the original sequence in reversed order followed by the original sequence. For example, if the original sequence is: 1,8, 15, 7,2 then the algorithm should create a list of the form 2,7, 15, 8, 1, 1, 8, 15, 7, 2 Solution: get n get AL,A2,.06 An set iton set jtol while (i>=1) { set Bj to Ai set Bj+n to An-itt set itoi-t set j to jtt + set jtol while (j<-2n) { print Bj set j to j+t +Introduction to Computer Science, FinalTerm Exam, 14. Feb 2008 Page 1 Exercise 10 (10 Marks) ‘The following algorithm calculates the binary representation of given number x and represent it in n bits, get x get n setiton-1 while (i >= 0) do { if (2) <0 ‘then set Bi to 0 else set Bi to set x to x-27i endif set ito i-t + setitoitd while(i
= 0) do \- 1 operation --> executed once = 1 operation --> executed(n+1) times { if (24) <0 ~ 4 operation ---> executed n times ‘then set Bi to 0 else set Bi to1 - 1 operation --> executed n times set x to x27 1 operation --> executed n times endif set itoi-t - 4 operation --> executed n times } setitoitd 1 operation --> executed once while(i
executed (n+1) times print Bi setitoitd -. 1 operation --> executed n times .- 1 operation --> executed n times + ‘Total number of executed operations: = 81 +4 b) Give the value of «50 that the algorithm will execute the least number of operations. Justify your answer, Solution: Forx = 0, the algorithm will execute the least number of operations, because in each execution of the loop the then part of the if-statement consisting of only one statement will be executed.Introduetion to Computer Science, FinalTerm Exam, 14. Feb 2008 Page 12 ) Determine the order of magnitude of the algorithm. Solution: O(n)Introduction to Computer Science, FinalTerm Exam, 14. Feb 2008 Page 13 Extra PageIntroduetion to Computer Science, FinalTerm Exam, 14. Feb 2008 Page 14 Extra PageIntroduction to Computer Science, FinalTerm Exam, 14. Feb 2008 Page 15 Extra Page
You might also like
Unit 1 DLCD
PDF
No ratings yet
Unit 1 DLCD
25 pages
Digital Electronics Question Answers
PDF
No ratings yet
Digital Electronics Question Answers
110 pages
Unit 1 - DSD
PDF
No ratings yet
Unit 1 - DSD
95 pages
AP Prep Vol2 Answers Explanations Unlocked
PDF
No ratings yet
AP Prep Vol2 Answers Explanations Unlocked
358 pages
Computer Science Final Exam (2015)
PDF
No ratings yet
Computer Science Final Exam (2015)
15 pages
3639CH1-Fundamentals of Logic Design
PDF
No ratings yet
3639CH1-Fundamentals of Logic Design
74 pages
Midterm Standard Answer Key
PDF
No ratings yet
Midterm Standard Answer Key
4 pages
Digital Electronics Important Questions
PDF
No ratings yet
Digital Electronics Important Questions
4 pages
EETE 2340 Sample Midterm
PDF
No ratings yet
EETE 2340 Sample Midterm
11 pages
Answers - Digital Fundamentals
PDF
No ratings yet
Answers - Digital Fundamentals
6 pages
Bca 1 CC 04
PDF
No ratings yet
Bca 1 CC 04
7 pages
Exercise Sheet 1 - Correction
PDF
No ratings yet
Exercise Sheet 1 - Correction
9 pages
CSEE W3827 Fundamentals of Computer Systems Homework Assignment 1
PDF
No ratings yet
CSEE W3827 Fundamentals of Computer Systems Homework Assignment 1
11 pages
Adobe Scan Sep 20, 2020 PDF
PDF
No ratings yet
Adobe Scan Sep 20, 2020 PDF
10 pages
StudentCode 2021 S1 FIT1047 MA Tutorial Lab2
PDF
No ratings yet
StudentCode 2021 S1 FIT1047 MA Tutorial Lab2
9 pages
CEG 2136 - Fall 2014 - Midterm PDF
PDF
No ratings yet
CEG 2136 - Fall 2014 - Midterm PDF
7 pages
DLC 2 Marks With Answers
PDF
No ratings yet
DLC 2 Marks With Answers
39 pages
Solutions - Midterm Exam
PDF
No ratings yet
Solutions - Midterm Exam
4 pages
MCS 012
PDF
No ratings yet
MCS 012
32 pages
CSEN102: Introduction To Computer Science Winter Semester 2019-2020
PDF
No ratings yet
CSEN102: Introduction To Computer Science Winter Semester 2019-2020
17 pages
Namma Kalvi 11th Computer Applications Chapter 2 Study Material em
PDF
No ratings yet
Namma Kalvi 11th Computer Applications Chapter 2 Study Material em
8 pages
Midterm CEG2136 F2014sol Oct20
PDF
No ratings yet
Midterm CEG2136 F2014sol Oct20
7 pages
Answers Question 8
PDF
No ratings yet
Answers Question 8
3 pages
Ak Digital Electronics Unit 1
PDF
No ratings yet
Ak Digital Electronics Unit 1
4 pages
Exercises Chap1
PDF
No ratings yet
Exercises Chap1
6 pages
COMP-231 Assignment-1 Group 1595
PDF
No ratings yet
COMP-231 Assignment-1 Group 1595
8 pages
265 Midterm 01 Fall 2010 Answers
PDF
No ratings yet
265 Midterm 01 Fall 2010 Answers
9 pages
400 - Lecture 5 Problems
PDF
No ratings yet
400 - Lecture 5 Problems
2 pages
Aidoo Robert Kwabena
PDF
No ratings yet
Aidoo Robert Kwabena
4 pages
Be - Computer Engineering - Semester 3 - 2018 - May - Digital Logic Design and Analysis Cbcgs
PDF
No ratings yet
Be - Computer Engineering - Semester 3 - 2018 - May - Digital Logic Design and Analysis Cbcgs
21 pages
Assignment 01 Solution
PDF
No ratings yet
Assignment 01 Solution
6 pages
Assingnment# 1
PDF
No ratings yet
Assingnment# 1
8 pages
Comp
PDF
No ratings yet
Comp
8 pages
Computer Fundamentals Lecture
PDF
No ratings yet
Computer Fundamentals Lecture
5 pages
Birla Institute of Technology & Science, Pilani
PDF
No ratings yet
Birla Institute of Technology & Science, Pilani
7 pages
Untitled 1
PDF
No ratings yet
Untitled 1
6 pages
2012 Midterm Solutaion
PDF
No ratings yet
2012 Midterm Solutaion
9 pages
Lecture Notes Fit1047
PDF
No ratings yet
Lecture Notes Fit1047
74 pages
EE221 - Fall 2024 - Midterm Exam Solution
PDF
No ratings yet
EE221 - Fall 2024 - Midterm Exam Solution
7 pages
Unit I and Ii 2 Marks DLF 2023
PDF
No ratings yet
Unit I and Ii 2 Marks DLF 2023
11 pages
DLC 2 Marks With Answers
PDF
No ratings yet
DLC 2 Marks With Answers
52 pages
DLD - QB
PDF
No ratings yet
DLD - QB
14 pages
Running Time of Programslucifer
PDF
No ratings yet
Running Time of Programslucifer
16 pages
265 Midterm 01 Winter 2010 Answers
PDF
No ratings yet
265 Midterm 01 Winter 2010 Answers
9 pages
Cos1521 2019 6 e 1
PDF
No ratings yet
Cos1521 2019 6 e 1
31 pages
DLCD Akash
PDF
No ratings yet
DLCD Akash
63 pages
CSA Mid Term Paper With Solution
PDF
No ratings yet
CSA Mid Term Paper With Solution
9 pages
DLD Workbook
PDF
No ratings yet
DLD Workbook
32 pages
Digital Logic Questions
PDF
No ratings yet
Digital Logic Questions
85 pages
Digital Electronics Interview Questions Answers
PDF
No ratings yet
Digital Electronics Interview Questions Answers
55 pages
Assignment 1 (1)
PDF
No ratings yet
Assignment 1 (1)
2 pages
DLCD Akash Sem3
PDF
No ratings yet
DLCD Akash Sem3
63 pages
Solution Practice Paper 2 DLDM - 11zon
PDF
No ratings yet
Solution Practice Paper 2 DLDM - 11zon
35 pages
Questions DE-1
PDF
No ratings yet
Questions DE-1
9 pages
Digital Electronics Assingement I
PDF
No ratings yet
Digital Electronics Assingement I
6 pages
DLCD Akash Sem3
PDF
No ratings yet
DLCD Akash Sem3
63 pages
Fabbc9: Convert Hexadecimal To Binary
PDF
No ratings yet
Fabbc9: Convert Hexadecimal To Binary
11 pages