(the bubble footer is automatically inserted into this space)

Similar documents
Spring 2017 CS 1110/1111 Exam 1

Spring 2017 CS 1110/1111 Exam 2

Spring 2017 CS 1110/1111 Exam 3

1 Fall 2017 CS 1110/1111 Exam 3

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

CS 111X - Fall Test 1

CSE 131 Introduction to Computer Science Fall 2016 Exam I. Print clearly the following information:

(the bubble footer is automatically inserted into this space)

CS 111X - Fall Test 1 - KEY KEY KEY KEY KEY KEY KEY

Short Answer Questions (40 points)

CSE 131 Introduction to Computer Science Fall Exam I

CSE 131 Introduction to Computer Science Fall Exam I

CS 1301 Exam 1 Fall 2010

CS 115 Lecture 8. Selection: the if statement. Neil Moore

(the bubble footer is automatically inserted into this space)

(the bubble footer is automatically inserted in this space)

(the bubble footer is automatically inserted into this space)

CS 1301 Exam 1 Fall 2010

Using C++, design an Abstract Data Type class named MyGrades. The class must have the following private members :

Decision Logic: if, if else, switch, Boolean conditions and variables

CS 111X - Spring Final Exam - KEY

CSE 131 Introduction to Computer Science Fall Exam II

CS112 Spring 2012 Dr. Kinga Dobolyi. Exam 2. Do not open this exam until you are told. Read these instructions:

CSCE 110: Programming I

(the bubble footer is automatically inserted into this space)

CSE 131S Introduction to Computer Science Summer SON Exam I

CSE 247 Data Structures and Algorithms Fall Exam I

CSE 131 Introduction to Computer Science Fall Exam II

Engineering 100 Midterm Exam Technical Part Fall 2010

CS 1301 Exam 3 Fall 2014

CS3330 Spring 2015 Exam 2 Page 1 of 6 ID:

CS 216 Fall 2007 Midterm 1 Page 1 of 10 Name: ID:

(the bubble footer is automatically inserted in this space)

Do not start the test until instructed to do so!

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

The print queue was too long. The print queue is always too long shortly before assignments are due. Print your documentation

CSE 131 Introduction to Computer Science Fall Exam I

6.S189 Homework 1. What to turn in. Exercise 1.1 Installing Python. Exercise 1.2 Hello, world!

Functional Programming, Classes, and Recursion!

CSE 131 Introduction to Computer Science Fall Exam III

CS 1301 Exam 2 Fall 2013

CS 1110, LAB 1: PYTHON EXPRESSIONS.

CS 2316 Exam 1 Spring 2013

CS 3L (Clancy) Solutions and grading standards for exam 1

CS 1301 Exam 1 Spring 2014

CS 1301 Exam 2 Fall 2010

CS 190C: Introduction to Computational Thinking

a f b e c d Figure 1 Figure 2 Figure 3

Lecture 4. Defining Functions

CS 2316 Exam 4 Fall 2011

CSE 131 Introduction to Computer Science Fall Final Exam

CS 1803 Pair Homework 3 Calculator Pair Fun Due: Wednesday, September 15th, before 6 PM Out of 100 points

(the bubble footer is automatically inserted into this space)

Professor Program. Grading Scantron Exams

CS3330 Exam 1 Spring Name: CS3330 Spring 2015 Exam 1 Page 1 of 6 ID: KEY

CS 1301 Exam 1 Spring 2014

Good Evening! Welcome!

CS 2316 Exam 3 Fall 2011

Computer Security Spring 2010 Paxson/Wagner HW 4. Due Thursday April 15, 5:00pm

EECS 183 Fall 2015 Exam 2 Free Response (134 points)

Assessment - Unit 3 lessons 16-21

CSE 131 Introduction to Computer Science Fall Exam II

University of Michigan EECS 183: Elem. Programming Concepts Fall 2011 Exam 1: Part 1: Form 1. Professors: ML Dorf, Elliot Soloway

(the bubble footer is automatically inserted into this space)

(the bubble footer is automatically inserted into this space)

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

Your (printed!) Name: CS 1803 Exam 3. Grading TA / Section: Monday, Nov. 22th, 2010

SQL: Data Definition Language. csc343, Introduction to Databases Diane Horton Fall 2017

Control Structures. A program can proceed: Sequentially Selectively (branch) - making a choice Repetitively (iteratively) - looping

Last Name: First Name: Cornell NetID, all caps: CS 1110 Regular Prelim 1 Solutions March 2018

Programming Standards: You must conform to good programming/documentation standards. Some specifics:

Prelim 1. CS 2110, September 29, 2016, 7:30 PM Total Question Name Loop invariants

CS3330 Fall 2014 Exam 2 Page 1 of 6 ID:

If you are still writing when pens down is called, your exam will be ripped up and not graded sorry to have to be strict on this!

CS 2150 Exam 1, Spring 2018 Page 1 of 6 UVa userid:

Review Sheet for Midterm #1 COMPSCI 119 Professor William T. Verts

CS 31: Intro to Systems Binary Arithmetic. Martin Gagné Swarthmore College January 24, 2016

Sending an to Your Chapter Through Neon

CS143 Final Spring 2016

CS 2316 Exam 4 Fall 2011

CS 170 Exam 2. Version: A Fall Name (as in OPUS) (print): Instructions:

(the bubble footer is automatically inserted in this space)

CS 1301 Exam 1 Spring 2011

CS 1301 Exam 1 Fall 2014

Final Exam CS 152, Computer Programming Fundamentals December 9, 2016

