2010Fa CS10 Online Final Answers Section 1

Similar documents
What is an algorithm?

CSE548, AMS542: Analysis of Algorithms, Fall 2012 Date: October 16. In-Class Midterm. ( 11:35 AM 12:50 PM : 75 Minutes )

UNIVERSITY OF TORONTO Faculty of Arts and Science. Midterm Sample Solutions CSC324H1 Duration: 50 minutes Instructor(s): David Liu.

CS3L Summer 2011 Exam 2 Time: up to 170 minutes (you may leave when finished; or, you must stop promptly at noon)

Read and fill in this page now

CS 101 Spring 2007 Midterm 2 Name: ID:

Department of Electrical Engineering and Computer Sciences Spring 2001 Instructor: Dan Garcia CS 3 Midterm #2. Personal Information

Homework 7: Subsets Due: 11:59 PM, Oct 23, 2018

Macros & Streams Spring 2018 Discussion 9: April 11, Macros

Summer 2017 Discussion 10: July 25, Introduction. 2 Primitives and Define

CS251 Programming Languages Spring 2016, Lyn Turbak Department of Computer Science Wellesley College

Read and fill in this page now. Your instructional login (e.g., cs3-ab): Your lab section days and time: Name of the person sitting to your left:

Discussion 4. Data Abstraction and Sequences

SCHEME 8. 1 Introduction. 2 Primitives COMPUTER SCIENCE 61A. March 23, 2017

SCHEME 7. 1 Introduction. 2 Primitives COMPUTER SCIENCE 61A. October 29, 2015

CS 3 Midterm 1 Review

Homework 1. Reading. Problems. Handout 3 CSCI 334: Spring, 2012

CS : Programming for Non-majors, Summer 2007 Programming Project #2: Census Due by 12:00pm (noon) Wednesday June

Knowledge: This lab will help you become familiar with the following content knowledge:

EXAM PREPARATION SECTION 1

cd h: mkdir -p CS101 cd CS101 curl -O unzip zipfile cd CS101_Exam4

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

Homework 3: Recursion Due: 11:59 PM, Sep 25, 2018

Warm-up! CS 3 Final Review. Predict the output. Predict the Output. Predict the output. Predict the output. What is your favorite color?

Lecture Transcript While and Do While Statements in C++

6.001 Notes: Section 4.1

Design and Analysis of Algorithms Prof. Madhavan Mukund Chennai Mathematical Institute. Module 02 Lecture - 45 Memoization

Learning Recursion. Recursion [ Why is it important?] ~7 easy marks in Exam Paper. Step 1. Understand Code. Step 2. Understand Execution

Remaining Enhanced Labs

CS52 - Assignment 7. Due Friday 11/13 at 5:00pm.

CMSC 201 Spring 2017 Project 1 Number Classifier

CS : Programming for Non-majors, Fall 2018 Programming Project #2: Census Due by 10:20am Wednesday September

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))

Number System. Introduction. Natural Numbers (N) Whole Numbers (W) Integers (Z) Prime Numbers (P) Face Value. Place Value

n! = 1 * 2 * 3 * 4 * * (n-1) * n

RECURSION 7. 1 Recursion COMPUTER SCIENCE 61A. October 15, 2012

CS 415 Midterm Exam Fall 2003

RECURSION: n. SEE RECURSION 3

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

CS3 Midterm 1 Fall 2006

CS 101 Fall 2006 Midterm 1 Name: ID:

Number Systems Using and Converting Between Decimal, Binary, Octal and Hexadecimal Number Systems

Homework Assignment #3b Due 11/22 at 3:50pm EE122 Fall 2010

CS3 Fall 05 Midterm 1 Standards and Solutions

STUDENT LESSON A9 Recursion

CMSC 201 Fall 2016 Lab 09 Advanced Debugging

Foundations, Reasoning About Algorithms, and Design By Contract CMPSC 122

Mark Important Points in Margin. Significant Figures. Determine which digits in a number are significant.

Read and fill in this page now. Your lab section day and time: Name of the person sitting to your left: Name of the person sitting to your right:

Excerpt from "Art of Problem Solving Volume 1: the Basics" 2014 AoPS Inc.

CSCE 145 Exam 1 Review. This exam totals to 100 points. Follow the instructions. Good luck!

MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Midterm #2 Examination 12:30 noon, Thursday, March 15, 2012

Lab 7: OCaml 12:00 PM, Oct 22, 2017

The Beauty and Joy of Computing 1 Lab Exercise 4: Starting a simple math tutor program and more interaction

CIS 194: Homework 6. Due Monday, February 25. Fibonacci numbers

Remember, this question was mis-worded: you could also add quoted words and sentences in the blanks below. This allowed for a solution to [4] below.

COMP 202 Recursion. CONTENTS: Recursion. COMP Recursion 1


Fall 2018 Discussion 8: October 24, 2018 Solutions. 1 Introduction. 2 Primitives

