Spring Semester 08, Dr. Punch. Exam #1 (2/12), form 1 A

Similar documents
Spring Semester 08, Dr. Punch. Exam #1 (2/12), form 1 B

Spring Semester 13, Dr. Punch. Exam #1 (2/14), form 1 A

Fall 08, Sherri Goings, Exam #1 (10/2), form 1 B

Spring Semester, Dr. Punch. Exam #2 (03/28), form 2 C

Spring Semester 16, Dr. Punch. Exam #1 (2/18), form 1 A

Spring Semester 09 Exam #1 Dr. Dillon. (02/19)

Spring Semester 11 Exam #1 Dr. Dillon. (02/15)

First name (printed): a. DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN.

Fall Semester, Dr. Punch. Exam #2 (11/07), form 2 A

Spring Semester 10 Exam #1 Dr. Dillon. (02/18)

Spring Semester 09 Exam #2 Dr. Dillon. (04/02)

Exam 2, Form A CSE 231 Spring 2014 (1) DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN.

Exam 2, Form B CSE 231 Spring 2014 (1) DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN.

Exam #1, Form 1 A CSE 231 Spring 2015 (1) DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN.

Exam #3, Form 3 A CSE 231 Fall 2015 (1) DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN.

Final Exam, Form 3 A CSE 231 Spring 2015 (1) DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN.

Exam 1, Form A CSE 231 Fall 2012 (1) DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN.

First name (printed): a. DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN.

Exam 3, Form A CSE 231 Spring 2014 (1) DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN.

Exam 2, Form A CSE 231 Spring 2013 (1) DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN.

CS 2316 Exam 1 Spring 2013

Lecture Programming in C++ PART 1. By Assistant Professor Dr. Ali Kattan

CS 1301 Exam 1 Fall 2010

CS 111X - Spring Final Exam - KEY

CS 1301 CS1 with Robots Summer 2007 Exam 1

Conditional Expressions and Decision Statements

15110 PRINCIPLES OF COMPUTING SAMPLE EXAM 2

Midterm Examination (MTA)

Q1 Q2 Q3 Q4 Q5 Total 1 * 7 1 * 5 20 * * Final marks Marks First Question

CS 1301 Exam 1 Fall 2010

CS 2316 Exam 1 Spring 2014

The American University in Cairo Computer Science & Engineering Department CSCE Dr. KHALIL Exam II Spring 2010

Test #2 October 8, 2015

While Loops A while loop executes a statement as long as a condition is true while condition: statement(s) Statement may be simple or compound Typical

