CS 202: Introduction to Computation Fall 2010: Exam #1

Similar documents
ECE 2030D Computer Engineering Spring problems, 5 pages Exam Two 8 March 2012

ECE 2030B 1:00pm Computer Engineering Spring problems, 5 pages Exam Two 10 March 2010

ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two 26 February 2014

CDA 3103 Computer Organization Exam 1 (Sep. 22th, 2014)

CS & IT Conversions. Magnitude 10,000 1,

Student Number: UTORid: Question 0. [1 mark] Read and follow all instructions on this page, and fill in all fields.

Cornell University Computer Science 211 Second Preliminary Examination 18 April 2006

Chapter 1 An Introduction to Computer Science. INVITATION TO Computer Science 1

15110 PRINCIPLES OF COMPUTING SAMPLE EXAM 2

EE 109L Final Review

EE292: Fundamentals of ECE

CS/COE 0447 Example Problems for Exam 2 Spring 2011

CS1800 Discrete Structures Final Version A

EE 109L Review. Name: Solutions

ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two Solutions 26 February 2014

Outline. policies. with some potential answers... MCS 260 Lecture 19 Introduction to Computer Science Jan Verschelde, 24 February 2016

Question Total Possible Test Score Total 100

Logic Design: Part 2

Philadelphia University Student Name: Student Number:

(a) What is the denary equivalent of the hexadecimal number A7?

CDS130 Mid-term exam: Sample

Total 100. The American University in Cairo Computer Science & Engineering Department CSCE 106. Instructor: Final Exam Fall Section No.

SCHOOL OF ENGINEERING & BUILT ENVIRONMENT. Mathematics. Numbers & Number Systems

4 Operations On Data 4.1. Foundations of Computer Science Cengage Learning

Arithmetic Processing

4 Operations On Data 4.1. Foundations of Computer Science Cengage Learning

UNCA CSCI 255 Exam 1 Spring February, This is a closed book and closed notes exam. It is to be turned in by 1:45 PM.

COMPUTER SCIENCE SECTION A

DLD VIDYA SAGAR P. potharajuvidyasagar.wordpress.com. Vignana Bharathi Institute of Technology UNIT 1 DLD P VIDYA SAGAR

SCRATCH MODULE 3: NUMBER CONVERSIONS

Read and fill in this page now

60-265: Winter ANSWERS Exercise 4 Combinational Circuit Design

CS220/MATH320 Applied Discrete Mathematics Instructor: Marc Pomplun Practice Exam. Sample Solutions

ENEL 353: Digital Circuits Midterm Examination

Unit 2: Data Storage CS 101, Fall 2018

Decimal & Binary Representation Systems. Decimal & Binary Representation Systems

Structure and Interpretation of Computer Programs

CS1800 Discrete Structures Summer 2017 Prof. Schnyder May 26, CS1800 Discrete Structures Midterm Practice Exam

The American University in Cairo Computer Science & Engineering Department CSCE 106 Fundamentals of Computer Science

Binary Representation. Jerry Cain CS 106AJ October 29, 2018 slides courtesy of Eric Roberts

Final Exam Solution Sunday, December 15, 10:05-12:05 PM

Date Performed: Marks Obtained: /10. Group Members (ID):. Experiment # 09 MULTIPLEXERS

CS 151 Quiz 4. Instructions: Student ID. (Last Name) (First Name) Signature

Microcomputers. Outline. Number Systems and Digital Logic Review

The Need of Datapath or Register Transfer Logic. Number 1 Number 2 Number 3 Number 4. Numbers from 1 to million. Register

Midterm Exam 2A Principles of Computing Fall November 10, 2014

ECE/CS 252 Fall 2011 Homework 4 (25 points) // Due in Lecture Mon Oct. 17, 2011

SECONDARY SCHOOL, L-IMRIEĦEL HALF YEARLY EXAMINATIONS 2016/2017

SWITCHING THEORY AND LOGIC CIRCUITS

CIS Introduction to Computer Programming Spring Exam 1

CpSc 421 Final Solutions

Control Structures. Lecture 4 COP 3014 Fall September 18, 2017

problem maximum score 1 10pts 2 8pts 3 10pts 4 12pts 5 7pts 6 7pts 7 7pts 8 17pts 9 22pts total 100pts

Read this before starting!

CS 151 Midterm. (Last Name) (First Name)

Structure and Interpretation of Computer Programs

