Exam 2. CSI 201: Computer Science 1 Fall 2016 Professors: Shaun Ramsey and Kyle Wilson. Question Points Score Total: 80

Size: px
Start display at page:

Download "Exam 2. CSI 201: Computer Science 1 Fall 2016 Professors: Shaun Ramsey and Kyle Wilson. Question Points Score Total: 80"

Transcription

1 Exam 2 CSI 201: Computer Science 1 Fall 2016 Professors: Shaun Ramsey and Kyle Wilson Question Points Score Total: 80 I understand that this exam is closed book and closed note and is to be completed without a calculator, phone, or other computer. I am NOT allowed to use any external resources to complete this exam. All of the work that I am submitting for this exam is mine. I have completed this exam in accordance with the Washington College Honor Code. Name: Signature: Section: 10: 11:30-12:20 11: 1:30-2:20 Page 1 of 7

2 1. Concepts. Answer each question briefly. (a) 3 points How many elements are in the following array? bool on_time[43]; (b) 3 points How are arrays and pointers related? (c) 3 points What important C++ rule does this function definition break? int[] makearrayoftenzeros() { int arr[10]; for (int i = 0; i < 10; ++i) arr[i] = 0; return arr; (d) 3 points Describe one possibility that could happen when this code is run: double * four_elements = new double[4]; cout << four_elements[100]; (e) 6 points Explain the differences between static and dynamic arrays. Page 2 of 7

3 2. Short Coding Questions. Write a line or two of code to answer each question. (a) 3 points Show how to call a function called printinstructions. Here is this function s prototype: void printinstructions(); (b) 3 points Write a line of C++ code to print out the value of the first element of an array called zebras. (c) 3 points Show how to free up the memory that is being used by the array arr, which was created like this: double * arr = new double[15]; (d) 3 points Write a prototype for a function called printarray that takes as input an array of type double and an integer length of the array. The function will not return anything. (e) 3 points Give a line of code to change the last element of an integer array to be equal to the second element of that array. The array is called puppies and the size variable is called N. Page 3 of 7

4 (f) 4 points Show how to declare a new array of doubles with 10 elements in two ways: (1) as a static array, and (2) as a dynamic array. (g) 5 points Give several lines of code that set every element of an array to -1. You should assume that the array is called choices and that the length of the array is stored in a variable named N. (h) 5 points Write a for loop to print every even-indexed element of an array to the console. You may assume that array has been declared and initialized elsewhere and is named sodas, and that the size of the array is stored in an int named num drinks. 3. Code Output. (a) 3 points What is the console output of the following code snippet? for (int q = 10; q > 4; q -= 2) { cout << q - 2 << endl; Page 4 of 7

5 (b) 3 points What value does the function call foo(12, 12, 12) return? double foo(int num1, int num2, int num3) { num1--; if (num1 < num2) num3 = num3-2; return num3 - num1; (c) 3 points Consider this definition for the function h: int h(int b, int a) { return b; What is the output of these lines of code? a = 4; b = 8; cout << h(a, b); (d) 4 points Suppose that the function f is defined like this: void f(int arr[], int size, int i){ if (i < size) arr[i] = 7; What is the console output of this code snippet? int numbers[4]; numbers[2] = -5; f(numbers, 4, 2); cout << numbers[2] << endl; Page 5 of 7

6 (e) 5 points What is the console output of the following code? #include <iostream> #include <string> using namespace std; int function1(int a, int b); int function2(int a, int b); int main() { int a = 2; int b = 1; cout << function1(a, b) << endl; int function1(int a, int b) { a = function2(a, b); if (a >= 3) { return a; else { return a + 3; int function2(int a, int b) { return a * 2 + b; Page 6 of 7

7 4. 15 points Write a function to compute the evaluation of the algorithm described below. Use good programming practice, and choose proper return types and parameter values. Also write a main that demonstrates at least one function call of this function. Algorithm: In math, the length of a vector of numbers is defined as the square root of the sum of the squares of the numbers. For example: length([1, 4, 6, 2]) = (1) 2 + (4) 2 + (6) 2 + ( 2) 2 = = Write a function that computes this vector length for any array of numbers. Clarification: You may not assume that input arrays always have 4 elements (like in the example). Your function must be general to any length array. Page 7 of 7

Exam 1. CSI 201: Computer Science 1 Fall 2018 Professors: Shaun Ramsey

Exam 1. CSI 201: Computer Science 1 Fall 2018 Professors: Shaun Ramsey Exam 1 CSI 201: Computer Science 1 Fall 2018 Professors: Shaun Ramsey I understand that this exam is closed books and closed notes and is to be completed without a calculator, phone, or other computer.

More information

Agenda. The main body and cout. Fundamental data types. Declarations and definitions. Control structures

Agenda. 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 information

1- Write a single C++ statement that: A. Calculates the sum of the two integrates 11 and 12 and outputs the sum to the consol.

1- Write a single C++ statement that: A. Calculates the sum of the two integrates 11 and 12 and outputs the sum to the consol. 1- Write a single C++ statement that: A. Calculates the sum of the two integrates 11 and 12 and outputs the sum to the consol. B. Outputs to the console a floating point number f1 in scientific format

More information

CSCI 111 First Midterm Exam Fall Solutions 09.00am 09.50am, Wednesday, October 18, 2017

CSCI 111 First Midterm Exam Fall Solutions 09.00am 09.50am, Wednesday, October 18, 2017 QUEENS COLLEGE Department of Computer Science CSCI 111 First Midterm Exam Fall 2017 10.18.17 Solutions 09.00am 09.50am, Wednesday, October 18, 2017 Problem 1 (10 points) The following C++ program has errors

More information

CSCE 206: Structured Programming in C++

CSCE 206: Structured Programming in C++ CSCE 206: Structured Programming in C++ 2017 Spring Exam 2 Monday, March 20, 2017 Total - 100 Points B Instructions: Total of 13 pages, including this cover and the last page. Before starting the exam,

More information

The American University in Cairo Department of Computer Science & Engineering CSCI &09 Dr. KHALIL Exam-I Fall 2011

The American University in Cairo Department of Computer Science & Engineering CSCI &09 Dr. KHALIL Exam-I Fall 2011 The American University in Cairo Department of Computer Science & Engineering CSCI 106-07&09 Dr. KHALIL Exam-I Fall 2011 Last Name :... ID:... First Name:... Form I Section No.: EXAMINATION INSTRUCTIONS

More information

CMPS 221 Sample Final

CMPS 221 Sample Final Name: 1 CMPS 221 Sample Final 1. What is the purpose of having the parameter const int a[] as opposed to int a[] in a function declaration and definition? 2. What is the difference between cin.getline(str,

More information

Week 4 EECS 183 MAXIM ALEKSA. maximal.io

Week 4 EECS 183 MAXIM ALEKSA. maximal.io Week 4 EECS 183 MAXIM ALEKSA maximal.io Agenda Functions Scope Conditions Boolean Expressions Lab 2 Project 2 Q&A Lectures 15% 36% 19% 8:30am 10:00am with Bill Arthur 10:00am 11:30am with Mary Lou Dorf

More information

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

University of Michigan EECS 183: Elem. Programming Concepts Fall 2011 Exam 1: Part 1: Form 1. Professors: ML Dorf, Elliot Soloway University of Michigan EECS 183: Elem. Programming Concepts Fall 2011 Exam 1: Part 1: Form 1 Professors: ML Dorf, Elliot Soloway Wed 9- February- 2011 35 questions * 3 pts each = 105 pts (yes we know there

More information

Multiple Choice Questions (20 questions * 6 points per question = 120 points)

Multiple Choice Questions (20 questions * 6 points per question = 120 points) EECS 183 Fall 2014 Exam 2 Closed Book Minimal Notes Closed Electronic Devices Closed Neighbor Turn off Your Cell Phones We will confiscate all electronic devices that we see including cell phones, calculators,

More information

CSCS 261 Programming Concepts Exam 2 Fall EXAM 2 VERSION 1 Fall Points. Absolutely no electronic devices may be used during this exam.

CSCS 261 Programming Concepts Exam 2 Fall EXAM 2 VERSION 1 Fall Points. Absolutely no electronic devices may be used during this exam. Name: Print legibly! Section: COMPUTER SCIENCE 261 PROGRAMMING CONCEPTS EXAM 2 VERSION 1 Fall 2014 150 Points Absolutely no electronic devices may be used during this exam. 1. No cell phones, computers,

More information

ECE264 Fall 2013 Exam 1, September 24, 2013

ECE264 Fall 2013 Exam 1, September 24, 2013 ECE264 Fall 2013 Exam 1, September 24, 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 it.

More information

Multiple Choice (Questions 1 14) 28 Points Select all correct answers (multiple correct answers are possible)

Multiple Choice (Questions 1 14) 28 Points Select all correct answers (multiple correct answers are possible) Name Closed notes, book and neighbor. If you have any questions ask them. Notes: Segment of code necessary C++ statements to perform the action described not a complete program Program a complete C++ program

More information

Sample Final Exam. 1) (24 points) Show what is printed by the following segments of code (assume all appropriate header files, etc.

Sample Final Exam. 1) (24 points) Show what is printed by the following segments of code (assume all appropriate header files, etc. Name: Sample Final Exam 1) (24 points) Show what is printed by the following segments of code (assume all appropriate header files, etc. are included): a) int start = 10, end = 21; while (start < end &&

More information

CSCI 111 Midterm 1, version A Exam Fall Solutions 09.00am 09.50am, Tuesday, November 24, 2015

CSCI 111 Midterm 1, version A Exam Fall Solutions 09.00am 09.50am, Tuesday, November 24, 2015 QUEENS COLLEGE Department of Computer Science CSCI 111 Midterm 1, version A Exam Fall 2015 11.24.15 Solutions 09.00am 09.50am, Tuesday, November 24, 2015 Problem 1 Write the best title lines for the functions

More information

CSCS 261 Programming Concepts Exam 2 Fall EXAM 2 VERSION 1 Fall Points. Absolutely no electronic devices may be used during this exam.

CSCS 261 Programming Concepts Exam 2 Fall EXAM 2 VERSION 1 Fall Points. Absolutely no electronic devices may be used during this exam. Name: Print legibly! Section: COMPUTER SCIENCE 261 PROGRAMMING CONCEPTS EXAM 2 VERSION 1 Fall 2014 150 Points Absolutely no electronic devices may be used during this exam. 1. No cell phones, computers,

More information

CMSC 202 Midterm Exam 1 Fall 2015

CMSC 202 Midterm Exam 1 Fall 2015 1. (15 points) There are six logic or syntax errors in the following program; find five of them. Circle each of the five errors you find and write the line number and correction in the space provided below.

More information

pointers + memory double x; string a; int x; main overhead int y; main overhead

pointers + memory double x; string a; int x; main overhead int y; main overhead pointers + memory computer have memory to store data. every program gets a piece of it to use as we create and use more variables, more space is allocated to a program memory int x; double x; string a;

More information

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

The American University in Cairo Computer Science & Engineering Department CSCE Dr. KHALIL Exam II Spring 2010 The American University in Cairo Computer Science & Engineering Department CSCE 106-08 Dr. KHALIL Exam II Spring 2010 Last Name :... ID:... First Name:... Form - I EXAMINATION INSTRUCTIONS * Do not turn

More information

CSCI 111 Midterm 2 Exam Spring Solutions 09.00am 09.50am, Wednesday, May 04, 2016

CSCI 111 Midterm 2 Exam Spring Solutions 09.00am 09.50am, Wednesday, May 04, 2016 QUEENS COLLEGE Department of Computer Science CSCI 111 Midterm 2 Exam Spring 2016 05.04.16 Solutions 09.00am 09.50am, Wednesday, May 04, 2016 Problem 1 ( points) Write the best title lines for the functions

More information

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

Total 100. The American University in Cairo Computer Science & Engineering Department CSCE 106. Dr. Khalil Exam II Fall 2011 The American University in Cairo Computer Science & Engineering Department CSCE 106 Dr. Khalil Exam II Fall 2011 Last Name :... ID:... First Name:... Form I Section No.: ( ) EXAMINATION INSTRUCTIONS *

More information

The American University in Cairo Computer Science & Engineering Department CSCE 106 Fundamentals of Computer Science. Instructor: Final Exam Fall 2011

The American University in Cairo Computer Science & Engineering Department CSCE 106 Fundamentals of Computer Science. Instructor: Final Exam Fall 2011 The American University in Cairo Computer Science & Engineering Department CSCE 106 Fundamentals of Computer Science Instructor: Final Exam Fall 2011 Last Name :... ID:... First Name:... Section No.: EXAMINATION

More information

a. a * c - 10 = b. a % b + (a * d) + 7 =

a. a * c - 10 = b. a % b + (a * d) + 7 = Exam #2 CISC1110, MW 10:35-12:40pm Fall 2011 Name 1 Evaluate each expression according to C++ rules (8 pts) Given: Integers a = 3, b = 2, c = 5, and float d = 40 a a * c - 10 = b a % b + (a * d) + 7 =

More information

CSC 126 FINAL EXAMINATION Spring Total Possible TOTAL 100

CSC 126 FINAL EXAMINATION Spring Total Possible TOTAL 100 CSC 126 FINAL EXAMINATION Spring 2011 Version A Name (Last, First) Your Instructor Question # Total Possible 1. 10 Total Received 2. 15 3. 15 4. 10 5. 10 6. 10 7. 10 8. 20 TOTAL 100 Name: Sp 11 Page 2

More information

16.216: ECE Application Programming Fall 2011

16.216: ECE Application Programming Fall 2011 16.216: ECE Application Programming Fall 2011 Exam 2 Solution 1. (24 points, 6 points per part) Multiple choice For each of the multiple choice questions below, clearly indicate your response by circling

More information

CS 31 Discussion 1A, Week 4. Zengwen Yuan (zyuan [at] cs.ucla.edu) Humanities A65, Friday 10:00 11:50 a.m.

CS 31 Discussion 1A, Week 4. Zengwen Yuan (zyuan [at] cs.ucla.edu) Humanities A65, Friday 10:00 11:50 a.m. CS 31 Discussion 1A, Week 4 Zengwen Yuan (zyuan [at] cs.ucla.edu) Humanities A65, Friday 10:00 11:50 a.m. Today s focus Notes from the project 2 grading Function call predefined function define a function

More information

Week 3. Function Definitions. Example: Function. Function Call, Return Statement. Functions & Arrays. Gaddis: Chapters 6 and 7.

Week 3. Function Definitions. Example: Function. Function Call, Return Statement. Functions & Arrays. Gaddis: Chapters 6 and 7. Week 3 Functions & Arrays Gaddis: Chapters 6 and 7 CS 5301 Fall 2015 Jill Seaman 1 Function Definitions! Function definition pattern: datatype identifier (parameter1, parameter2,...) { statements... Where

More information

EECS402 Lecture 02. Functions. Function Prototype

EECS402 Lecture 02. Functions. Function Prototype The University Of Michigan Lecture 02 Andrew M. Morgan Savitch Ch. 3-4 Functions Value and Reference Parameters Andrew M. Morgan 1 Functions Allows for modular programming Write the function once, call

More information

The American University in Cairo Department of Computer Science & Engineeringt CSCI &09 Dr. KHALIL Exam-I Fall 2009

The American University in Cairo Department of Computer Science & Engineeringt CSCI &09 Dr. KHALIL Exam-I Fall 2009 The American University in Cairo Department of Computer Science & Engineeringt CSCI 106-05&09 Dr. KHALIL Exam-I Fall 2009 Last Name :... ID:... First Name:... Form I Section No.: EXAMINATION INSTRUCTIONS

More information

True or False (15 Points)

True or False (15 Points) Name Number True or False (15 Points) 1. (15 pts) Circle T for true and F for false: T F a) Value Returning Functions cannot use reference parameters. T F b) Arguments corresponding to value parameters

More information

Multiple Choice (Questions 1 14) 28 Points Select all correct answers (multiple correct answers are possible)

Multiple Choice (Questions 1 14) 28 Points Select all correct answers (multiple correct answers are possible) Name Closed notes, book and neighbor. If you have any questions ask them. Notes: Segment of code necessary C++ statements to perform the action described not a complete program Program a complete C++ program

More information

Jordan 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 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 information

ECE 462 Fall 2011, Third Exam

ECE 462 Fall 2011, Third Exam ECE 462 Fall 2011, Third Exam DO NOT START WORKING ON THIS UNTIL TOLD TO DO SO. You have until 9:20 to take this exam. Your exam should have 12 pages total (including this cover sheet). Please let Prof.

More information

Question: Total Points: Score:

Question: Total Points: Score: CS 170 Exam 2 Section 001 Fall 2014 Name (print): Instructions: Keep your eyes on your own paper and do your best to prevent anyone else from seeing your work. Do NOT communicate with anyone other than

More information

Lecture 23: Pointer Arithmetic

Lecture 23: Pointer Arithmetic Lecture 23: Pointer Arithmetic Wai L. Khoo Department of Computer Science City College of New York November 29, 2011 Wai L. Khoo (CS@CCNY) Lecture 23 November 29, 2011 1 / 14 Pointer Arithmetic Pointer

More information

CSCE Practice Midterm. Data Types

CSCE Practice Midterm. Data Types CSCE 2004 - Practice Midterm This midterm exam was given in class several years ago. Work each of the following questions on your own. Once you are done, check your answers. For any questions whose answers

More information

Welcome Back. CSCI 262 Data Structures. Hello, Let s Review. Hello, Let s Review. How to Review 1/9/ Review. Here s a simple C++ program:

Welcome Back. CSCI 262 Data Structures. Hello, Let s Review. Hello, Let s Review. How to Review 1/9/ Review. Here s a simple C++ program: Welcome Back CSCI 262 Data Structures 2 - Review What you learned in CSCI 261 (or equivalent): Variables Types Arrays Expressions Conditionals Branches & Loops Functions Recursion Classes & Objects Streams

More information

Increment and the While. Class 15

Increment and the While. Class 15 Increment and the While Class 15 Increment and Decrement Operators Increment and Decrement Increase or decrease a value by one, respectively. the most common operation in all of programming is to increment

More information

Local and Global Variables

Local and Global Variables Lecture 10 Local and Global Variables Nearly every programming language has a concept of local variable. As long as two functions mind their own data, as it were, they won t interfere with each other.

More information

The University Of Michigan. EECS402 Lecture 02. Andrew M. Morgan. Savitch Ch. 3-4 Functions Value and Reference Parameters.

The University Of Michigan. EECS402 Lecture 02. Andrew M. Morgan. Savitch Ch. 3-4 Functions Value and Reference Parameters. The University Of Michigan Lecture 02 Andrew M. Morgan Savitch Ch. 3-4 Functions Value and Reference Parameters Andrew M. Morgan 1 Functions Allows for modular programming Write the function once, call

More information

READ THIS NOW! Do not start the test until instructed to do so!

READ THIS NOW! Do not start the test until instructed to do so! READ THIS NOW! Failure to read and follow the instructions below may result in severe penalties. Failure to adhere to these directions will not constitute an excuse or defense. Print your name in the space

More information

Multiple Choice (Questions 1 13) 26 Points Select all correct answers (multiple correct answers are possible)

Multiple Choice (Questions 1 13) 26 Points Select all correct answers (multiple correct answers are possible) Name Closed notes, book and neighbor. If you have any questions ask them. Notes: Segment of code necessary C++ statements to perform the action described not a complete program Program a complete C++ program

More information

FORM 2 (Please put your name and form # on the scantron!!!!)

FORM 2 (Please put your name and form # on the scantron!!!!) CS 161 Exam 2: FORM 2 (Please put your name and form # on the scantron!!!!) True (A)/False(B) (2 pts each): 1. Recursive algorithms tend to be less efficient than iterative algorithms. 2. A recursive function

More information

Welcome Back. CSCI 262 Data Structures. Hello, Let s Review. Hello, Let s Review. How to Review 8/19/ Review. Here s a simple C++ program:

Welcome Back. CSCI 262 Data Structures. Hello, Let s Review. Hello, Let s Review. How to Review 8/19/ Review. Here s a simple C++ program: Welcome Back CSCI 262 Data Structures 2 - Review What you learned in CSCI 261 (or equivalent): Variables Types Arrays Expressions Conditionals Branches & Loops Functions Recursion Classes & Objects Streams

More information

CSCS 261 Programming Concepts Exam 1 Fall EXAM 1 VERSION 1 Fall Points. Absolutely no electronic devices may be used during this exam.

CSCS 261 Programming Concepts Exam 1 Fall EXAM 1 VERSION 1 Fall Points. Absolutely no electronic devices may be used during this exam. Name: Print legibly! Section: COMPUTER SCIENCE 261 PROGRAMMING CONCEPTS EXAM 1 VERSION 1 Fall 2014 150 Points Absolutely no electronic devices may be used during this exam. 1. No cell phones, computers,

More information

CSCI 102L - Data Structures Midterm Exam #1 Fall 2011

CSCI 102L - Data Structures Midterm Exam #1 Fall 2011 Print Your Name: Page 1 of 8 Signature: Aludra Loginname: CSCI 102L - Data Structures Midterm Exam #1 Fall 2011 (10:00am - 11:12am, Wednesday, October 5) Instructor: Bill Cheng Problems Problem #1 (24

More information

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

Part 1 (80 points) Multiple Choice Questions (20 questions * 4 points per question = 80 points) EECS 183 Fall 2013 Exam 1 Part 1 (80 points) Closed Book Closed Notes Closed Electronic Devices Closed Neighbor Turn off Your Cell Phones We will confiscate all electronic devices that we see including

More information

Multiple Choice (Questions 1 13) 26 Points Select all correct answers (multiple correct answers are possible)

Multiple Choice (Questions 1 13) 26 Points Select all correct answers (multiple correct answers are possible) Name Closed notes, book and neighbor. If you have any questions ask them. Notes: Segment of code necessary C++ statements to perform the action described not a complete program Program a complete C++ program

More information

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

Total 100. The American University in Cairo Computer Science & Engineering Department CSCE 106. Instructor: Final Exam Fall Section No. The American University in Cairo Computer Science & Engineering Department CSCE 106 Instructor: Final Exam Fall 2010 Last Name :... ID:... First Name:... Section No.: EXAMINATION INSTRUCTIONS * Do not

More information

Multiple Choice Questions (20 questions * 5 points per question = 100 points)

Multiple Choice Questions (20 questions * 5 points per question = 100 points) EECS 183 Winter 2014 Exam 1 Closed Book Closed Notes Closed Electronic Devices Closed Neighbor Turn off Your Cell Phones We will confiscate all electronic devices that we see including cell phones, calculators,

More information

do { statements } while (condition);

do { statements } while (condition); Topic 4 1. The while loop 2. Problem solving: hand-tracing 3. The for loop 4. The do loop 5. Processing input 6. Problem solving: storyboards 7. Common loop algorithms 8. Nested loops 9. Problem solving:

More information

CSCI 111 Midterm 1, version A Exam Fall Solutions 09.00am 09.50am, Tuesday, October 13, 2015

CSCI 111 Midterm 1, version A Exam Fall Solutions 09.00am 09.50am, Tuesday, October 13, 2015 QUEENS COLLEGE Department of Computer Science CSCI 111 Midterm 1, version A Exam Fall 2015 10.13.15 Solutions 09.00am 09.50am, Tuesday, October 13, 2015 Problem 1 Write a complete C++ program that does

More information

CSE 250 Final Exam. Fall 2013 Time: 3 hours. Dec 11, No electronic devices of any kind. You can open your textbook and notes

CSE 250 Final Exam. Fall 2013 Time: 3 hours. Dec 11, No electronic devices of any kind. You can open your textbook and notes CSE 250 Final Exam Fall 2013 Time: 3 hours. Dec 11, 2013 Total points: 100 14 pages Please use the space provided for each question, and the back of the page if you need to. Please do not use any extra

More information

Name Section: M/W or T/TH. True or False (14 Points)

Name Section: M/W or T/TH. True or False (14 Points) Name Section: M/W or T/TH True or False (14 Points) 1. (14 pts) Circle T for true and F for false: T F a) In C++, a function definition should not be nested within another function definition. T F b) Static

More information

University of Dublin

University of Dublin University of Dublin TRINITY COLLEGE Faculty of Enginering & Systems Sciences School of Engineering Junior Freshman Engineering Trinity Term 2015 Computer Engineering I (1E3) Date Location Time Dr L. Hederman

More information

Lab Instructor : Jean Lai

Lab Instructor : Jean Lai Lab Instructor : Jean Lai Group related statements to perform a specific task. Structure the program (No duplicate codes!) Must be declared before used. Can be invoked (called) as any number of times.

More information

CSCE Practice Midterm. Data Types

CSCE Practice Midterm. Data Types CSCE 2004 - Practice Midterm This midterm exam was given in class several years ago. Work each of the following questions on your own. Once you are done, check your answers. For any questions whose answers

More information

Introduction to Computer Science Midterm 3 Fall, Points

Introduction to Computer Science Midterm 3 Fall, Points Introduction to Computer Science Fall, 2001 100 Points Notes 1. Tear off this sheet and use it to keep your answers covered at all times. 2. Turn the exam over and write your name next to the staple. Do

More information

Superior University. Department of Electrical Engineering CS-115. Computing Fundamentals. Experiment No.7. User Defined Functions II

Superior University. Department of Electrical Engineering CS-115. Computing Fundamentals. Experiment No.7. User Defined Functions II Superior University Department of Electrical Engineering CS-115 Computing Fundamentals Experiment No.7 User Defined Functions II Prepared for By: Name: ID: Section: Semester: Total Marks: Obtained Marks:

More information

FORM 1 (Please put your name and section number (001/10am or 002/2pm) on the scantron!!!!) CS 161 Exam II: True (A)/False(B) (2 pts each):

FORM 1 (Please put your name and section number (001/10am or 002/2pm) on the scantron!!!!) CS 161 Exam II: True (A)/False(B) (2 pts each): FORM 1 (Please put your name and section number (001/10am or 002/2pm) on the scantron!!!!) CS 161 Exam II: True (A)/False(B) (2 pts each): 1. If a function has default arguments, they can be located anywhere

More information

Name. Classes and Objects 1. We re going to develop a class to help out Café Below is the definition for a class called

Name. Classes and Objects 1. We re going to develop a class to help out Café Below is the definition for a class called Name CPTR246 Spring '17 (100 total points) Exam 1 Classes and Objects 1. We re going to develop a class to help out Café 1812. Below is the definition for a class called Beverage. The public and private

More information

Assignment #1 (50 points; due 11:59 P.M.)

Assignment #1 (50 points; due 11:59 P.M.) Assignment #1 (50 points; due 9/25/2017 @ 11:59 P.M.) This project is designed to help you master pointers. To that end, you'll get the most out of it by working through the problems by hand. Only after

More information

CSCI 102 Fall 2010 Exam #1

CSCI 102 Fall 2010 Exam #1 Name: USC Username: CSCI 102 Fall 2010 Exam #1 Problems Problem #1 (14 points) Problem #2 (15 points) Problem #3 (20 points) Problem #4 (16 points) Problem #5 (35 points) Total (100 points) Problem 1 Short

More information

4. C++ functions. 1. Library Function 2. User-defined Function

4. C++ functions. 1. Library Function 2. User-defined Function 4. C++ functions In programming, function refers to a segment that group s code to perform a specific task. Depending on whether a function is predefined or created by programmer; there are two types of

More information

Programming Language. Functions. Eng. Anis Nazer First Semester

Programming Language. Functions. Eng. Anis Nazer First Semester Programming Language Functions Eng. Anis Nazer First Semester 2016-2017 Definitions Function : a set of statements that are written once, and can be executed upon request Functions are separate entities

More information

GE U111 Engineering Problem Solving & Computation Lecture 6 February 2, 2004

GE U111 Engineering Problem Solving & Computation Lecture 6 February 2, 2004 GE U111 Engineering Problem Solving & Computation Lecture 6 February 2, 2004 Functions and Program Structure Today we will be learning about functions. You should already have an idea of their uses. Cout

More information

C++ Basics. Data Processing Course, I. Hrivnacova, IPN Orsay

C++ Basics. Data Processing Course, I. Hrivnacova, IPN Orsay C++ Basics Data Processing Course, I. Hrivnacova, IPN Orsay The First Program Comments Function main() Input and Output Namespaces Variables Fundamental Types Operators Control constructs 1 C++ Programming

More information

COSC 320 Exam 2 Key Spring Part 1: Hash Functions

COSC 320 Exam 2 Key Spring Part 1: Hash Functions COSC 320 Exam 2 Key Spring 2011 Part 1: Hash s 1. (5 Points) Create the templated function object lessthan, you may assume that the templated data type T has overloaded the < operator. template

More information

CS 115 Exam 3, Spring 2010

CS 115 Exam 3, Spring 2010 Your name: Rules You must briefly explain your answers to receive partial credit. When a snippet of code is given to you, you can assume o that the code is enclosed within some function, even if no function

More information

Note: The buy help from the TA for points will apply on this exam as well, so please read that carefully.

Note: The buy help from the TA for points will apply on this exam as well, so please read that carefully. CS 215 Spring 2018 Lab Exam 1 Review Material: - All material for the course up through the Arrays I slides - Nothing from the slides on Functions, Array Arguments, or Implementing Functions Format: -

More information

Name MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

Name MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. CMPSC11 Final (Study Guide) Fall 11 Prof Hartman Name MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. 1) This is a collection of statements that performs

More information

Sol. Sol. a. void remove_items_less_than(int arr[], int size, int value) #include <iostream> #include <ctime> using namespace std;

Sol. Sol. a. void remove_items_less_than(int arr[], int size, int value) #include <iostream> #include <ctime> using namespace std; r6.14 For the operations on partially filled arrays below, provide the header of a func tion. d. Remove all elements that are less than a given value. Sol a. void remove_items_less_than(int arr[], int

More information

CSC 126 FINAL EXAMINATION FINAL Spring 2012 B. Name (last, First) Instructor. Total Possible. Received

CSC 126 FINAL EXAMINATION FINAL Spring 2012 B. Name (last, First) Instructor. Total Possible. Received CSC 126 FINAL EXAMINATION FINAL Spring 2012 B Name (last, First) Instructor Question # Total Possible Total Received 1. 8 2. 8 3. 8 4. 14 5. 18 6. 10 7. 16 8. 18 TOTAL 100 Final Exam/ Page 2 1) (8 points)

More information

Tutorial 13 Salary Survey Application: Introducing One- Dimensional Arrays

Tutorial 13 Salary Survey Application: Introducing One- Dimensional Arrays Tutorial 13 Salary Survey Application: Introducing One- Dimensional Arrays Outline 13.1 Test-Driving the Salary Survey Application 13.2 Introducing Arrays 13.3 Declaring and Initializing Arrays 13.4 Constructing

More information

CSE 333 Midterm Exam Cinco de Mayo, 2017 (May 5) Name UW ID#

CSE 333 Midterm Exam Cinco de Mayo, 2017 (May 5) Name UW ID# Name UW ID# There are 6 questions worth a total of 100 points. Please budget your time so you get to all of the questions. Keep your answers brief and to the point. The exam is closed book, closed notes,

More information

Use the template below and fill in the areas in Red to complete it.

Use the template below and fill in the areas in Red to complete it. C++ with Inheritance Pproblem involving inheritance. You have to finish completing code that creates a class called shape, from which 3 classes are derived that are called square and triangle. I am giving

More information

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

EECS 183 Fall 2015 Exam 2 Free Response (134 points) EECS 183 Fall 2015 Exam 2 Free Response (134 points) Closed Book Closed Notes No Electronic Devices Closed Neighbor Turn off Your Cell Phone, even in your backpack We will confiscate all electronic devices

More information

EECS 183, Week 5. General. Variables I/O. 0. At which location do you have to take the exam? 1. Source code vs. object code? 2. What s a library?

EECS 183, Week 5. General. Variables I/O. 0. At which location do you have to take the exam? 1. Source code vs. object code? 2. What s a library? EECS 183, Week 5 General 0. At which location do you have to take the exam? 1. Source code vs. object code? 2. What s a library? Variables 3. Name main data types in C++. 4. Is string a native data type

More information

Functions. CS111 Lab Queens College, CUNY Instructor: Kent Chin

Functions. CS111 Lab Queens College, CUNY Instructor: Kent Chin Functions CS111 Lab Queens College, CUNY Instructor: Kent Chin Functions They're everywhere! Input: x Function: f Output: f(x) Input: Sheets of Paper Function: Staple Output: Stapled Sheets of Paper C++

More information

Week 3. Function Definitions. Example: Function. Function Call, Return Statement. Functions & Arrays. Gaddis: Chapters 6 and 7. CS 5301 Spring 2018

Week 3. Function Definitions. Example: Function. Function Call, Return Statement. Functions & Arrays. Gaddis: Chapters 6 and 7. CS 5301 Spring 2018 Week 3 Functions & Arrays Gaddis: Chapters 6 and 7 CS 5301 Spring 2018 Jill Seaman 1 Function Definitions l Function definition pattern: datatype identifier (parameter1, parameter2,...) { statements...

More information

Lab 2: Pointers. //declare a pointer variable ptr1 pointing to x. //change the value of x to 10 through ptr1

Lab 2: Pointers. //declare a pointer variable ptr1 pointing to x. //change the value of x to 10 through ptr1 Lab 2: Pointers 1. Goals Further understanding of pointer variables Passing parameters to functions by address (pointers) and by references Creating and using dynamic arrays Combing pointers, structures

More information

CSCI 111 Second Midterm Exam Fall Solutions 09.00am 09.50am, Wednesday, November 29, 2017

CSCI 111 Second Midterm Exam Fall Solutions 09.00am 09.50am, Wednesday, November 29, 2017 QUEENS COLLEGE Department of Computer Science CSCI 111 Second Midterm Exam Fall 2017 11.29.17 Solutions 09.00am 09.50am, Wednesday, November 29, 2017 Problem 1 Write the best title lines for the functions

More information

Here, type declares the base type of the array, which is the type of each element in the array size defines how many elements the array will hold

Here, type declares the base type of the array, which is the type of each element in the array size defines how many elements the array will hold Arrays 1. Introduction An array is a consecutive group of memory locations that all have the same name and the same type. A specific element in an array is accessed by an index. The lowest address corresponds

More information

Functions in C++ Problem-Solving Procedure With Modular Design C ++ Function Definition: a single

Functions in C++ Problem-Solving Procedure With Modular Design C ++ Function Definition: a single Functions in C++ Problem-Solving Procedure With Modular Design: Program development steps: Analyze the problem Develop a solution Code the solution Test/Debug the program C ++ Function Definition: A module

More information

(6) The specification of a name with its type in a program. (7) Some memory that holds a value of a given type.

(6) The specification of a name with its type in a program. (7) Some memory that holds a value of a given type. CS 7A - Fall 2016 - Midterm 1 10/20/16 Write responses to questions 1 and 2 on this paper or attach additional sheets, as necessary For all subsequent problems, use separate paper Do not use a computer

More information

Tutorial Letter 103/1/2017 Introduction to Programming I

Tutorial Letter 103/1/2017 Introduction to Programming I COS1511/103/1/2017 Tutorial Letter 103/1/2017 Introduction to Programming I COS1511 Semester 1 School of Computing Examination Tutorial Letter Contents 1 INTRODUCTION... 2 2 EXAMINATION... 2 3 PAST EXAMINATION

More information

1. (25 pts) Short Answer. Provide brief (1-3 sentence) answers to the following:

1. (25 pts) Short Answer. Provide brief (1-3 sentence) answers to the following: CSCE A211 Sample Midterm 2 Name: 1. (25 pts) Short Answer. Provide brief (1-3 sentence) answers to the following: a) When defining a class, why is it considered a good practice to declare class variable

More information

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

The American University in Cairo Computer Science & Engineering Department CSCE 106 Fundamentals of Computer Science The American University in Cairo Computer Science & Engineering Department CSCE 106 Fundamentals of Computer Science Instructor: Dr. Khalil Final Exam Fall 2012 Last Name :... ID:... First Name:... Form

More information

Topics. Functions. Functions

Topics. Functions. Functions Topics Notes #8 Functions Chapter 6 1) How can we break up a program into smaller sections? 2) How can we pass information to and from functions? 3) Where can we put functions in our code? CMPT 125/128

More information

Bruce Merry. IOI Training Dec 2013

Bruce Merry. IOI Training Dec 2013 IOI Training Dec 2013 Outline 1 2 3 Outline 1 2 3 You can check that something is true using assert: #include int main() { assert(1 == 2); } Output: test_assert: test_assert.cpp:4: int main():

More information

CSCI 1370 APRIL 26, 2017

CSCI 1370 APRIL 26, 2017 CSCI 1370 APRIL 26, 2017 ADMINISTRATIVIA Quarter Exam #3: scores ranged from 0.70 points to 10.05 points, with a median score of 7.07. Note: a total bonus of 1.00 points (+.5 curve, +.5 group reward) was

More information

CSCE 206: Structured Programming in C++

CSCE 206: Structured Programming in C++ CSCE 206: Structured Programming in C++ 2017 Spring Exam 3 Monday, April 17, 2017 Total - 100 Points B Instructions: Total of 11 pages, including this cover and the last page. Before starting the exam,

More information

CSCE 206: Structured Programming in C++

CSCE 206: Structured Programming in C++ CSCE 206: Structured Programming in C++ 2017 Spring Exam 3 Monday, April 17, 2017 Total - 100 Points A Instructions: Total of 11 pages, including this cover and the last page. Before starting the exam,

More information

CS 376b Computer Vision

CS 376b Computer Vision CS 376b Computer Vision 09 / 25 / 2014 Instructor: Michael Eckmann Today s Topics Questions? / Comments? Enhancing images / masks Cross correlation Convolution C++ Cross-correlation Cross-correlation involves

More information

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

CS 216 Fall 2007 Midterm 1 Page 1 of 10 Name:  ID: Page 1 of 10 Name: Email ID: You MUST write your name and e-mail ID on EACH page and bubble in your userid at the bottom of EACH page including this page and page 10. If you do not do this, you will receive

More information

Midterm Practice Exam

Midterm Practice Exam Name: CS 410 Introduction to Software Engineering Fall 2016 Instructor: Marc Pomplun Midterm Practice Exam Duration: 75 minutes No books, no notes, and no calculators are allowed. Question 1: out of points

More information

More Flow Control Functions in C++ CS 16: Solving Problems with Computers I Lecture #4

More Flow Control Functions in C++ CS 16: Solving Problems with Computers I Lecture #4 More Flow Control Functions in C++ CS 16: Solving Problems with Computers I Lecture #4 Ziad Matni Dept. of Computer Science, UCSB Administrative CHANGED T.A. OFFICE/OPEN LAB HOURS! Thursday, 10 AM 12 PM

More information

True or False (12 Points)

True or False (12 Points) Name True or False (12 Points) 1. (12 pts) Circle T for true and F for false: T F a) A void function call occurs as part of an expression. T F b) Value Returning Functions cannot have reference parameters.

More information

PIC 10A. Review for Midterm I

PIC 10A. Review for Midterm I PIC 10A Review for Midterm I Midterm I Friday, May 1, 2.00-2.50pm. Try to show up 5 min early so we can start on time. Exam will cover all material up to and including todays lecture. (Only topics that

More information

Example Final Questions Instructions

Example Final Questions Instructions Example Final Questions Instructions This exam paper contains a set of sample final exam questions. It is for practice purposes only. You ll most likely need longer than three hours to answer all the questions.

More information