SCHEME 10 COMPUTER SCIENCE 61A. July 26, Warm Up: Conditional Expressions. 1. What does Scheme print? scm> (if (or #t (/ 1 0)) 1 (/ 1 0))

CPSC 121 Some Sample Questions for the Final Exam Tuesday, April 15, 2014, 8:30AM

Read this before starting!

Problem Points Score Grader Total 75

Part 1 (80 points) Multiple Choice Questions (20 questions * 4 points per question = 80 points)

Total 100. The American University in Cairo Computer Science & Engineering Department CSCE 106. Dr. Khalil Exam II Fall 2011

Midterm Exam 2B Answer key

CS 1301 Exam 1 Spring 2011

Write code that simulates one roll of a 6-sided die and prints out the

Programming Fundamentals - A Modular Structured Approach using C++ By: Kenneth Leroy Busbee

THE AUSTRALIAN NATIONAL UNIVERSITY Mid Semester Examination September COMP1730 / COMP6730 Programming for Scientists

CS110 Introduction to Computing Fall 2006 Midterm Exam

CIS 110 Introduction to Computer Programming Summer 2018 Midterm. Recitation ROOM :

The Practice of Computing Using PYTHON. Chapter 2. Control. Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Read this before starting!

CS1800 Discrete Structures Final Version A

Conditionals and Recursion. Python Part 4

ENGR 102 Engineering Lab I - Computation

Exam 1 Format, Concepts, What you should be able to do, and Sample Problems

Python Class-Lesson1 Instructor: Yao

Senthil Kumaran S

CIS 110 Introduction to Computer Programming 8 October 2013 Midterm

Python for Non-programmers

Condition Controlled Loops. Introduction to Programming - Python

Assignment 6. Methods Homework Spring 2017 P Question 1 all

Iterative Statements. Iterative Statements: Examples. Counter-Controlled Loops. ICOM 4036 Programming Languages Statement-Level Control Structure

EXAMINATION INSTRUCTIONS

Introduction to: Computers & Programming: Review prior to 1 st Midterm

CIS 110 Introduction to Computer Programming Spring 2016 Midterm

Chapter 2. C++ Basics. Copyright 2014 Pearson Addison-Wesley. All rights reserved.

CHAPTER 4 CONTROL STRUCTURES

CS 1301 Exam 1 Fall 2014

THE UNIVERSITY OF BRITISH COLUMBIA CPSC 110: MIDTERM 1 Part B May 26, Important notes about this examination

CSEN202: Introduction to Computer Science Spring Semester 2017 Midterm Exam

Control, Quick Overview. Selection. Selection 7/6/2017. Chapter 2. Control

CS 1301 Exam 1 Fall 2014

Programming Fundamentals and Python

CS Name : Grading TA:

\n is used in a string to indicate the newline character. An expression produces data. The simplest expression

Unit 1 Integers, Fractions & Order of Operations

CS 1301 Exam 1 Answers Fall 2009

1996 ILLINOIS JETS TEAMS DISTRICT COMPUTER FUNDAMENTALS TEST. 1. A computer program is:

CIS 110 Introduction to Computer Programming Summer 2014 Midterm. Name:

Structure and Interpretation of Computer Programs

Flow Control: Branches and loops

CS 1301 Exam 3 Spring 2012

Computer Programming

CIS 110 Introduction to Computer Programming Summer 2018 Final. Recitation # (e.g., 201):

Part III Appendices 165

CS 1301 Exam 1 Spring 2014

Any Integer Can Be Written as a Fraction

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

CIS192 Python Programming. Robert Rand. August 27, 2015

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

CS/COE 0447 Example Problems for Exam 2 Spring 2011

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

Chapter 5. Repetition. Contents. Introduction. Three Types of Program Control. Two Types of Repetition. Three Syntax Structures for Looping in C++

Python for Informatics

Getting Started. Office Hours. CSE 231, Rich Enbody. After class By appointment send an . Michigan State University CSE 231, Fall 2013

Module Contact: Dr Gavin Cawley, CMP Copyright of the University of East Anglia Version 1

CIS Introduction to Computer Programming Spring Exam 1

Computer Programming : C++

University of Maryland College Park Dept of Computer Science CMSC106 Fall 2013 Midterm I Key

EXAMINATION INSTRUCTIONS

More Programming Constructs -- Introduction

Final Exam May 8, 2018

Transcription:

Spring Semester 08, Dr. Punch. Exam #1 (2/12), form 1 A Last name (printed): First name (printed): Directions: a) DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN. b) You have 80 minutes to complete the exam (8:30-9:50 am) c) This exam booklet contains 26 multiple choice questions, each weighted equally (5 points) and one 20 point write some code question. Nine pages total d) You may use one 8.5" x 11" note sheet during the exam. No other reference materials or calculating devices may be used during the examination. e) Questions will not be interpreted during the examination. f) You should choose the single best alternative for each question, even if you believe that a question is ambiguous or contains a typographic error. g) Please fill in the requested information at the top of this exam booklet. h) Use a #2 pencil to encode any information on the OMR form. i) Please encode the following on the OMR form:! Last name and first initial! MSU PID! Exam form (see the title of this page) j) Please sign the OMR form. k) Only answers recorded on your OMR form will be counted for credit. l) Completely erase any responses on the OMR form that you wish to delete. m) You must turn in this exam booklet and the OMR form when you have completed the exam. When leaving, please be courteous to those still taking the exam. Good luck. Timing tip. A rate of 2.5 minute per multiple choice problem leaves 15 minutes to write the 20 point program at the end Key 1 2 3 4 5 6 7 8 9 10 C A B E A C B C B E 11 12 13 14 15 16 17 18 19 20 D A A C E D E D B C 21 22 23 24 25 26 D C E B A B

Figure 1 1) Given user input of 0, what value does the program in Figure 1 print? a) A b) B c) C d) D. 2) Given user input of 2, what value does the program in Figure 1 print? a) A b) B c) C d) D. 3) Given user input of 3, what value does the program in Figure 1 print? a) A b) B c) C d) D. 4) What input causes the else clause of Line 2 to be executed in Figure 1 a) odd integers b) even integers c) integers evenly divisible by three d) negative integers