4. Write a sum-of-products representation of the following circuit. Y = (A + B + C) (A + B + C)

CS1800 Discrete Structures Fall 2017 October 25, CS1800 Discrete Structures Midterm Version B

Bits. Binary Digits. 0 or 1

CS 455 Final Exam Fall 2012 [Bono] Dec. 17, 2012

Read this before starting!

Modesto Junior College Course Outline of Record CMPSC 241

Digital Logic Design Exercises. Assignment 1

Binary Values. CSE 410 Lecture 02

Do not turn this page until you have received the signal to start. In the meantime, please read the instructions below carefully.

CMPE223/CMSE222 Digital Logic Design. Positional representation

Bits, Words, and Integers

Digital Systems COE 202. Digital Logic Design. Dr. Muhamed Mudawar King Fahd University of Petroleum and Minerals

CPSC 211, Sections : Data Structures and Implementations, Honors Final Exam May 4, 2001

Good Evening! Welcome!

Read this before starting!

Midterm Exam Thursday, October 24, :00--2:15PM (75 minutes)

Date Performed: Marks Obtained: /10. Group Members (ID):. Experiment # 04. Boolean Expression Simplification and Implementation

Assertions & Verification & Example Loop Invariants Example Exam Questions

The LC3's micro-coded controller ("useq") is nothing more than a finite-state machine (FSM). It has these inputs:

Sample Multiple-Choice Question 01

Question: Total Points: Score:

GIRLS SECONDARY, L-IMRIEĦEL HALF YEARLY EXAMINATIONS 2015/2016

CS1800 Discrete Structures Final Version B

CPE 112 Spring 2015 Exam II (100 pts) March 4, Definition Matching (8 Points)

Adding Binary Integers. Part 5. Adding Base 10 Numbers. Adding 2's Complement. Adding Binary Example = 10. Arithmetic Logic Unit

8/27/2016. ECE 120: Introduction to Computing. Graphical Illustration of Modular Arithmetic. Representations Must be Unambiguous

CS2630: Computer Organization Homework 1 Bits, bytes, and memory organization Due January 25, 2017, 11:59pm

Assertions & Verification Example Exam Questions

CSCI 150: Exam 1 Practice

Discrete Mathematics and Probability Theory Fall 2016 Seshia and Walrand Midterm 1

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

Intensive Introduction to Computer Science. Course Overview Programming in Scratch

CS 216 Exam 1 Fall SOLUTION

Department of Electrical and Computer Engineering The University of Texas at Austin

Summary of Course Coverage

Loops / Repetition Statements

Chapter 3 Data Representation

This podcast will demonstrate a logical approach as to how a computer adds through logical gates.

IA Digital Electronics - Supervision I

Digital Circuits ECS 371

OCR J276 GCSE Computer Science

AP Computer Science Principles Exam Reference Sheet

CSE332 Summer 2010: Final Exam

Midterm Exam 2B Answer key

Transcription:

CS 22: Introduction to Computation Fall 2: Exam # Name: Answers Question Possible Points Received Points 2 2 2 3 2 4 2 5 2 Total This exam is closed notes. You have 5 minutes to complete the 5 questions on this exam. Please write your answers clearly. Good luck!

Question : Why watch TV when you could be Programming? A) A friend of yours has created the Scratch program shown in the appendix. (You may remove it for reference.) The program recommends a TV show based upon how the user answers a series of questions. On the back of the previous page, draw the decision tree corresponding to the scripts. Give a descriptive name to each node of the tree, label the transitions between nodes, and show the outputs of the program. 4 pts B) How many different TV shows can this program recommend (across multiple runs of the program)? 8 2 pts C) In any one run of the program, what is the fewest number of questions the user could be asked (i.e., the best case)? What TV show will be recommended in this case?, Glee 2 pts D) In any one run of the program, what is the greatest number of questions the user could be asked (i.e., the worst case)? What TV show will be recommended in this case? 7 pt, House or Bones pt E) If the user receives the recommendation to watch Lost, what do you know about him or her? Likes islands pt dislikes musicals, vampires, superheroes, realtime pt F) Did your friend create a program that resulted in good decision tree? What qualities are good or bad about the resulting decision tree? Bad tree not 'balanced'. Each question only eliminates one possible question; requires too many questions in the worst case 4 pts G) If you were to write a different Scratch program to recommend a TV show, what would be your goal in terms of the number of questions asked? How many questions would it ask in the worst case? Goal: least #questions for all possible answers worst case: 3 questions because 2^3 = 8 2 pts 2 pts

