ECOR1041_Midterm_F23_B_SOLUTION

.pdf

School

Carleton University *

*We aren’t endorsed by this school

Course

1041

Subject

Computer Science

Date

Feb 20, 2024

Type

pdf

Pages

7

Uploaded by omarmanna09

Report
ECOR 1041 Midterm Exam Fall 2023 SECTION B Instructions: Do NOT draw or write on the bar codes at the top/bottom of the exam pages. This is a closed-book exam. Non-programmable calculators are permitted. All other electronic devices (tablets, laptop computers, cell phones, smart watches, headphones, etc.) must be placed under your chair or left in your backpack or purse. This exam is 75 minutes long. There are three sections worth 25 marks in total. Attempt all questions. Use the pages labeled “rough work” for rough work. The “rough work” pages will not be graded. You are not allowed to remove any pages from your exam. Do not ask questions unless you believe that you have found a typo. Be sure you are writing this exam in your assigned room . Not writing in your assigned room will result in a 5-mark penalty. Be sure that you have clearly written your name and student number on the first page. Not including your name or student number on this paper will result in a 5-mark penalty. Be sure that you have clearly filled the bubbles for your student number on the first page. Not filling in the bubbles or incorrectly filling in the bubbles will result in a 5-mark penalty. All rights reserved : No part of this document may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without prior written permission from the instructor.
SECTION 1 Multiple choice (…/1 6) This section contains 16 multiple-choice questions. Each question has one correct answer. Record your answers on the Bubble sheet at the end of the exam using the answer spaces 001-016 . For each question, fill in (shade) the circle (A, B, C, D, or E) that corresponds to the correct answer. Answers recorded on the question paper will not be graded. When answering the questions, Fill in (shade) the answers firmly and neatly, preferably with a dark pencil. Completely erase any changed answers Do NOT tear the bubble sheet. Questions Q1 Convert the 8-bit binary number 00010110 to decimal, assuming that the binary number is the signed representation (signed magnitude) of the decimal value. a) -22 b) 22 c) -44 d) 44 Q2 Convert the 4-bit binary number 1010 to decimal, assuming that the binary number is the unsigned representation of the decimal value. a) 2 b) 4 c) 10 d) 20 Q3 Convert the decimal value 17 to a 5-bit binary number using signed representation (signed magnitude) a) 10001 b) 01001 c) 10010 d) 17 cannot be represented using 5-bits and signed magnitude Q4 Assuming that both values are unsigned binary integers, what is the result of the following operation? 1001 + 1111 a) 11000 b) 10001 c) 01111 d) 10110
Q5 Convert the fractional binary number 10.01 to decimal. a) 2.025 b) 10.025 c) 2.25 d) 10.25 Q6 Which of the following variable names will produce a syntax error in Python? a) My_house b) __my______house__ c) myHouse d) my-house Q7 In Python, a variable can refer to values of different types at different points in the program execution. a) True b) False Q8 What would be the output of the following expression if someone types it in the Python shell? >>> (-5 % 7 - 4 // -1) x 6 a) Syntax error b) -4 c) 24 d) 36 e) 1 Q9 What would be the output of the following expression if someone types it in the Python shell? >>> 5.0 ** 2 // 2 a) 5 b) 5.0 c) 12 d) 12.0 e) Syntax error Q10 In Python brackets, [], braces, {}, and parentheses () have the same meaning. a) True b) False
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help