COP 3014: Fall Final Study Guide. December 5, You will have an opportunity to earn 15 extra credit points.

Similar documents
Absolute C++ Walter Savitch

CHAPTER 1 Introduction to Computers and Programming CHAPTER 2 Introduction to C++ ( Hexadecimal 0xF4 and Octal literals 031) cout Object

Introduction to Programming Using Java (98-388)

Java for Non Majors. Final Study Guide. April 26, You will have an opportunity to earn 20 extra credit points.

Exam 1 Prep. Dr. Demetrios Glinos University of Central Florida. COP3330 Object Oriented Programming

Introduction to Computers and C++ Programming p. 1 Computer Systems p. 2 Hardware p. 2 Software p. 7 High-Level Languages p. 8 Compilers p.

File Operations. Lecture 16 COP 3014 Spring April 18, 2018

Problem Solving with C++

CSI33 Data Structures

CSCI 1061U Programming Workshop 2. C++ Basics

Chapter 2 Basic Elements of C++

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:

Strings and Streams. Professor Hugh C. Lauer CS-2303, System Programming Concepts

Homework #3 CS2255 Fall 2012

Your First C++ Program. September 1, 2010

c++ keywords: ( all lowercase ) Note: cin and cout are NOT keywords.

Chapter 2 Using Data. Instructor s Manual Table of Contents. At a Glance. Overview. Objectives. Teaching Tips. Quick Quizzes. Class Discussion Topics

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:

Pace University. Fundamental Concepts of CS121 1

CS201- Introduction to Programming Current Quizzes

Full file at

CS201 Latest Solved MCQs

Full file at

Course Text. Course Description. Course Objectives. StraighterLine Introduction to Programming in C++

Objectives. In this chapter, you will:

String Objects: The string class library

C-LANGUAGE CURRICULAM

Discover how to get up and running with the Java Development Environment and with the Eclipse IDE to create Java programs.

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

Objectives. Chapter 2: Basic Elements of C++ Introduction. Objectives (cont d.) A C++ Program (cont d.) A C++ Program

Chapter 2: Basic Elements of C++

Chapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction

Introduction to C++ with content from

Numerical Computing in C and C++ Jamie Griffin. Semester A 2017 Lecture 2

C Programming. Course Outline. C Programming. Code: MBD101. Duration: 10 Hours. Prerequisites:

Quiz Start Time: 09:34 PM Time Left 82 sec(s)

SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR


Assignment 5: MyString COP3330 Fall 2017

Chapter 2: Using Data

Features of C. Portable Procedural / Modular Structured Language Statically typed Middle level language

Engineering Problem Solving with C++, Etter

Scientific Computing

Review Chapters 1 to 4. Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013

Introduction to C++ Introduction. Structure of a C++ Program. Structure of a C++ Program. C++ widely-used general-purpose programming language

Name Section: M/W T/TH Number Definition Matching (6 Points)

Chapter 7 Arithmetic

Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

KOM3191 Object Oriented Programming Dr Muharrem Mercimek OPERATOR OVERLOADING. KOM3191 Object-Oriented Programming

Programming with C++ as a Second Language

by Pearson Education, Inc. All Rights Reserved. 2

Question No: 1 ( Marks: 1 ) - Please choose one One difference LISP and PROLOG is. AI Puzzle Game All f the given

Name Section: M/W T/TH Number Definition Matching (8 Points)

Tokens, Expressions and Control Structures

Chapter 7. Additional Control Structures

Outline. 1 Function calls and parameter passing. 2 Pointers, arrays, and references. 5 Declarations, scope, and lifetimes 6 I/O

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

CS31 Discussion 1E. Jie(Jay) Wang Week3 Oct.12

The Warhol Language Reference Manual

PIC 10A Pointers, Arrays, and Dynamic Memory Allocation. Ernest Ryu UCLA Mathematics

Object Oriented Programming

Computer Science II (20082) Week 1: Review and Inheritance

CS11 Java. Fall Lecture 1

CS3157: Advanced Programming. Outline

Text File I/O. #include <iostream> #include <fstream> using namespace std; int main() {

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

switch case Logic Syntax Basics Functionality Rules Nested switch switch case Comp Sci 1570 Introduction to C++

Model Viva Questions for Programming in C lab

The Foundation of C++: The C Subset An Overview of C p. 3 The Origins and History of C p. 4 C Is a Middle-Level Language p. 5 C Is a Structured

Chapter 2. Procedural Programming

Programming Language Basics

QUIZ. How could we disable the automatic creation of copyconstructors

Chapter 3. More Flow of Control. Copyright 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Pointer Basics. Lecture 13 COP 3014 Spring March 28, 2018

A SHORT COURSE ON C++

QUIZ. 1. Explain the meaning of the angle brackets in the declaration of v below:

CS Exam 2 Study Suggestions

Final exam. Final exam will be 12 problems, drop any 2. Cumulative up to and including week 14 (emphasis on weeks 9-14: classes & pointers)

Lecture 10. Command line arguments Character handling library void* String manipulation (copying, searching, etc.)

I BSc(IT) [ Batch] Semester II Core: Object Oriented Programming With C plus plus - 212A Multiple Choice Questions.

CPE Summer 2015 Exam I (150 pts) June 18, 2015

C++ Programming: From Problem Analysis to Program Design, Third Edition

PIC10B/1 Winter 2014 Exam I Study Guide


CS 151 Review #3. // More than one variable can be defined // in a statement. Multiple variables are // separated by a comma.

CS2141 Software Development using C/C++ C++ Basics

CONTENTS. PART 1 Structured Programming 1. 1 Getting started 3. 2 Basic programming elements 17

Introduction to C++ Professor Hugh C. Lauer CS-2303, System Programming Concepts

Creating a C++ Program