Question 2: Some of these things are not like the others Assume you have a cat who is running the following script. For each of the following scripts activated by When Green Flag clicked, say whether or not it results in the same behavior as the original script. If it has different behavior, state how the behavior is different and why.. Same 2 pts 2. different pt. how: meow not played, color not changed pt 2. why: variable =, repeat variable means repeat pt 3. different pt. how: meow played, color changed only 2 times pt 2. why: variable starts at pt 4. different pt. how: meow played, color changed forever pt 2. why: variable never increased pt 5. same 2pts 6. same 2pts 7. different pt. how: meow played, color changed forever pt 2. why: can never = 2 pt 8. same 2 pts

Question 3: How do the variables vary? Consider the following Script which has access to three variables called x, y, and old y. Remember that the block "x mod y" divides x by y and returns the remainder. For example, 7 mod 2 = and 6 mod 2 =. For the following input values, fill in the table to show the value of each variable at the end of each iteration of the repeat loop. You may not need all of the rows of the table. You may find it useful to show the initial values of each variable in the header row of the table. A) x=2, y =5. Loop # old y y x 5 5 2 3 4 B) x=2, y =4. Loop # old y y x 4 7 4 2 7 7 3 4 C) x=8, y =3. Loop # old y y x 3 2 3 2 2 2 3 4

Extra Credit (No stress, please): What mathematical function is this script computing? (Hint: It is difficult to figure this out from looking at the code itself; you may find the function easier to uncover by looking at many different inputs and the resulting outputs.) Gcd greatest common divisor Question 4: Do you know a little bit? Specify whether each of the following statements is true or false. Feel free to explain your answers if you desire. _F The binary number is 8 in decimal. F The decimal number 9 is in binary. F The binary number is the same as the binary number. T 8 unique unsigned integers can be represented in 3 bits. F 3 unique unsigned integers can be represented in 5 bits. (also accepted T) T 2 N different unsigned integers can be represented in N bits. F N 2 different unsigned integers can be represented in N bits. (also accepted T) T The largest (unsigned) integer that can be represented in 4 bits is 5 (decimal). T The number is larger in base than in base 2. T The binary number divided by 2 (decimal) is. F The binary number divided by 2 (decimal) is. T The binary number divided by 2 (decimal) is. T 32 is a valid number in a base-4 representation. F 8 is a valid number in a base-8 (octal) representation. T 49abc is a valid number in a base-6 (hexadecimal) representation.

Question 5: Can you handle the truth? You are hired at a company where your boss only understands truth tables and cannot understand Boolean expressions or circuits. Every time a Boolean expression or circuit crosses his desk, he asks you to convert it to a truth table in standard form (where all input combinations are exhaustively enumerated in order). A) Draw the truth table for the Boolean expression: D = (NOT A and B and C) OR (NOT A and NOT B) OR (NOT C). A B C D This question carried 3 points. Points were taken off if output obtained were incorrect (.5 for each output value). Also, if you have not shown all the eight rows some points were taken off (.5 for each row not shown). B) Draw the truth table for the Boolean expression: C = NOT (A and B). A B C This question carried 3 points. Most of the students interpreted the equation as NOT A and B which is different than NOT(A and B)..5 marks were taken off for each incorrect row. C) Draw the truth table for this combinational circuit with three inputs, A, B, and C, and one output, D.

A B C D This question also carried 3 points. Like question,.5 marks were taken off for each incorrect output value. D) Draw the truth table for an implementation of a one-bit full adder. A B C Cout S

This question carried 4 points. If you have just showed either C or S you receive 2 points. For two incorrect rows.5 marks has been taken off. E) Label the four outputs of this circuit and draw the corresponding truth table. Each output is labeled C, D, E and F (from top to bottom) and the corresponding truth table for C, D, E, F is shown below A B C D E F This question carried 3 points. If the labeling is not present.5 marks were taken off. If you have labeled it, marks was awarded..5 marks were taken off if you messed up either of C, D, E, F s truth table. F) Consider the following sequential circuit with two inputs Set and Reset and one output M. Note that this circuit has a feedback loop and can therefore remember values. Draw the corresponding truth table; make sure you consider the output of the circuit also as an additional input.

M = (NOT R AND M) OR S R M S M This question carried 4 marks..5 marks were taken off for each incorrect output value.

Appendix for Question. 2This page may be removed for reference.