CS150 Sample Final. Name: Section: A / B

Assignment 4: Due Friday Mar 11 at 6pm

Moving Materials from Blackboard to Moodle

Python lab session 1

TUPLES AND RECURSIVE LISTS 5

What is a Fraction? Fractions. One Way To Remember Numerator = North / 16. Example. What Fraction is Shaded? 9/16/16. Fraction = Part of a Whole

Positive Pay. Quick Start Set-up Guide

CMSC 201 Spring 2019 Lab 06 Lists

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

CS 340 Spring 2019 Midterm Exam

COP 3014: Fall 2017 Homework 4

CS 61B Summer 2005 (Porter) Midterm 2 July 21, SOLUTIONS. Do not open until told to begin

Review Response Submission Form

Creating a multilingual site in WebPlus

Camtasia Studio 7 User Guide

Computer Science AP/X CSCI-140/242 Polygons Lab 2 8/30/2018

CS150 - Sample Final

The Beauty and Joy of Computing 1 Lab Exercise 9: Problem self-similarity and recursion - Python version

APCS Semester #1 Final Exam Practice Problems

TAIL CALLS, ITERATORS, AND GENERATORS 11

ENGG1811 Computing for Engineers Week 1 Introduction to Programming and Python

Office 2016 Excel Basics 12 Video/Class Project #24 Excel Basics 12: Formula Types and Formula Elements

Learning Rhino 3D. Modelling a fork

Our First Programs. Programs. Hello World 10/7/2013

About these slides Prolog programming hints

CMSC 201 Spring 2018 Project 3 Minesweeper

CIS 110 Introduction To Computer Programming. February 29, 2012 Midterm

Project 2 Interpreter for Snail. 2 The Snail Programming Language

CMPSCI 250: Introduction to Computation. Lecture #22: Graphs, Paths, and Trees David Mix Barrington 12 March 2014

Homework 1. Notes. What To Turn In. Unix Accounts. Reading. Handout 3 CSCI 334: Spring, 2017

Variables, Data Types, and Arithmetic Expressions Learning Objectives:

Com S 127 Lab 2. For the first two parts of the lab, start up Wing 101 and use the Python shell window to try everything out.

Counting Problems; and Recursion! CSCI 2824, Fall 2012!

Problem 1. Remove consecutive duplicates (6 points, 11 mintues)

USFQ CUSTOMIZED PROGRAMS ONLINE APPLICATION GUIDELINE

CS 61A Higher Order Functions and Recursion Fall 2018 Discussion 2: June 26, Higher Order Functions. HOFs in Environment Diagrams

(Refer Slide Time: 01.26)

Discussion 2C Notes (Week 5, February 4) TA: Brian Choi Section Webpage:

CS Final Exam. Stanford University Computer Science Department. June 5, 2012 !!!!! SKIP 15 POINTS WORTH OF QUESTIONS.!!!!!

Question 2. [2 points] True False By default, structures are passed-by-reference.

University of Washington CSE 140 Data Programming Winter Final exam. March 11, 2013

Transcription:

2010Fa CS10 Online Final Answers Section 1 Instructions: Save the file containing your answers with the name FinalYourfirstnameYourlastname.ypr (e.g., FinalBarackObama.ypr). You can assume that all the inputs that your program will ever be given are valid, so you do not have to perform any error checking. You will submit your solution on bspace. When you are done, go to the Assignments tab and click on the Online Final assignment corresponding to your lab section. Upload your file, and do not forget to click Submit! Take a deep breath and calm down before moving on: this exam is not worth having heart failure about. Good luck! 1. Create the block that takes in a minimum and a maximum, and reports a list of numbers from the minimum to the maximum (both inclusive). So, for example, You can approach this question using any of the techniques that you have learned in this class. 2. Create the block that takes in a word and reports a list of all of the characters in that word. So, for example,

Again, you can approach this question using any of the techniques that you have learned in this class. 3. A number is called pandigital if it uses all of the digits from 1 to n exactly once, where n is the number of digits in the number. So, for example, the five-digit number 15432 is pandigital, but the five-digit number 11132 is not. Again, the four-digit number 4123 is pandigital, but the four-digit number 8312 is not. Finally, the one-digit number 1 is pandigital, but the one-digit number 3 is not. Create a predicate block that checks if a number satisfies the definition above. The block should, for example, report true for the following: and false for the following: You should use higher-order functions in your solution. You cannot use explicit tab and the HOF blocks from ToolSprite. You will find the blocks that you created in earlier questions useful.

4. Using your block from question 3, have Alonzo say all of the pandigital numbers between 1 and 135 in a comma-separated sentence when the green flag is clicked. There are five pandigital numbers between 1 and 135, so Alonzo should say 1, 12, 21, 123, 132 when the green flag is clicked. This may take 1-2 minutes to compute, so don t worry if Alonzo doesn t speak up right away. You should use higher-order functions in your solution. You cannot use explicit tab and the HOF blocks from ToolSprite. You will find the blocks that you created in earlier questions useful.

2010Fa CS10 Online Final Section 2 Instructions: Save the file containing your answers with the name FinalYourfirstnameYourlastname.ypr (e.g., FinalBarackObama.ypr). You can assume that all the inputs that your program will ever be given are valid, so you do not have to perform any error checking. You will submit your solution on bspace. When you are done, go to the Assignments tab and click on the Online Final assignment corresponding to your lab section. Upload your file, and do not forget to click Submit! Take a deep breath and calm down before moving on: this exam is not worth having heart failure about. Good luck! 1. Create the block that takes in a minimum and a maximum, and reports a list of numbers from the minimum to the maximum (both inclusive). So, for example, You can approach this question using any of the techniques that you have learned in this class. 2. Create the block that takes in a word and reports a list of all of the characters in that word. So, for example,

Again, you can approach this question using any of the techniques that you have learned in this class. 3. We will call a number narcissistic if it satisfies the following property: if the number has n digits, then it should be the sum of all of its digits, each raised to the nth power. So, for example, the number 153 is narcissistic, because 153 is a 3-digit number, and if you were to raise each digit to the third power -- 1 3, 5 3, 3 3 -- and add them, then you would get 153 back. In other words, 153 = 1 3 + 5 3 + 3 3. 1634 is also a narcissistic number, since 1634 = 1 4 + 6 4 + 3 4 + 4 4. Create a predicate block that checks if a number satisfies the definition above. The block should, for example, report true for the following: You should use higher-order functions in your solution. You cannot use explicit tab and the HOF blocks from ToolSprite. You will find the blocks that you created in earlier questions useful. You may also find it useful to write the block that raises the first input to the second input (where both inputs are always positive integers). However, the same restrictions apply for this block: you should use higherorder functions in your solution. You cannot use explicit recursion or the yellow and orange loop constructs (such as repeat, repeat until, and for); you can, however, use the built-in list blocks in the Variables tab and the HOF blocks

from ToolSprite. You will find the blocks that you created in earlier questions useful. 4. Using your block from question 3, have Alonzo say all of the narcissistic numbers between 1 and 160 in a comma-separated sentence when the green flag is clicked. There are ten narcissistic numbers between 1 and 160, so Alonzo should say 1, 2, 3, 4, 5, 6, 7, 8, 9, 153 when the green flag is clicked. This may take 1-2 minutes to compute, so don t worry if Alonzo doesn t speak up right away. You should use higher-order functions in your solution. You cannot use explicit tab. You will find the blocks that you created in earlier questions useful.

2010Fa CS10 Online Final Section 3 Instructions: Save the file containing your answers with the name FinalYourfirstnameYourlastname.ypr (e.g., FinalBarackObama.ypr). You can assume that all the inputs that your program will ever be given are valid, so you do not have to perform any error checking. You will submit your solution on bspace. When you are done, go to the Assignments tab and click on the Online Final assignment corresponding to your lab section. Upload your file, and do not forget to click Submit! Take a deep breath and calm down before moving on: this exam is not worth having heart failure about. Good luck! 1. Create the block that takes in a minimum and a maximum, and reports a list of numbers from the minimum to the maximum (both inclusive). So, for example, You can approach this question using any of the techniques that you have learned in this class. 2. Create the block that takes in a word and reports a list of all of the characters in that word. So, for example,

Again, you can approach this question using any of the techniques that you have learned in this class. 3. A number is called a factorion if it is equal to the sum of the factorials of its digits. For example, 145 is a factorion since 145 = 1! + 4! + 5! (Remember that n! is the fancy, mathematical way of denoting the factorial of n, which is the product of all of the numbers from 1 to the number n.) Another, relatively simpler example of a factorion is 2, since 2 is equal to 2! (We re not exclaiming there.) Create a predicate block that checks if a number is a factorion. The block should, for example, report true for the following: You should use higher-order functions in your solution. You cannot use either explicit recursion, or the yellow and orange loop constructs (such as repeat, repeat until, and for); you can, however, use the built-in list blocks in the Variables tab and the HOF blocks from ToolSprite. You will find the blocks that you created in earlier questions useful. You may also find it useful to write the block that finds the factorial of its input. However, the same restrictions apply for this block: you should use higher-order functions in your solution. You cannot use explicit tab and the HOF blocks from ToolSprite. You will find the blocks that you created in earlier questions useful.

4. Using your block from question 3, have Alonzo say all of the factorions between 1 and 150 in a comma-separated sentence when the green flag is clicked. There are three factorions between 1 and 150, so Alonzo should say 1, 2, 145 when the green flag is clicked. This may take 1-2 minutes to compute, so don t worry if Alonzo doesn t speak up right away. You should use higher-order functions in your solution. You cannot use explicit tab and the HOF blocks from ToolSprite. You will find the blocks that you created in earlier questions useful.