. 5) What is the purpose of the : (colon) at the end of Line 1 of Figure 1 a) beginning of a compound statement (a suite) b) end of a compound statement (a suite) c) indication of a change of control in the program (a modifier) d) only there to make the program more readable (a kind of comment). 6) As an approximation, every 3 powers of 10 are about equal to what? a) 3 powers of 2 (10 3 ~ 2 3 ) b) 8 powers of 2 (10 3 ~ 2 8 ) c) 10 powers of 2 (10 3 ~ 2 10 ) d) 16 powers of 2 (10 3 ~ 2 16 ) 7) What is the index of the last element of every string? a) len(s) b) len(s) -1 c) len(s-1) d) -2 8) Python is an interpreted language. What does the term interpreted mean? a) Python understands the language and does what is required b) Python converts a program into machine language so it can be run c) Python runs each line of the program, one line at a time d) Python requires a special kind of CPU to be able to operate. 9) What is a namespace? a) A list of Python names b) A list of Python names and the values they are associated with. c) The list of allowable names that can be used in Python d) All of the above 10) Given the python statement myfloat = 3.14 which of the following statements are true? a) myfloat can only hold floating point values b) myfloat can only hold integer values c) myfloat can only hold any numeric value d) myfloat cannot hold Boolean values 11) Which of the following describes the advantages of modules? a) share knowledge with others about how to solve a particular problem

b) saving effort by allowing reuse of code by others c) verification of the code by use in many other systems d) All of the above Figure 2 12) Given the input abc what output is produced by Line1 in Figure 2? a) abc b) bca c) baa d) bcc 13) Given the input aabb what output is produced by Line1 in Figure 2? a) baa b) aabb c) bba d) abb 14) Given the input bccc what output is produced by Line1 in Figure 2? a) bcc b) bccc c) ccc d) bbc 15) Given the input ccbb what output is produced by Line1 in Figure 2? a) bcc b) bccc c) ccc d) bbc 16) Which of the following is a true statement(s) about Python slicing? a) a range, indicated with a :, is a half-open range b) a negative number starts counting from the end of the string, starting with -1 c) the first element in a string begins at index 0

d) All of the above Figure 3 17) What output is produced by Line 2 of Figure 3 on the input 1? a) 1 b) 3 c) 9 d) 16 18) What output is produced by Line 2 of Figure 3 on the input 3? a) 1 b) 3 c) 9 d) 16 19) What output is produced by Line 2 of Figure 3 on the input 5? a) 5 b) 144 c) 25 d) 256 20) For the program in Figure 3, what effect would there be in changing Line 1 from count < 5 to count <= 5? a) error, division by 0 b) no change, works exactly as before c) would go through the loop one more time d) error, infinite loop

Figure 4 21) Given the input abc123 what output is produced by Line 2 of Figure 4? a) [ a, b, c, 1, 2, 3 ] b) [ 1, 2, 3, a, b, c ] c) [ 0, 1, 2, a, b, c ] d) [ 0, 1, 2, b, c, d ] 22) Given the input 3.14159 what output is produced by Line 3 of Figure 4? a) 4 b) 5 c) 6 d) 7 23) Given the input $1000 what output is produced by Line 4 of Figure 4? a) 1 b) 2 c) 3 d) 4 24) If Line 1 were removed from Figure 4, what effect would it have? a) No effect b) infinite loop c) depends on the input string

d) error, index beyond the length of the string 25) What type does the variable pos contain in Figure 4? a) integer b) floating point value c) string d) Boolean 26) Which of the following are true statements regarding for loops and while loops? a) only a for loop can iterate through a sequence b) a while loop is the more general looping statement of the two c) the for loop requires a boolean in its statement header d) All of the above

27) Write a small program question 20pts. Please, write on scrap paper first, then copy your answer to the next page Requirements Write a program that: prompts for a 6 digit integer (no error checking required) break that integer into two smaller, 3 digit integers as follows: o the first, third and fifth digit make the first number o the second, fourth and sixth digit make the second number multiply the two numbers to create the product print out as indicated below Example given an input 123456 o prints 135 * 246 = 33210 given an input 111222 o prints 112 * 122 = 13664

Name: Section: