CSE4IP & CSE5CES | My Assignment Tutor

2021-CSE4IP&CSE5CES Practice Test for the format of Final Test-Solutions Part-1 (30 MCQ ,T/F questions and output) [30 Mark]   Write what would be printed by the print statement in the following fragment of Python code. OK Computer can execute the code in ____________. machine language            assembly language          python language               high-level language Machine language Python syntax is case-sensitive True False True A Python line comment begins with ________. // /* # $$ # A Python paragraph comment uses the style ________. // comments // /* comments */ /# comments #/ ”’ comments ”’ ”’ comments ”’ An identifier/ variable can be a keyword? True False False Which of the following is a valid identifier/variable? $343 mile 9X 8+9 mile Which of the following is a valid identifier? (choose multiple) While Kilo1 Mile (red) Mile What will be displayed by the following code? x = 1 x = 2 * x + 1 print(x) 1 2 3 4 3 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 1 2 What is the result of 45 / 4? 10 11 11.25 12 11.25 Which of the following expression results in a value 1? 2 % 1 15 % 4 25 % 5 37 % 6 37 % 6 What is 2 ** 3 evaluates to __________. 8 9 8.0 9.0 8 What is x after the following statements? x = 1 x *= x + 1 1 2 3 4 2 Analyze the following code: even = False if even:     print(“It is even!”) The code displays It is even! The code displays nothing. The code is wrong. replace if even: with if even == True: The code is wrong. replace if even: with if even = True: The code displays nothing. The following code displays ___________. temperature = 50 if temperature >= 100:      print(“too hot”) elif temperature 0:       number -= 3       print(number) 6 3 0 6 3 3 0 3 0 -3 3 0 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 0, 1, 2, 3, 4 Will the following program terminate? balance = 10 while True: if balance < 9: break balance = balance – 9 Yes No Yes Will the following program terminate? balance = 10 while True: if balance < 9: continue balance = balance – 9 Yes No NO A function _________. must have at least one parameter may have no parameters must always have a return statement to return a value must always have a return statement to return multiple values Given the following function def nPrint(message, n):      while n > 0:          print(message) n -= 1 What will be displayed by the call nPrint(‘a’, 4)? aaaa aaa invalid call infinite loop infinite loop What will be displayed by the following code? def f1(x=1, y=2): x = x + y y += 1 print(x, y) f1() 1 3 3 1 1 1 3 3 3 3 Which of the following functions return 4.0 int(3.4) int(3.9) eval(3.4) round(3.5) round(3.5) Part-2 (6 Short answer) [30 Mark) Consider the following function: In the left-hand column below are specific lists of integers. Indicate in the right-hand column what value would be returned by function list_mystery if the integer list in the left-hand column is passed as its parameter. Answer: 0 1 3 2 4 Write the output produced by this program below. Answer: Second Fourth Fifth Answer: This Is Not Even this was NoT EvEN THIS IS NOT EVEN this IS NoT EvENthis IS NoT EvEN  Answer: The problem lies in lines 3 and 4. Line 3 appends a letter (“h”) to the input string. Line 4 then tries to convert the result to an integer. The result, however, will never be a valid integer because of the letter “h”. So you get an error.

QUALITY: 100% ORIGINAL PAPER – NO PLAGIARISM – CUSTOM PAPER

Leave a Reply

Your email address will not be published. Required fields are marked *