: Principles of Imperative Computation Victor Adamchik. Practice Exam - I
|
|
- Ami Daniel
- 6 years ago
- Views:
Transcription
1 Practice Exam - I Page 1 of : Principles of Imperative Computation Victor Adamchik Practice Exam - I Name: Andrew ID: Answer the questions in the space provided following each question. We must be able to clearly understand your answer. It it is vague or confused, it will be marked wrong. Be sure to read the directions to each question carefully so that you know what it is asking for. Question Points Score Total: 100
2 Practice Exam - I Page 2 of 10
3 Practice Exam - I Page 3 of Modular Arithmetic. (a) In C 0, values of type int are defined to have 32 bits. In this problem we work with a version of C0 where values of type int are defined to have only 7 bits. All integer operations are still in two s complement arithmetic, but now modulo 2 7. For each of the following statements fill in the missing quantities, in the specified notation. (3) i. The minimal negative integer, in decimal: (3) ii. The maximal positive integer, in decimal: (3) iii. 4, in hexadecimal: (3) iv. 44, in hexadecimal: (3) v. 0x48, in decimal:
4 Practice Exam - I Page 4 of 10 (b) Assume int x, y, z has been declared in C 0 and initialized to unknown values. For each of the following, indicate if the expression always evaluates to true, or if it could sometimes be false. Explain your answer. (3) i. x-1 < x (3) ii. y * (x/y) + x % y = x. (3) iii. ~(x ~ (~ x)) == -1 (3) iv. x <= (1<<31)-1 (3) v. x+x == 2*x (3) vi. If x+z = y+z, then x = y.
5 Practice Exam - I Page 5 of 10 (3) vii. Using only bitwise operators, find the k-th bit in the two s complement of the C 0 integer n. (3) viii. Compute in binary using 8-bit two s complement representation.
6 Practice Exam - I Page 6 of Wild Elephant Safari. Your computer is on safari to find an elephant in Africa. It assumes that Africa corresponds to a rectangular array represented as a one-dimensional array A. In the array A, the presence of an elephant is marked by number 9. The program on the next page looks at every element of the array from north to south and, on each row, from west to east. Unfortunately, it fails to find the elephant, even though there is at least one elephant in Africa. The reason is that elephants may move while your computer is searching for them. An elephant may move to a position that your program already looked at in an earlier iteration. A computational zoologist confirms that elephants may move at every step of your function implementation that executes an assignment or increment/decrement (like i++ or i--). Elephants move either 1 cell in the north-south direction or 1 cell in the east-west direction, which concurrently changes the memory contents of array A by swapping an elephant to a neighbor cell. The computational zoologist also knows that elephants never travel farther than 1 move away from their home cell! Hint: You decide to change your program so that when it checks for elephants at a cell, it also looks for the elephant in the immediate neighbor cells, just in case the elephant has moved. The computational zoologist warns you that you need to look around to neighboring cells without using assignments or increment/decrements or else the elephant may move away again. (5) (a) Fill in the requires and ensures clauses of the safari function (see next page). (5) (b) Fix the loop invariants in the safari function if they are broken (see next page). (12) (c) The safari function is broken. Fix the implementation of the safari function (see next page), so that it always finds an elephant. Make sure you clearly add a new statement, and clearly modify or delete a given statement, or clearly rewrite the implementation as needed. (d) (5) What is the worst-case asymptotic complexity of your safari implementation as a function of width and height, in big-o notation? Please briefly justify your answer.
7 Practice Exam - I Page 7 of 10 typedef int elephants; int safari(elephants[] A, int width, int height) //@requires ; //@requires ; //@requires ; //@ensures ; { } for (int i = 0; i < height; i++) //@loop_invariant 0 < i && i <= height; { for (int j = 0; j < width; j++) //@loop_invariant 0 < j && j <= width; { int r = i * width; int e = r + j; if (A[e] == 9) return e; } } // there IS an elephant in Africa, so cannot get here //@assert false; return -1;
8 Practice Exam - I Page 8 of Asymptotic Notations. (5) (a) Provide the formal definition of the big-o notation and briefly state the two key ideas behind this definition in two sentences and briefly explain why and how it captures those key ideas: (b) For each of the following, indicate if the statement is true or false. (2) i. O(n n log n ) = O(5n 2 1) (2) ii. O(n log(n)) = O(n 2 ) (2) iii. O(n 2 ) = O(n log(n)) (2) iv. O(3 log 2 n) = O(2 log 3 n) (2) v. O((10 log n + 3 5) n) = O(n log(n 3 )) (2) vi. O((log n + 3 n) (n 2 + (log n)/2 + n)) = O((1 + n) 2 (log(log n) + n log n)) (2) vii. O(2 n ) = O(2 2n )
9 Practice Exam - I Page 9 of 10 (15) 4. Linked Lists. Recall the definition of linked lists: struct list { int data; // a decimal digit struct list* next; }; typedef struct list* list; We define struct ring { list start; // a pointer to the first node in the ring int size; // the ring size }; typedef struct ring* ring; A ring is represented as a circular linked list with one node designated as a start. For example, a ring with items 1, 2, 3, 4, 5 (in this order, 1 at the front and 5 at the back) would be represented as the following ring: data next data next 1 ring 5 start size
10 Practice Exam - I Page 10 of 10 As an example, here is a function that checks if the ring is empty. bool ring_empty(ring R) //@requires is_ring(r); { return R->start == NULL && R->size == 0; } Write a function (and contracts) that creates a new ring from a given string, such that each character is a node in the list. Any errors in inputs must be handled by contracts. The first digit of the string must be pointed by R->start. For example, the function call ring_new("12345") will create a ring as depicted in the picture above. To convert a char to an int, you should use ascii values, in particular 0 has value 48 and 9 has value 57. The C 0 string library is provided to you in the appendix. ring ring_new(string str){
Midterm I Exam Principles of Imperative Computation André Platzer Ananda Gunawardena. February 23, Name: Andrew ID: Section:
Midterm I Exam 15-122 Principles of Imperative Computation André Platzer Ananda Gunawardena February 23, 2012 Name: Andrew ID: Section: Instructions This exam is closed-book with one sheet of notes permitted.
More informationMidterm I Exam Principles of Imperative Computation André Platzer Ananda Gunawardena. February 23, 2012
Midterm I Exam 15-122 Principles of Imperative Computation André Platzer Ananda Gunawardena February 23, 2012 Name: Sample Solution Andrew ID: aplatzer Section: Instructions This exam is closed-book with
More informationMidterm I Exam Principles of Imperative Computation Frank Pfenning. February 17, 2011
Midterm I Exam 15-122 Principles of Imperative Computation Frank Pfenning February 17, 2011 Name: Sample Solution Andrew ID: fp Section: Instructions This exam is closed-book with one sheet of notes permitted.
More informationExam I Principles of Imperative Computation, Summer 2011 William Lovas. May 27, 2011
Exam I 15-122 Principles of Imperative Computation, Summer 2011 William Lovas May 27, 2011 Name: Sample Solution Andrew ID: wlovas Instructions This exam is closed-book with one sheet of notes permitted.
More informationMidterm I Exam Principles of Imperative Computation Frank Pfenning, Tom Cortina, William Lovas. September 30, 2010
Midterm I Exam 15-122 Principles of Imperative Computation Frank Pfenning, Tom Cortina, William Lovas September 30, 2010 Name: Andrew ID: Instructions This exam is closed-book with one sheet of notes permitted.
More informationComputer Organization & Systems Exam I Example Questions
Computer Organization & Systems Exam I Example Questions 1. Pointer Question. Write a function char *circle(char *str) that receives a character pointer (which points to an array that is in standard C
More informationMidterm II Exam Principles of Imperative Computation Frank Pfenning. March 31, 2011
Midterm II Exam 15-122 Principles of Imperative Computation Frank Pfenning March 31, 2011 Name: Sample Solution Andrew ID: fp Section: Instructions This exam is closed-book with one sheet of notes permitted.
More informationMidterm 1 Exam Principles of Imperative Computation. Thursday 6 th October, This exam is closed-book with one sheet of notes permitted.
Midterm 1 Exam 15-122 Principles of Imperative Computation Thursday 6 th October, 2016 Name: Andrew ID: Recitation Section: Instructions This exam is closed-book with one sheet of notes permitted. You
More informationMidterm 1 Solutions Principles of Imperative Computation. Thursday 6 th October, 2016
Midterm 1 Solutions 15-122 Principles of Imperative Computation Thursday 6 th October, 2016 Name: Harry Bovik Andrew ID: bovik Recitation Section: S Instructions This exam is closed-book with one sheet
More information15 122: Principles of Imperative Computation. Practice Exam August 4, 2015
15 122: Principles of Imperative Computation Practice Exam August 4, 2015 15-122 Practice Exam Page 2 of 17 1. Fun with C. The following C programs have between 0 and 1 errors in them. If the function
More informationFinal Exam Principles of Imperative Computation Frank Pfenning, Tom Cortina, William Lovas. December 10, Name: Andrew ID: Section:
Final Exam 15-122 Principles of Imperative Computation Frank Pfenning, Tom Cortina, William Lovas December 10, 2010 Name: Andrew ID: Section: Instructions This exam is closed-book with one sheet of notes
More informationYou must include this cover sheet. Either type up the assignment using theory5.tex, or print out this PDF.
15-122 Assignment 5 Page 1 of 11 15-122 : Principles of Imperative Computation Fall 2012 Assignment 5 (Theory Part) Due: Tuesday, October 30, 2012 at the beginning of lecture Name: Andrew ID: Recitation:
More informationSample Examination. Family Name:... Other Names:... Signature:... Student Number:...
Family Name:... Other Names:... Signature:... Student Number:... THE UNIVERSITY OF NEW SOUTH WALES SCHOOL OF COMPUTER SCIENCE AND ENGINEERING Sample Examination COMP1917 Computing 1 EXAM DURATION: 2 HOURS
More informationLecture Notes on Binary Search Trees
Lecture Notes on Binary Search Trees 15-122: Principles of Imperative Computation Frank Pfenning Lecture 17 1 Introduction In the previous two lectures we have seen how to exploit the structure of binary
More informationPrint out this PDF double-sided, staple pages in order, and write your answers on these pages neatly.
15-122 : Principles of Imperative Computation, Fall 2015 Written Homework 5 Due: Monday, October 5, 2015 by 6PM Name: Andrew ID: Section: This written homework covers big-o notation, some reasoning about
More informationLecture Notes on Binary Search Trees
Lecture Notes on Binary Search Trees 15-122: Principles of Imperative Computation Frank Pfenning André Platzer Lecture 15 March 6, 2014 1 Introduction In this lecture, we will continue considering associative
More informationCSE 332, Spring 2010, Midterm Examination 30 April 2010
CSE 332, Spring 2010, Midterm Examination 30 April 2010 Please do not turn the page until the bell rings. Rules: The exam is closed-book, closed-note. You may use a calculator for basic arithmetic only.
More informationLecture Notes on Memory Layout
Lecture Notes on Memory Layout 15-122: Principles of Imperative Computation Frank Pfenning André Platzer Lecture 11 1 Introduction In order to understand how programs work, we can consider the functions,
More informationExam Principles of Imperative Computation, Summer 2011 William Lovas. June 24, 2011
Exam 3 15-122 Principles of Imperative Computation, Summer 2011 William Lovas June 24, 2011 Name: Andrew ID: Instructions This exam is closed-book with one double-sided sheet of notes permitted. You have
More informationCSE 373 Winter 2009: Midterm #1 (closed book, closed notes, NO calculators allowed)
Name: Email address: CSE 373 Winter 2009: Midterm #1 (closed book, closed notes, NO calculators allowed) Instructions: Read the directions for each question carefully before answering. We may give partial
More informationMidterm 2 Exam Principles of Imperative Computation. Tuesday 31 st March, This exam is closed-book with one sheet of notes permitted.
Midterm 2 Exam 15-122 Principles of Imperative Computation Tuesday 31 st March, 2015 Name: Andrew ID: Recitation Section: Instructions This exam is closed-book with one sheet of notes permitted. You have
More informationYou must print this PDF and write your answers neatly by hand. You should hand in the assignment before recitation begins.
15-122 Homework 4 Page 1 of 13 15-122 : Principles of Imperative Computation, Summer 1 2014 Written Homework 4 Due: Thursday, June 12 before recitation Name: Andrew ID: Recitation: In this assignment,
More informationComputer Science Foundation Exam
Computer Science Foundation Exam August 26, 2017 Section I A DATA STRUCTURES NO books, notes, or calculators may be used, and you must work entirely on your own. Name: UCFID: NID: Question # Max Pts Category
More informationLecture 8 Data Structures
Lecture 8 Data Structures 15-122: Principles of Imperative Computation (Spring 2018) Frank Pfenning, André Platzer, Rob Simmons, Iliano Cervesato In this lecture we introduce the idea of imperative data
More informationLecture Notes on Binary Search Trees
Lecture Notes on Binary Search Trees 15-122: Principles of Imperative Computation Frank Pfenning André Platzer Lecture 16 March 17, 2015 1 Introduction In this lecture, we will continue considering ways
More informationLecture 15 Notes Binary Search Trees
Lecture 15 Notes Binary Search Trees 15-122: Principles of Imperative Computation (Spring 2016) Frank Pfenning, André Platzer, Rob Simmons 1 Introduction In this lecture, we will continue considering ways
More informationYou must include this cover sheet. Either type up the assignment using theory4.tex, or print out this PDF.
15-122 Assignment 4 Page 1 of 12 15-122 : Principles of Imperative Computation Fall 2012 Assignment 4 (Theory Part) Due: Thursday, October 18, 2012 at the beginning of lecture Name: Andrew ID: Recitation:
More informationLecture 15 Binary Search Trees
Lecture 15 Binary Search Trees 15-122: Principles of Imperative Computation (Fall 2017) Frank Pfenning, André Platzer, Rob Simmons, Iliano Cervesato In this lecture, we will continue considering ways to
More informationUNIVERSITY OF TORONTO FACULTY OF APPLIED SCIENCE AND ENGINEERING
UNIVERSITY OF TORONTO FACULTY OF APPLIED SCIENCE AND ENGINEERING APS 105 Computer Fundamentals Final Examination December 16, 2013 2:00 p.m. 4:30 p.m. (150 minutes) Examiners: J. Anderson, B. Korst, J.
More informationDo not start the test until instructed to do so!
Instructions: Print your name in the space provided below. This examination is closed book and closed notes, aside from the permitted one-page formula sheet. No calculators or other electronic devices
More informationMost of this PDF is editable. You can either type your answers in the red boxes/lines, or you can write them neatly by hand.
15-122 : Principles of Imperative Computation, Spring 2016 Written Homework 5 6 Due: Monday 22 nd February, 2016 Name:q1 Andrew ID:q2 Section:q3 This written homework covers big-o notation, some reasoning
More informationCS32 Final Exam. E03, F15, Phill Conrad, UC Santa Barbara
1 #1 Page: 1 Name: CS32 Final E03, F15, Phill Conrad, UC Santa Barbara Thursday, 12/10/2015, noon 3pm Name: Umail Address: @ umail.ucsb.edu Please write your name above AND AT THE TOP OF EVERY PAGE Be
More informationYou must print this PDF and write your answers neatly by hand. You should hand in the assignment before recitation begins.
15-122 Homework 5 Page 1 of 15 15-122 : Principles of Imperative Computation, Summer 1 2014 Written Homework 5 Due: Thursday, June 19 before recitation Name: Andrew ID: Recitation: Binary search trees,
More informationSOME TYPICAL QUESTIONS, THEIR EXPECTED ANSWERS AND THINGS
SOME TYPICAL QUESTIONS, THEIR EXPECTED ANSWERS AND THINGS TO WATCH OUT FOR ON THE TEST Nivedita Chopra 1: Contracts (The following question is Question 1 on Written Homework 2) Consider the following implementation
More informationLecture 18 Restoring Invariants
Lecture 18 Restoring Invariants 15-122: Principles of Imperative Computation (Spring 2018) Frank Pfenning In this lecture we will implement heaps and operations on them. The theme of this lecture is reasoning
More informationArithmetic and Bitwise Operations on Binary Data
Arithmetic and Bitwise Operations on Binary Data CSCI 2400: Computer Architecture ECE 3217: Computer Architecture and Organization Instructor: David Ferry Slides adapted from Bryant & O Hallaron s slides
More informationCOMP1917 Computing 1 Written Exam Sample Questions
COMP1917 Computing 1 Written Exam Sample Questions Note: these sample questions are intended to provide examples of a certain style of question which did not occur in the tutorial or laboratory exercises,
More informationComputer Science Foundation Exam. Dec. 19, 2003 COMPUTER SCIENCE I. Section I A. No Calculators! KEY
Computer Science Foundation Exam Dec. 19, 2003 COMPUTER SCIENCE I Section I A No Calculators! Name: KEY SSN: Score: 50 In this section of the exam, there are Three (3) problems You must do all of them.
More informationCOP 3223 Introduction to Programming with C - Study Union - Fall 2017
COP 3223 Introduction to Programming with C - Study Union - Fall 2017 Chris Marsh and Matthew Villegas Contents 1 Code Tracing 2 2 Pass by Value Functions 4 3 Statically Allocated Arrays 5 3.1 One Dimensional.................................
More informationCS 33. Data Representation, Part 1. CS33 Intro to Computer Systems VII 1 Copyright 2017 Thomas W. Doeppner. All rights reserved.
CS 33 Data Representation, Part 1 CS33 Intro to Computer Systems VII 1 Copyright 2017 Thomas W. Doeppner. All rights reserved. Number Representation Hindu-Arabic numerals developed by Hindus starting in
More informationExam Principles of Imperative Computation, Summer 2011 William Lovas. June 24, 2011
Exam 3 15-122 Principles of Imperative Computation, Summer 2011 William Lovas June 24, 2011 Name: Sample Solution Andrew ID: wlovas Instructions This exam is closed-book with one double-sided sheet of
More informationMPATE-GE 2618: C Programming for Music Technology. Unit 4.2
MPATE-GE 2618: C Programming for Music Technology Unit 4.2 Quiz 1 results (out of 25) Mean: 19.9, (standard deviation = 3.9) Equivalent to 79.1% (SD = 15.6) Median: 21.5 High score: 24 Low score: 13 Pointer
More informationJordan University of Science & Technology Department of Computer Science CS 211 Exam #1 (23/10/2010) -- Form A
Jordan University of Science & Technology Department of Computer Science CS 211 Exam #1 (23/10/2010) -- Form A Name: ID#: Section #: Day & Time: Instructor: Answer all questions as indicated. Closed book/closed
More informationLecture Notes on Tries
Lecture Notes on Tries 15-122: Principles of Imperative Computation Thomas Cortina Notes by Frank Pfenning Lecture 24 April 19, 2011 1 Introduction In the data structures implementing associative arrays
More informationYou must include this cover sheet. Either type up the assignment using theory3.tex, or print out this PDF.
15-122 Assignment 3 Page 1 of 12 15-122 : Principles of Imperative Computation Fall 2012 Assignment 3 (Theory Part) Due: Thursday, October 4 at the beginning of lecture. Name: Andrew ID: Recitation: The
More informationLecture Notes on Binary Search Trees
Lecture Notes on Binary Search Trees 15-122: Principles of Imperative Computation Tom Cortina Lecture 15 October 14, 2010 1 Introduction In the previous two lectures we have seen how to exploit the structure
More informationCOP 3223 Introduction to Programming with C - Study Union - Fall 2017
COP 3223 Introduction to Programming with C - Study Union - Fall 2017 Chris Marsh and Matthew Villegas Contents 1 Code Tracing 2 2 Pass by Value Functions 4 3 Statically Allocated Arrays 5 3.1 One Dimensional.................................
More informationCPSC 211, Sections : Data Structures and Implementations, Honors Final Exam May 4, 2001
CPSC 211, Sections 201 203: Data Structures and Implementations, Honors Final Exam May 4, 2001 Name: Section: Instructions: 1. This is a closed book exam. Do not use any notes or books. Do not confer with
More informationComputer Science Foundation Exam
Computer Science Foundation Exam August 6, 017 Section I A DATA STRUCTURES SOLUTIONS NO books, notes, or calculators may be used, and you must work entirely on your own. Question # Max Pts Category Passing
More informationPage 1. Where Have We Been? Chapter 2 Representing and Manipulating Information. Why Don t Computers Use Base 10?
Where Have We Been? Class Introduction Great Realities of Computing Int s are not Integers, Float s are not Reals You must know assembly Memory Matters Performance! Asymptotic Complexity It s more than
More informationThe Building Blocks: Binary Numbers, Boolean Logic, and Gates. Purpose of Chapter. External Representation of Information.
The Building Blocks: Binary Numbers, Boolean Logic, and Gates Chapter 4 Representing Information The Binary Numbering System Boolean Logic and Gates Building Computer Circuits Control Circuits CMPUT Introduction
More informationArithmetic and Bitwise Operations on Binary Data
Arithmetic and Bitwise Operations on Binary Data CSCI 224 / ECE 317: Computer Architecture Instructor: Prof. Jason Fritts Slides adapted from Bryant & O Hallaron s slides 1 Boolean Algebra Developed by
More information15-122: Principles of Imperative Computation, Spring Written Homework 12. Due: Sunday 15 th April, 2018 by 10pm. Name: Andrew ID: Section:
15-122: Principles of Imperative Computation, Spring 2018 Written Homework 12 Due: Sunday 15 th April, 2018 by 10pm Name: Andrew ID: Section: This written homework provides practice with C features such
More informationAlgorithm Analysis. Applied Algorithmics COMP526. Algorithm Analysis. Algorithm Analysis via experiments
Applied Algorithmics COMP526 Lecturer: Leszek Gąsieniec, 321 (Ashton Bldg), L.A.Gasieniec@liverpool.ac.uk Lectures: Mondays 4pm (BROD-107), and Tuesdays 3+4pm (BROD-305a) Office hours: TBA, 321 (Ashton)
More informationDepartment of Computer Science Admission Test for PhD Program. Part I Time : 30 min Max Marks: 15
Department of Computer Science Admission Test for PhD Program Part I Time : 30 min Max Marks: 15 Each Q carries 1 marks. ¼ mark will be deducted for every wrong answer. Part II of only those candidates
More informationCOMPUTER SCIENCE PAPER 1
COMPUTER SCIENCE PAPER 1 (THEORY) (Maximum Marks: 70) (Time allowed: Three hours) (Candidates are allowed additional 15 minutes for only reading the paper. They must NOT start writing during this time.)
More informationCSE 332 Spring 2013: Midterm Exam (closed book, closed notes, no calculators)
Name: Email address: Quiz Section: CSE 332 Spring 2013: Midterm Exam (closed book, closed notes, no calculators) Instructions: Read the directions for each question carefully before answering. We will
More informationLecture Notes on Interfaces
Lecture Notes on Interfaces 15-122: Principles of Imperative Computation Frank Pfenning Lecture 14 October 16, 2012 1 Introduction The notion of an interface to an implementation of an abstract data type
More informationC0MP1911 Final Exam 1337 Computing 1
Family Name: Other Names: Signature: Student Number: This PAPER is NOT to be retained by the STUDENT The University Of New South Wales C0MP1911 Final Exam 1337 Computing 1 July 2006 Time allowed: 3 hrs
More informationLecture Notes on Ints
Lecture Notes on Ints 15-122: Principles of Imperative Computation Frank Pfenning Lecture 2 August 26, 2010 1 Introduction Two fundamental types in almost any programming language are booleans and integers.
More informationPortland State University. CS201 Section 5. Midterm Exam. Fall 2018
Portland State University CS201 Section 5 Midterm Exam Fall 2018 Name: This exam has 9 pages including this cover. The last page contains tables to assist you in performing binary and hexadecimal conversions
More informationECE264 Spring 2013 Final Exam, April 30, 2013
ECE264 Spring 2013 Final Exam, April 30, 2013 In signing this statement, I hereby certify that the work on this exam is my own and that I have not copied the work of any other student while completing
More informationCS112 Lecture: Working with Numbers
CS112 Lecture: Working with Numbers Last revised January 30, 2008 Objectives: 1. To introduce arithmetic operators and expressions 2. To expand on accessor methods 3. To expand on variables, declarations
More informationComputer Science E-22 Practice Final Exam
name Computer Science E-22 This exam consists of three parts. Part I has 10 multiple-choice questions that you must complete. Part II consists of 4 multi-part problems, of which you must complete 3, and
More informationHomework 1. Problem 1. The following code fragment processes an array and produces two values in registers $v0 and $v1:
Homework 1 Problem 1 The following code fragment processes an array and produces two values in registers $v0 and $v1: add $v0, $zero, $zero add $v1, $zero, $zero add $t6, $zero, $zero sll $a2, $a1, 2 add
More informationTime: 8:30-10:00 pm (Arrive at 8:15 pm) Location What to bring:
ECE 120 Midterm 1 HKN Review Session Time: 8:30-10:00 pm (Arrive at 8:15 pm) Location: Your Room on Compass What to bring: icard, pens/pencils, Cheat sheet (Handwritten) Overview of Review Binary IEEE
More informationCSE373 Fall 2013, Midterm Examination October 18, 2013
CSE373 Fall 2013, Midterm Examination October 18, 2013 Please do not turn the page until the bell rings. Rules: The exam is closed-book, closed-note, closed calculator, closed electronics. Please stop
More informationCSE 373 Autumn 2010: Midterm #1 (closed book, closed notes, NO calculators allowed)
Name: Email address: CSE 373 Autumn 2010: Midterm #1 (closed book, closed notes, NO calculators allowed) Instructions: Read the directions for each question carefully before answering. We may give partial
More informationHigh Performance Computing in C and C++
High Performance Computing in C and C++ Rita Borgo Computer Science Department, Swansea University Summary Introduction to C Writing a simple C program Compiling a simple C program Running a simple C program
More informationCSCI2467: Systems Programming Concepts
CSCI2467: Systems Programming Concepts Slideset 2: Information as Data (CS:APP Chap. 2) Instructor: M. Toups Spring 2018 Course updates datalab out today! - due after Mardi gras... - do not wait until
More informationLecture 1 Contracts. 1 A Mysterious Program : Principles of Imperative Computation (Spring 2018) Frank Pfenning
Lecture 1 Contracts 15-122: Principles of Imperative Computation (Spring 2018) Frank Pfenning In these notes we review contracts, which we use to collectively denote function contracts, loop invariants,
More information: Advanced Programming Final Exam Summer 2008 June 27, 2008
15-111 : Advanced Programming Final Exam Summer 2008 June 27, 2008 Name: Andrew ID: Answer the questions in the space provided following each question. We must be able to clearly understand your answer.
More informationGroups of two-state devices are used to represent data in a computer. In general, we say the states are either: high/low, on/off, 1/0,...
Chapter 9 Computer Arithmetic Reading: Section 9.1 on pp. 290-296 Computer Representation of Data Groups of two-state devices are used to represent data in a computer. In general, we say the states are
More informationCSE 373 Spring 2010: Midterm #1 (closed book, closed notes, NO calculators allowed)
Name: Email address: CSE 373 Spring 2010: Midterm #1 (closed book, closed notes, NO calculators allowed) Instructions: Read the directions for each question carefully before answering. We may give partial
More informationCSE 373 Spring Midterm. Friday April 21st
CSE 373 Spring 2006 Data Structures and Algorithms Midterm Friday April 21st NAME : Do all your work on these pages. Do not add any pages. Use back pages if necessary. Show your work to get partial credit.
More informationProgramming Languages and Compilers Qualifying Examination. Answer 4 of 6 questions.1
Programming Languages and Compilers Qualifying Examination Monday, September 19, 2016 Answer 4 of 6 questions.1 GENERAL INSTRUCTIONS 1. Answer each question in a separate book. 2. Indicate on the cover
More informationComputer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2
Computer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2 Instructor: Rob Bergen Applied Computer Science University of Winnipeg Announcements Website is up
More informationl Determine if a number is odd or even l Determine if a number/character is in a range - 1 to 10 (inclusive) - between a and z (inclusive)
Final Exam Exercises Chapters 1-7 + 11 Write C++ code to: l Determine if a number is odd or even CS 2308 Fall 2016 Jill Seaman l Determine if a number/character is in a range - 1 to 10 (inclusive) - between
More informationUNIVERSITY OF TORONTO FACULTY OF APPLIED SCIENCE AND ENGINEERING
UNIVERSITY OF TORONTO FACULTY OF APPLIED SCIENCE AND ENGINEERING APS 105 Computer Fundamentals Final Examination December 21, 2015 9:30 a.m. 12:00 p.m. (150 minutes) Examiners: J. Anderson, B. Li, J. Rose
More informationLecture 16 Notes AVL Trees
Lecture 16 Notes AVL Trees 15-122: Principles of Imperative Computation (Spring 2016) Frank Pfenning 1 Introduction Binary search trees are an excellent data structure to implement associative arrays,
More informationLecture 7 Quicksort : Principles of Imperative Computation (Spring 2018) Frank Pfenning
Lecture 7 Quicksort 15-122: Principles of Imperative Computation (Spring 2018) Frank Pfenning In this lecture we consider two related algorithms for sorting that achieve a much better running time than
More informationFoundation Exam - Sample Problems for New Topics
Foundation Exam - Sample Problems for New Topics Fall 2016 Dynamic Memory Allocation Sample Question #1 Consider the following struct to store a single Uno playing card: typedef struct char color[20];
More informationCOMPUTER SCIENCE Paper 1
COMPUTER SCIENCE Paper 1 (THEORY) (Three hours) Maximum Marks: 70 (Candidates are allowed additional 15 minutes for only reading the paper. They must NOT start writing during this time) -----------------------------------------------------------------------------------------------------------------------
More informationComputer Science 302 Spring 2007 Practice Final Examination: Part I
Computer Science 302 Spring 2007 Practice Final Examination: Part I Name: This practice examination is much longer than the real final examination will be. If you can work all the problems here, you will
More informationCSE 351: The Hardware/Software Interface. Section 2 Integer representations, two s complement, and bitwise operators
CSE 351: The Hardware/Software Interface Section 2 Integer representations, two s complement, and bitwise operators Integer representations In addition to decimal notation, it s important to be able to
More information: Principles of Imperative Computation. Summer Assignment 4. Due: Monday, June 11, 2012 in class
15-122 Assignment 4 Page 1 of 8 15-122 : Principles of Imperative Computation Summer 1 2012 Assignment 4 (Theory Part) Due: Monday, June 11, 2012 in class Name: Andrew ID: Recitation: The written portion
More informationThe type of all data used in a C (or C++) program must be specified
The type of all data used in a C (or C++) program must be specified A data type is a description of the data being represented That is, a set of possible values and a set of operations on those values
More informationInstructions. Definitions. Name: CMSC 341 Fall Question Points I. /12 II. /30 III. /10 IV. /12 V. /12 VI. /12 VII.
CMSC 341 Fall 2013 Data Structures Final Exam B Name: Question Points I. /12 II. /30 III. /10 IV. /12 V. /12 VI. /12 VII. /12 TOTAL: /100 Instructions 1. This is a closed-book, closed-notes exam. 2. You
More informationCS 354 Midterm 1a, 33.33% Monday, October 9th, 2000 Solution
CS 354 Midterm 1a, 33.33% Monday, October 9th, 2000 Solution Parts Number of Questions Question Format Possible Points Score I 6 Short Answer 20 II 5 Multiple Choice 15 III 5 True or False 10 IV 6 Calculations
More informationCS1800 Discrete Structures Final Version B
CS1800 Discrete Structures Fall 2017 Profs. Aslam, Gold, & Pavlu December 15, 2017 CS1800 Discrete Structures Final Version B Instructions: 1. The exam is closed book and closed notes. You may not use
More informationSTUDENT LESSON A12 Iterations
STUDENT LESSON A12 Iterations Java Curriculum for AP Computer Science, Student Lesson A12 1 STUDENT LESSON A12 Iterations INTRODUCTION: Solving problems on a computer very often requires a repetition of
More informationChapter 3: Operators, Expressions and Type Conversion
101 Chapter 3 Operators, Expressions and Type Conversion Chapter 3: Operators, Expressions and Type Conversion Objectives To use basic arithmetic operators. To use increment and decrement operators. To
More informationLecture 1 Contracts : Principles of Imperative Computation (Fall 2018) Frank Pfenning
Lecture 1 Contracts 15-122: Principles of Imperative Computation (Fall 2018) Frank Pfenning In these notes we review contracts, which we use to collectively denote function contracts, loop invariants,
More informationChapter 12 Variables and Operators
Chapter 12 Variables and Operators Highlights (1) r. height width operator area = 3.14 * r *r + width * height literal/constant variable expression (assignment) statement 12-2 Highlights (2) r. height
More informationUniversity of Toronto Department of Electrical and Computer Engineering. Midterm Examination. ECE 345 Algorithms and Data Structures Fall 2010
University of Toronto Department of Electrical and Computer Engineering Midterm Examination ECE 345 Algorithms and Data Structures Fall 2010 Print your name and ID number neatly in the space provided below;
More informationMost of this PDF is editable. You can either type your answers in the red boxes/lines, or you can write them neatly by hand.
15-122 : Principles of Imperative Computation, Spring 2016 Written Homework 7 Due: Monday 7 th March, 2016 Name:q1 Andrew ID: q2 Section:q3 This written homework covers amortized analysis and hash tables.
More informationSection 05: Midterm Review
Section 05: Midterm Review 1. Asymptotic Analysis (a) Applying definitions For each of the following, choose a c and n 0 which show f(n) O(g(n)). Explain why your values of c and n 0 work. (i) f(n) = 5000n
More informationAgenda. The main body and cout. Fundamental data types. Declarations and definitions. Control structures
The main body and cout Agenda 1 Fundamental data types Declarations and definitions Control structures References, pass-by-value vs pass-by-references The main body and cout 2 C++ IS AN OO EXTENSION OF
More informationCDA 3103 Computer Organization Exam 1 (Sep. 22th, 2014)
CDA 3103 Computer Organization Exam 1 (Sep. 22th, 2014) Name: USF ID: Problem Points Score 1 10 2 10 3 15 4 15 5 10 6 20 otal 80 Exam Rules Use the back of the exam paper as necessary. But indicate clearly
More informationComputer Science Foundation Exam
Computer Science Foundation Exam December 16, 2016 Section I A DATA STRUCTURES NO books, notes, or calculators may be used, and you must work entirely on your own. SOLUTION Question # Max Pts Category
More information