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

Similar documents
(the bubble footer is automatically inserted in this space)

(the bubble footer is automatically inserted into this space)

CS 216 Fall 2007 Final Exam Page 1 of 10 Name: ID:

(the bubble footer is automatically inserted in this space)

(the bubble footer is automatically inserted in this space)

(the bubble footer is automatically inserted into this space)

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

(the bubble footer is automatically inserted in this space)

(the bubble footer is automatically inserted into this space)

(the bubble footer is automatically inserted into this space)

(the bubble footer is automatically inserted in this space)

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

CS 2150 (fall 2010) Midterm 2

(the bubble footer is automatically inserted into this space)

(the bubble footer is automatically inserted into this space)

(the bubble footer is automatically inserted into this space)

CS 216 Exam 1 Fall SOLUTION

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

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

(the bubble footer is automatically inserted in this space)

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

COMP322 - Introduction to C++ Lecture 01 - Introduction

CPSC 211, Sections : Data Structures and Implementations, Honors Final Exam May 4, 2001

CSE 333 Final Exam 3/19/14

CSE au Midterm Exam Nov. 2, 2018 Sample Solution

CSE030 Fall 2012 Final Exam Friday, December 14, PM

CE221 Programming in C++ Part 1 Introduction

Short Notes of CS201

CSCE 206: Structured Programming in C++

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

CS201 - Introduction to Programming Glossary By

CSCI 102L - Data Structures Midterm Exam #2 Spring 2011

CS Introduction to Programming Midterm Exam #2 - Prof. Reed Fall 2015

Review: Exam 1. Your First C++ Program. Declaration Statements. Tells the compiler. Examples of declaration statements

Program Organization and Comments

ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two 26 February 2014

CSCE 210/2201 Data Structures and Algorithms. Prof. Amr Goneid

CSCE 210/2201 Data Structures and Algorithms. Prof. Amr Goneid. Fall 2018

CSE 333 Final Exam Sample Solution 3/19/14

CS 132 Exam #1 - Study Suggestions

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

ECE 462 Exam 1. 6:30-7:30PM, September 22, 2010

CSE 333 Midterm Exam July 24, Name UW ID#

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

CS 211 Winter 2004 Sample Final Exam (Solutions)

1 P a g e A r y a n C o l l e g e \ B S c _ I T \ C \

CSE 333 Midterm Exam 7/25/16. Name UW ID#

Arrays. Week 4. Assylbek Jumagaliyev

Physics 234: Computational Physics

Lab 8. Follow along with your TA as they demo GDB. Make sure you understand all of the commands, how and when to use them.

ECE264 Fall 2013 Exam 1, September 24, 2013

Lab # 02. Basic Elements of C++ _ Part1

CS 251 INTERMEDIATE SOFTWARE DESIGN SPRING C ++ Basics Review part 2 Auto pointer, templates, STL algorithms

More Group HW. #ifndef Stackh #define Stackh. #include <cstdlib> using namespace std;

1/29/2011 AUTO POINTER (AUTO_PTR) INTERMEDIATE SOFTWARE DESIGN SPRING delete ptr might not happen memory leak!

Implementing an ADT with a Class

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

! Determine if a number is odd or even. ! Determine if a number/character is in a range. - 1 to 10 (inclusive) - between a and z (inclusive)

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

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

Final Exam. Name: Student ID: Section: Signature:

CSCE 206: Structured Programming in C++

CSCE 206: Structured Programming in C++

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

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

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

CS Exam 2 Study Suggestions

III. Classes (Chap. 3)

C++ Programming for Non-C Programmers. Supplement

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

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

CS 311 Data Structures and Algorithms, Fall 2009 Midterm Exam Solutions. The Midterm Exam was give in class on Wednesday, October 21, 2009.

Getting started with C++ (Part 2)

Overview. - General Data Types - Categories of Words. - Define Before Use. - The Three S s. - End of Statement - My First Program

Chapter 13. Recursion. Copyright 2016 Pearson, Inc. All rights reserved.

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

Paytm Programming Sample paper: 1) A copy constructor is called. a. when an object is returned by value

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

CPSC 427: Object-Oriented Programming

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

COMP322 - Introduction to C++ Lecture 02 - Basics of C++

Object Oriented Design

Lab 1: First Steps in C++ - Eclipse

CSCE 110 PROGRAMMING FUNDAMENTALS

OOP- 4 Templates & Memory Management Print Only Pages 1-5 Individual Assignment Answers To Questions 10 Points - Program 15 Points

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

Welcome to MCS 360. content expectations. using g++ input and output streams the namespace std. Euclid s algorithm the while and do-while statements

BEng (Hons) Electronic Engineering. Resit Examinations for / Semester 1

C++ For Science and Engineering Lecture 2

Exam 3 Chapters 7 & 9

Introduction to C++ 2. A Simple C++ Program. A C++ program consists of: a set of data & function definitions, and the main function (or driver)

Unit 7. 'while' Loops