CS 3330 Exam 3 Fall 2017 Computing ID:

CS 1803 Fall 2010 Exam 1

CSCI 135 Exam #0 Fundamentals of Computer Science I Fall 2012

Logical Thinking through Computer Programming

The Program Specification:

CSE 131S Introduction to Computer Science Summer SON Exam III

CS Name : Grading TA:

CS 1110 Prelim 1, March 2018

CS 2150 Exam 2, Spring 2018 Page 1 of 6 UVa userid:

Version B Final Exam

CS 1301 Exam 1 Fall 2014

Intro to Python Programming

CS 1044 Project 1 Fall 2011

CS 415 Midterm Exam Fall 2003

CS 1301 Exam 2 A Fall 2015

Transcription:

CS 1110 Exam 1, Fall 2018 Page 1 of 8 UVa userid: CS 1110 Exam 1 Name Bubble in your computing ID in the footer of this page. We use an optical scanner to read it, so fill in the bubbles darkly. If you have a shorter ID, leave some rows blank. In case we have trouble with the scanner, please also legibly print your computing id at the top of each page. Also print your name on this page. Please follow these rules throughout the exam: Write legibly; we deduct points if we are unsure what you wrote. Indentation and punctuation do matter. Write on the lines, where possible. If you need to insert a line between two you ve written, make it clear what you are doing. We grade one page at a time. Do not spill answers onto another page. Don t add features we didn t request: only print if we ask you to print, etc. The exam is being given in multiple locations simultaneously, so we cannot fairly answer student questions during the exam. If you find a question ambiguous or unclear, write that down on your exam next to the question and we will give it due consideration during grading. 1. [4 points] Pledge On my honor as a student I have neither given nor received aid on this exam. signed: 2. [4 points] Bubbles Fill in the bubble footer with your computing id: Do not write in this area 0 1 2 3 4 5 6 7 8 9 Department Course Exam Page Version (the bubble footer is automatically inserted into this space)

CS 1110 Exam 1, Fall 2018 Page 2 of 8 UVa userid: Page 2: 3. [12 points] Display and Return Fill in the following table. Displayed in Console means anything that shows up in the output window, whether printed or error message; if an error message answering Error is sufficient, no need to say more. If the code does not display anything then write Nothing. Assume that every time the user is required to type something, they type 34. The first row is done for you Code Displayed in Console Evaluates To 7+5 Nothing 12 print( don\ t, panic ) input( What number ) 2 ((2/1)==2) and ( 10 == ( 1 + 0 )) int(1/2) print(100 + % ) 1 (23 % 12)

CS 1110 Exam 1, Fall 2018 Page 3 of 8 UVa userid: Page 3: 4. [14 points] Evaluate Fill in the following table. The first row is done for you Expression Value Type 7+5 12 int 4/2 int( float ( 1.87 )) 1 2 type(3)==type( 3 ) (1/2) 2 2 3 int( 13 2) + 15

CS 1110 Exam 1, Fall 2018 Page 4 of 8 UVa userid: Page 4: 5. [14 points] What does this print? Give all text printed exactly as this program will print it. def f ( ) : global x x = 2 y = x 2 return y / x x = 3 y = 5 z = f ( ) print ( f ( ) ) print ( x, y, z )

CS 1110 Exam 1, Fall 2018 Page 5 of 8 UVa userid: Page 5: 6. [10 points] Cheers Write a function called cheer which receives an int as an argument which identifies how many times we should cheer. The output should be a string representing the cheer. When we cheer, every third word should be Hooray, and all other words should be Hip. For example, if we cheer 3 times we say HipHipHooray if we cheer 1 time we say Hip if we cheer 7 times we say HipHipHoorayHipHipHoorayHip Complete the function by giving expressions for values of y and z which achieve the required outputs. def cheer ( x ) : y = # Your answer here z = # Your answer here return ( HipHipHooray y ) + ( Hip z )

CS 1110 Exam 1, Fall 2018 Page 6 of 8 UVa userid: Page 6: 7. [12 points] if statements Consider the following code: i f 0 < x : print ( h e l l o ) e l i f 0 > x : print ( goodbye ) else : i f x ==0: print ( welcome ) Give an int value for x which will cause the code to print each of the following (or say it isn t possible). When we say Nothing displayed, we mean nothing is shown in the console (not that the text Nothing Displayed gets printed). Value of x Thing that is printed hello goodbye welcome Nothing Displayed

CS 1110 Exam 1, Fall 2018 Page 7 of 8 UVa userid: Page 7: 8. [15 points] Baggage Fees Write a function called baggage fee which receives the weight of a bag (which is a float) as an argument, and returns a float representing how much an airline would charge for a checked bag of that weight. The airline will charge based on the following rules: The first up to 50.0 pounds will cost 30.0 total Bags over 50.0 pounds will incur additional cost at a rate of 1.50 per pound For example, a bag weighing 10.0 pounds will cost 30.0, and a bag 50.5 pounds will cost 30.75 There is no need to round your answer. We don t care what your function does when its argument is not a float

CS 1110 Exam 1, Fall 2018 Page 8 of 8 UVa userid: Page 8: 9. [15 points] Account Balance Write Python code to define a function called make transaction which receives a float representing a deposit/withdrawal from a bank account as an argument. Deposits will have a positive value, withdrawals a negative value. After each transaction, the function will print the new account balance as a side effect. The balance starts at 0. For example, if we call: make transaction ( 5. 2 ) make transaction ( 2.1) make transaction ( 1 ) the program will print out: 5.2 3.1 4.1 We don t care what your function does when its argument is not a float