QUIZ. How could we disable the automatic creation of copyconstructors

Reviewing for the Midterm Covers chapters 1 to 5, 7 to 9. Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013

Contents. Figures. Tables. Examples. Foreword. Preface. 1 Basics of Java Programming 1. xix. xxi. xxiii. xxvii. xxix

Structured Programming Using C++ Lecture 2 : Introduction to the C++ Language. Dr. Amal Khalifa. Lecture Contents:

PART I. Part II Answer to all the questions 1. What is meant by a token? Name the token available in C++.

3. Except for strings, double quotes, identifiers, and keywords, C++ ignores all white space.

Stream Computing using Brook+

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


Java Bytecode (binary file)

CS201 Some Important Definitions

Transcription:

COP 3014: Fall 2017 Final Study Guide December 5, 2017 The test consists of 1. 15 multiple choice questions - 30 points 2. 2 find the output questions - 20 points 3. 2 code writing questions - 30 points 4. 1 code debugging question - 20 points 5. 3 short answer questions - 15 points General details: You will have an opportunity to earn 15 extra credit points. Please try and attempt all questions. You get points for trying. The test is cumulative and would include questions from pretty much everything covered in the course. You won t be asked to write code / interpret code / debug with anything covered after Files (Classes, emuns, C concepts and binary arithmetic). You would have multiple choice / free response questions on C Concepts, classes and enums. You won t be questioned on binary arithmetic at all. Anything from the homeworks / quizzes / in class examples / exercises / slides is fair game. You don t need to look for more material. Code debugging is mostly syntax based (missing brackets, semicolons, typos, missing quotes, wrong operators etc.) The code writing questions will be heavily based on the homeworks and class examples and exercises, with some modifications. The multiple choice and the debugging questions will test your familiarity with the C++ language and syntax. The code writing questions will test your knowledge of programming. Making me laugh might gain you points (depends on the quality of the joke). 1

Topics to study Basic C++ Syntax Writing a basic C++ program stub: including required libraries, adding namespaces and writing the main function. Simple statements - syntax. Comments. Reserved words, literals and escape sequences. Style guidelines. Primitive Data types, variables, operators, and sequential execution. Naming, declaring and initializing variables. Primitive data types. Type Conversions - implicit and explicit. Arithmetic Operators and operator precedence. I/O - printing and reading values from the user. cout statements - printing literals and variables. Precision for floating point variables. Using cin to read data of different kinds. Selection statements and loops Relational and logical operators. Writing simple, multiple and nested if statements. switch - case statements. while, do-while and for loops break and continue statements. Writing functions in C++. Arrays Strings Writing simple functions. Passing arguments and returning values. Pass by value and pass by reference. Scope of local and global variables. Function overloading and default parameters. Declaring and initializing an array. Reading in array values from the user and printing arrays. Basic array operations - looking for a number, math with array elements, etc. Passing arrays as parameters to functions. Multi dimensional arrays. Cstrings - arrays of characters. string objects 2

Reading strings with getline - both options cstring, cctype and string libraries Basic string operations - counting different kinds of characters, finding and replacing substrings, etc. Declaring, initializing, comparing and concatenating strings Arrays of strings. Pointers Declaring, initializing and dereferencing pointers. null pointer, reinterpret cast and pointer arithmetic. Pass by address, arrays with pointers, cstrings with pointers. new and delete operators, dynamic memory allocation. Structures Creating structures, declaring variables of the new type, creating nested structures, arrays of structures, pointers to structures. The dot, arrow and assignment operators. Structures and functions - passing and returning. File Operations Text Files and Streams How to read from a text file, how to write to a text file. Objects of ifstream and ofstream and some associated member functions, like eof(). Character I/O - get(), put() and ignore() Streams and functions Object Orieneted Programming Classes and Objects Enumerations You don t need to study from outside sources. quizzes and assignments. The test is made entirely from the notes, Sample Questions 1. Which of the following is a C++ reserved word? (a) file (b) ifstream (c) ofstream (d) enum 2. Which of the following strings will be placed before banana in lexicographical order? (a) Peach (b) Strawberry 3

(c) 2 green apples (d) All of the above 3. Consider the following function declaration: int count (char *st) If you had a for loop (loop variable i) iterating through the Cstring in the function, which of the following lines would result in an error? (a) cout<<st[i]; (b) st[i++] = X ; (c) cout<<*st[i]; (d) cout<<*(++st); 4. A perfect number is defined as a positive integer that is equal to the sum of its factors (not including itself). For example, 6 is a perfect number, because the sum of the factors of 6 = 1 + 2 + 3 = 6. Write a C++ program to print all the perfect numbers between 0 and 1000 Sample Run: 6 28 496 5. Write a C++ program to create an array of 200 integers. Read in the values from a file called input.txt. Then, print all the numbers that occur more than once. You can assume the file will open without issues. You can assume the file has 200 numbers. 6. Write a C++ program with the following requirements: Create a structure called Date that contains the following elements: day - integer month - integer year - integer Create a structure called Flight that contains the following elements: Flight Number - string Source - string destination - string date - Date number of passengers - integer In the main function, create a dynamically allocated structure variable and read in values from the user. Write a function the uses pass by address to accept a structure variable and prints the contents of a the structure in sentence form. Sample Run: Enter the following details: Flight Number: DL 110 Source: ATL Destination: LAX Date (month day year): 12 12 2017 Number of passengers: 120 DL 110 from ATL to LAX on 12/12/2017 has 120 passengers. 4

7. What is data hiding? How does having different access levels help in implementing data hiding? 8. Find the output of the following code snippet: char st[] = "Once upon a time there was an ugly barnacle"; for(int i=0; i<strlen(st); i++) st[i++]=toupper(st[i]); cout<<st<<endl; 5