Week 2: Console I/O and Operators Arithmetic Operators. Integer Division. Arithmetic Operators. Gaddis: Chapter 3 (2.14,3.1-6,3.9-10,5.

AN OVERVIEW OF C++ 1

Computer Architecture I Midterm I

W3101: Programming Languages C++ Ramana Isukapalli

Preface... (vii) CHAPTER 1 INTRODUCTION TO COMPUTERS

To become familiar with array manipulation, searching, and sorting.

ME240 Computation for Mechanical Engineering. Lecture 4. C++ Data Types

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

Transcription:

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 a zero for that page! (Or a grade penalty if you leave out the bubble form for pages 1 or 10) If you are still writing when pens down is called, your exam will be ripped up and not graded even if you are still writing to fill in the bubble forms. So please do that first. Sorry to have to be strict on this Other than bubbling in your userid at the bottom, please do not write in the footer section of each page. There are 10 pages to this exam once the exam starts, please make sure you have all 10 pages. There are two types of questions: short answer and long answer. You can tell the difference because the long answer questions have a full page to answer them, while there are 5 short answer questions per page. The 20 short answer questions should not take more than a line or two to answer, and are worth 3 points each. Your answer should not exceed about 20 words. The 4 long answer questions are worth 10 points each. Thus, this entire test is worth 100 points. There is 95 minutes to take it, which means you should spend about 1 minute per question point. This exam is CLOSED text book, closed-notes, closed-calculator, closed-neighbor, etc. Questions are worth different amounts, so be sure to look over all the questions and plan your time accordingly. Please sign the honor pledge here: There are 10 types of people in the world those that understand binary and those that don t.

Page 2 of 10 Name: Email ID: 1 What is the Emacs keyboard command to save a file? To exit Emacs? 2 Give two applications of a stack, other than a postfix calculator. 3 Why aren t one s complement binary numbers used often? 4 What is the difference between big-oh and little-oh? 5 What is big-omega? What is big-theta?

Page 3 of 10 Name: Email ID: 6 There is a little-oh and a little-omega. Why isn t there a little-theta? 7 If an algorithm is O(log n), why don t we care about the base of the logarithm? 8 How is a reference different from a pointer? 9 Why do we have the #ifndef FOO_H / #define FOO_H / / #endif in each header file? 10 What does the friend keyword do in C++?

Page 4 of 10 Name: Email ID: 11 What does the explicit keyword do in C++? 12 Convert 234 in base 5 to base 9. 13 Convert A4 in base 16 to base 3 14 What do templates allow us to accomplish in C++ that we would not be able to do otherwise? 15 What does a union in C++ accomplish? When would it be used?

Page 5 of 10 Name: Email ID: 16 Fill in the table for the properties of these functions. Put a X in the boxes where the function has the property. Big-Oh Big-Omega Big-Theta Little-Oh Little-Theta Reflexive (ara) Symmetric (if arb then bra) Transitive (if arb and brc then arc) 17 Encode -14 as a two s complement binary integer (of 8 bits) 18 Give a big-oh estimate for the recursive running time of fibonacci(n) (here n means the n th term of the sequence). 19 Give a big-oh estimate for the iterative running time of fibonacci(n) (here n means the nth term of the sequence). 20 What is the exponent and mantissa size for IEEE 754 single-precision and IEEE 754 double-precision (the kind we studied in class) floating point numbers?

Page 6 of 10 Name: Email ID: 21 Write the queue ADT (i.e. the description of the data structure, as per lecture). State the big-oh running time for each method.

Page 7 of 10 Name: Email ID: 22 Convert -11.5 to the hexadecimal representation for a single-precision IEEE 754 floating point number. You can leave it in big-endian format. You can NOT use a calculator for this. If you don t remember the exponent and mantissa size (i.e. question 20), you can take a guess, and you can still receive partial credit.

Page 8 of 10 Name: Email ID: 23 Write a complete C++ program that will print out all the command-line parameters. As a hint, the prototype for the main method when using command-line parameters is int main (int argc, char ** argv).

Page 9 of 10 Name: Email ID: 24 What does memory look like after the following code has executed? What is the output? If anything would cause an error, indicate such, and assume that the program would be compiled and executed without that line. Also assume that memory addresses start at 0x1000, and that all ints and pointers are 32 bits. Lastly, prior to running the program, you can assume that all memory has been initialized to a repeating 10101010 pattern. Note that 32 bits of a repeating 10101010 pattern in an int is -1431655766 in base 10. #include <iostream> using namespace std; int main() { int a = 7; int *b; int *c = &a; int &d = a; int &e = *c; int **f = &c; int g[4]; int h[] = { 1, 2, 3, 4 }; } cout << a << endl; cout << b << endl; cout << *b << endl; cout << c << endl; cout << *c << endl; cout << d << endl; cout << e << endl; cout << f << endl; cout << *f << endl; cout << **f << endl; cout << g << endl; cout << g[0] << endl; cout << h << endl; cout << h[0] << endl;

Page 10 of 10 Name: Email ID: This page unintentionally left blank.