194x Filetype PDF File size 0.84 MB Source: site.iugaza.edu.ps
Think Twice Code Once The Islamic University of Gaza Engineering Faculty Department of Computer Engineering Fall 2017 LNGG 1003 Khaleel I. Shaheen Introduction to Computers Laboratory Manual Final Exam Solution The Islamic University of Gaza Student Name: _____________________ Engineering Faculty Student ID: ________________________ Department of Computer Engineering Time: 1 hour 30 minutes Introduction to Computers LNGG 1003 Khaleel I. Shaheen Fall 2017 Final Exam Part I) Theoretical Questions. Question 1) Choose the correct answer: 1. Computer can execute the code in ____________. machine language assembly language python language high-level language 2. Python syntax is case-sensitive True False 3. A Python line comment begins with ________. // /* # $$ 4. A Python paragraph comment uses the style ________. // comments // /* comments */ /# comments #/ ''' comments ''' 5. Which of the following code is correct? print("Programming is fun") print("Programming is fun") print("Python is fun") print("Python is fun") print("Programming is fun) print("Programming is fun) print("Python is fun") print("Python is fun") 6. An identifier can be a keyword? True False 7. Which of the following is a valid identifier? $343 mile 9X 8+9 8. Which of the following is a valid identifier? (choose multiple) While Kilo1 Mile (red) 1 9. What will be displayed by the following code? x = 1 x = 2 * x + 1 print(x) 1 2 3 4 10. What will be displayed by the following code? x, y = 1, 2 x, y = y, x print(y, x) 1 1 2 2 2 1 1 2 11. What is the result of 45 / 4? 10 11 11.25 12 12. Which of the following expression results in a value 1? 2 % 1 15 % 4 25 % 5 37 % 6 13. What is 2 ** 3 evaluates to __________. 8 9 8.0 9.0 14. What is x after the following statements? x = 1 x *= x + 1 1 2 3 4 15. Analyze the following code: even = False if even: print("It is even!") The code displays It The code displays The code is wrong. The code is wrong. is even! nothing. replace if even: with replace if even: with if even == True: if even = True: 2 16. The following code displays ___________. temperature = 50 if temperature >= 100: print("too hot") elif temperature <= 40: print("too cold") else: print("just right") too hot too cold just right too hot too cold just right 17. What is y after the following statement is executed? x = 0 y = 10 if x > 0 else -10 -10 0 10 wrong expression 18. What is the value of the following expression? print(True or True and False) True False 19. Which of the following operators is right-associative. + * and = 20. How many times will the following code print "Welcome to Python"? count = 0 while count < 10: print("Welcome to Python") 9 10 11 infinite number of times 21. What will be displayed when the following code is executed? number = 6 while number > 0: number -= 3 print(number) 6 3 0 6 3 3 0 3 0 -3 22. The function range(5) return a sequence ______________. 1, 2, 3, 4, 5 0, 1, 2, 3, 4, 5 1, 2, 3, 4 0, 1, 2, 3, 4 23. Which of the following function is incorrect? (choose multiple) range(0, 3.5) range(10, 4, -1) range(1, 3, 1) range(2.5, 4.5) 3
no reviews yet
Please Login to review.