CSCE 2004 Final Exam Spring Version A
|
|
- Edgar Harper
- 6 years ago
- Views:
Transcription
1 CSCE 2004 Final Exam Spring 2017 Version A Student Name: Student UAID: Instructions: This is a two-hour closed book final exam. Students are allowed one 8.5 by 11 page of notes. No calculators or cell phones are allowed. Please raise your hand if you have questions. Reminder: This class is governed by the University of Arkansas code of ethics. Any instances of cheating will result in referral to the All University Academic Integrity Board. -1-
2 Conditionals - 15 points [5 points] Which statement below best matches there are fewer than 10 numbers and the total is more than 100? a) ((Num <= 10) && (Total >= 100)) b) ((Num < 10) (Total > 100)) c) ((Num < 10) && (Total > 100)) d) ((Num <= 10) (Total >= 100)) [5 points] What will the following code output when executed? int Age = 18; string Name = "David"; if (Age >= 18) if (Name[0] == 'D') cout << "Hello. "; else cout << "Goodbye. "; cout << "Congratulations!"; a) Hello. Congratulations! b) Goodbye. Congratulations! c) Congratulations! d) Hello. Goodbye. [5 points] Which statement below best matches the person is 18 years old or older and they are more than 70 inches tall? a) (!(Age <= 18) &&!(Height < 70) ) b) ( (Age >= 18) && (Height > 70) ) c) (!(Age <= 18) && (Height >= 70)) d) ( (Age >= 18) && (Height < 70)) -2-
3 Iteration - 20 points [5 points] What will the following code output when executed? int Num = 0; int Sum = 1; while (Sum < 10) Sum = Sum + Num; Num = Num + 1; cout << "Sum = " << Sum << ", Num = " << Num << endl; a) Sum = 11, Num = 5 b) Sum = 10, Num = 5 c) Sum = 14, Num = 5 d) Sum = 11, Num = 4 [5 points] How many times will "Hello" be printed by the following code? int num = 0; while (num < 4) for (int cnt = 0; cnt < 6; cnt = cnt + 3) cout << "Hello\n"; num = num + 1; a) 2 times. b) 4 times. c) 6 times. d) 8 times. -3-
4 [5 points] What will the following code output when executed? int Outer, Inner; for (Outer = 0; Outer < 4; Outer++) Inner = Outer + 1; while (Inner <= 5) cout << Outer; Inner++; cout << " "; cout << endl; a) b) c) d) [5 points] What will the following code output when executed? int n = 0; while ((n <= 5) (n > 0)) n++; cout << n << ' '; cout << endl; a) and so on forever b) and so on forever c) d) e)
5 Arrays 10 points [5 points] Assume that the one-dimensional array data contains 10 integers with values between [ ]. Which of the following pieces of code will find and print the maximum value in this array? a) b) c) d) int val = data[0]; for (int i = 0; i < 10; i++) if (data[i] < val) val = data[i]; cout << val << endl; int val = -100; for (int i = 1; i <= 10; i++) if (data[i] < val) val = data[i]; cout << val << endl; int val = 100; for (int i = 0; i < 10; i++) if (val < data[i]) val = data[i]; cout << val << endl; int val = data[0]; for (int i = 1; i < 10; i++) if (val < data[i]) val = data[i]; cout << val << endl; [5 points] Which one of the following C++ declarations will create a twodimensional array of integers called number with 4 rows and 6 columns? a) int[4][6] number; b) int[6][4] number; c) int number[4][6]; d) int number[6][4]; e) None of the above -5-
6 Functions 20 points [10 points] Assume we are given the following variables and function prototypes. Which of the function calls below are syntactically correct and use the return values from functions properly? // Variable declarations int A, B; float X, Y, Z; char C, D; // Function prototypes float ReadNum(); int GetMax(int Value1, int Value2); void Difference(float Num1, float Num2, float &Diff); GetMax(A, B, C); A = GetMax(2+2, 4); cout << GetMax(5, 10); B = GetMax(GetMax(1,2), 3); Difference(X, Y, 6.0); Z = Difference(X, Y); Difference(X, Y, Z); Y = ReadNum(); cin >> ReadNum(); cout << ReadNum(); -6-
7 Consider the following C++ code: int work(int num) num = num * 2; return num; int play(int & val) val = val / 3; if (val > 10) return val; else return work(val); int main() int A, B; A = 12; B = work(a); cout << A << " " << B << endl; B = 21; A = play(b); cout << A << " " << B << endl; return 0; // ONE // TWO [5 points] What values will be printed at position ONE in the code? a) b) c) d) e) None of the above [5 points] What values will be printed at position TWO in the code? a) 4 8 b) 14 7 c) 8 4 d) 7 14 e) None of the above -7-
8 Files 10 points Assume that the following information is stored in a text file called "data.txt". 1 Jane Joseph Jennifer John Jessie 2.3 Consider the following C++ code: int main() int num; string name; float score; ifstream din; din.open( data.txt ); // CHECK OPEN // READ DATA din.close(); return 0; [5 points] What code should be used in place of CHECK OPEN above to check if the input file has been opened correctly, and end the program if an error is detected? a) if (din.fail() == false) return -1; b) if (!din.eof()) cout << Error detected end program\n ; c) if (din.fail()) return -1; d) if (din.open() == false) din.close(); e) None of the above -8-
9 [5 points] What code should be used in place of READ DATA above to read and print all of the information in the data file to the screen? a) b) c) d) din >> name >> num >> score; while (!din.eof()) cout << num << << name << << score << endl; din >> name >> num >> score; while (din >> num >> name >> score) cout << name << << num << << score << endl; while (!din.eof()) cout << din.getline(); while (din >> num, name, score) cout << num << << name << << score << endl; e) None of the above -9-
10 Classes 25 points [10 points] Circle true or false to answer the following questions. The constructor method in a class is automatically called when we declare an object. One advantage of private variables is that they take less memory space than public variables. The copy constructor is automatically called when we pass an object as a value parameter. It is possible to declare public variables in a class, but this violates the information hiding principle of classes. When we have a method in a class with more than three parameters, this is called parameter overloading. The destructor method is automatically called inside the constructor method. All methods in a class must have at least one parameter, or return a data value of some type. The private variables in a class can be accessed and modified by any method in the class. Private methods can be called in the main program just like public methods; there is no difference between them. Classes in C++ are intended to make it easier for groups of programmers to work together and call each others code. -10-
11 Consider the following C++ class definition: class Sphere public: Sphere(); Sphere(const float R); void SetRadius(const float R); float GetRadius(); float Modify(); void Change(float &S); void Print(); private: float radius; bool IsNotZero() const; ; [10 points] Assume the following C++ variables are declared in the main function and the method calls below are made after the declarations. Which method calls are syntactically correct and use the return values properly? Sphere UnitSphere(1); Sphere Ball; Sphere Several[5]; float Radius = 0; float Number = 0.5; if (Ball.IsNotZero()) Ball.Print(); Change(UnitSphere, 2.5); Ball.GetRadius(Radius); cout << Ball.Modify(); UnitSphere.Modify(Number); Radius = Several[3].GetRadius(); Several[2].SetRadius(3); UnitSphere.Change(Number); Ball = Several[2]; Ball.radius = UnitSphere.radius; -11-
12 [5 points] Consider the following C++ program with one class called Math. We have provided inline implementations of the class methods to reduce the size of the program. What will this program output when it is executed? class Math public: Math() num = 5; Math(int val) num = val; void Work() num = num * num; int Play(int val) num = num + val; return num; void Print(string name) cout << name << " = " << num << ", "; private: int num; ; int main() Math x; Math y(6); x. Work(); y. Work(); x.print("x"); y.print("y"); int a = x.play(2); int b = y.play(4); x.print("x"); y.print("y"); return 0; a) x = 5, y = 6, x = 4, y = 2, b) x = 25, y = 36, x = 21, y = 34, c) x = 5, y = 6, x = 25, y = 36, d) x = 25, y = 36, x = 27, y = 40, e) None of the above -12-
CSCE 2004 Midterm Exam Spring 2017
CSCE 2004 Midterm Exam Spring 2017 Student Name: Student UAID: Instructions: This is a 50 minute exam. Students are allowed one 8.5 by 11 page of study notes. Calculators, cell phones and computers are
More informationCSCE 2014 Final Exam Spring Version A
CSCE 2014 Final Exam Spring 2017 Version A Student Name: Student UAID: Instructions: This is a two-hour exam. Students are allowed one 8.5 by 11 page of study notes. Calculators, cell phones and computers
More informationCSCE 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 informationThe 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 informationMultiple 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 informationCS 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 information2013 Academic Challenge
Academic Challenge COMPUTER SCIENCE TEST - SECTIONAL This Test Consists of Questions Computer Science Test Production Team Jim Feher, McKendree University Author/Team Leader Nathan White, McKendree University
More informationCSCE 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 informationMultiple 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 informationTotal 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 informationComputer Department. Question (1): State whether each of the following is true or false. Question (2): Select the correct answer from the following:
Computer Department Program: Computer Midterm Exam Date : 19/11/2016 Major: Information & communication technology 1 st Semester Time : 1 hr (10:00 11:00) Course: Introduction to Programming 2016/2017
More information5.1. Chapter 5: The Increment and Decrement Operators. The Increment and Decrement Operators. Looping. ++ is the increment operator.
Chapter 5: Looping 5.1 The Increment and Decrement Operators Copyright 2009 Pearson Education, Inc. Copyright Publishing as Pearson 2009 Addison-Wesley Pearson Education, Inc. Publishing as Pearson Addison-Wesley
More informationThe 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 informationMultiple 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 informationMultiple 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 informationwhile for do while ! set a counter variable to 0 ! increment it inside the loop (each iteration)
Week 7: Advanced Loops while Loops in C++ (review) while (expression) may be a compound (a block: {s) Gaddis: 5.7-12 CS 1428 Fall 2015 Jill Seaman 1 for if expression is true, is executed, repeat equivalent
More information*Starting Out with C++: From Control Structures through Objects, 7/E* by *Tony Gaddis* COMPUTER PROGRAMMING LECTURE 05 LOOPS IMRAN IHSAN
PowerPoint Slides adapted from *Starting Out with C++: From Control Structures through Objects, 7/E* by *Tony Gaddis* Copyright 2012 Pearson Education Inc. COMPUTER PROGRAMMING LECTURE 05 LOOPS IMRAN IHSAN
More informationI BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination. June, 2015 BCS-031 : PROGRAMMING IN C ++
No. of Printed Pages : 3 I BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination 05723. June, 2015 BCS-031 : PROGRAMMING IN C ++ Time : 3 hours Maximum Marks : 100 (Weightage 75%)
More information1- 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 informationReviewing all Topics this term
Today in CS161 Prepare for the Final Reviewing all Topics this term Variables If Statements Loops (do while, while, for) Functions (pass by value, pass by reference) Arrays (specifically arrays of characters)
More information5.1. Chapter 5: The Increment and Decrement Operators. The Increment and Decrement Operators. The Increment and Decrement Operators
Chapter 5: 5.1 Looping The Increment and Decrement Operators The Increment and Decrement Operators The Increment and Decrement Operators ++ is the increment operator. It adds one to a variable. val++;
More informationTopics. Constructor. Constructors
Topics 1) How can we initialize an object when it's created? 2) How can we do things when an object is destroyed? 3) How can we write functions with different parameters? Slides #11 - Text 7.6-7.7 Constructors
More informationThe 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 informationMidterm Examination. Instructor: Gary Chan Date: Saturday, 23 October 2010 Time: 2:30pm 4:00pm Venue: LTC
THE HONG KONG UNIVERSITY OF SCIENCE & TECHNOLOGY Department of Computer Science & Engineering COMP 152: Object-Oriented Programming and Data Structures Fall 2010 Midterm Examination Instructor: Gary Chan
More informationCSCE 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 informationCS201- Introduction to Programming Current Quizzes
CS201- Introduction to Programming Current Quizzes Q.1 char name [] = Hello World ; In the above statement, a memory of characters will be allocated 13 11 12 (Ans) Q.2 A function is a block of statements
More informationConsider the following statements. string str1 = "ABCDEFGHIJKLM"; string str2; After the statement str2 = str1.substr(1,4); executes, the value of str2 is " ". Given the function prototype: float test(int,
More informationCopyright 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 5-1
Copyright 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 5-1 Chapter 6 : (Control Structure- Repetition) Using Decrement or Increment While Loop Do-While Loop FOR Loop Nested Loop
More informationFORM 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 informationCS 115 Exam 3, Spring 2011
CS 115 Exam 3, Spring 2011 Your name: Rules You may use one handwritten 8.5 x 11 cheat sheet (front and back). This is the only resource you may consult during this exam. Explain/show work if you want
More informationCSCS 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 informationCh 6. Functions. Example: function calls function
Ch 6. Functions Part 2 CS 1428 Fall 2011 Jill Seaman Lecture 21 1 Example: function calls function void deeper() { cout
More informationREAD THIS NOW! Failure to read and follow the instructions below may result in severe penalties. 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. Print your name in the space provided below. Print your name and ID number on the Opscan form; be sure to
More informationCPE Summer 2015 Exam I (150 pts) June 18, 2015
Name Closed notes and book. If you have any questions ask them. Write clearly and make sure the case of a letter is clear (where applicable) since C++ is case sensitive. You can assume that there is one
More informationFunctions, Arrays & Structs
Functions, Arrays & Structs Unit 1 Chapters 6-7, 11 Function Definitions! Function definition pattern: datatype identifier (parameter1, parameter2,...) { statements... Where a parameter is: datatype identifier
More informationProgramming. C++ Basics
Programming C++ Basics Introduction to C++ C is a programming language developed in the 1970s with the UNIX operating system C programs are efficient and portable across different hardware platforms C++
More informationChapter 5: Prefix vs. Postfix 8/19/2018. The Increment and Decrement Operators. Increment and Decrement Operators in Program 5-1
Chapter 5: Loops and Files The Increment and Decrement Operators ++ is the increment operator. It adds one to a variable. val++; is the same as val = val + 1; ++ can be used before (prefix) or after (postfix)
More informationCPE 112 Spring 2015 Exam II (100 pts) March 4, Definition Matching (8 Points)
Name Definition Matching (8 Points) 1. (8 pts) Match the words with their definitions. Choose the best definition for each word. Relational Expression Iteration Counter Count-controlled loop Loop Flow
More informationCS 117 Programming II, Spring 2018 Dr. Ghriga. Midterm Exam Estimated Time: 2 hours. March 21, DUE DATE: March 28, 2018 at 12:00 PM
CS 117 Programming II, Spring 2018 Dr. Ghriga Midterm Exam Estimated Time: 2 hours March 21, 2018 DUE DATE: March 28, 2018 at 12:00 PM INSTRUCTIONS: Do all exercises for a total of 100 points. You are
More informationQuestion 2. [5 points] Given the following symbolic constant definition
CS 101, Spring 2012 Mar 20th Exam 2 Name: Question 1. [5 points] Determine which of the following function calls are valid for a function with the prototype: void drawrect(int width, int height); Assume
More informationCS 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 informationCMSC 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 informationUniversity of Maryland Baltimore County. CMSC 202 Computer Science II. Fall Mid-Term Exam. Sections
University of Maryland Baltimore County CMSC 202 Computer Science II Fall 2004 Mid-Term Exam Sections 0201 0206 Lecture Hours: Monday Wednesday 5:30 PM 6:45 PM Exam Date: Wednesday 10/20/2004 Exam Duration:
More informationCS 216 Exam 1 Fall SOLUTION
CS 216 Exam 1 Fall 2004 - SOLUTION Name: Lab Section: Email Address: Student ID # This exam is closed note, closed book. You will have an hour and fifty minutes total to complete the exam. You may NOT
More informationBasic program The following is a basic program in C++; Basic C++ Source Code Compiler Object Code Linker (with libraries) Executable
Basic C++ Overview C++ is a version of the older C programming language. This is a language that is used for a wide variety of applications and which has a mature base of compilers and libraries. C++ is
More informationCSCS 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 informationCSE143 Exam with answers Problem numbering may differ from the test as given. Midterm #2 February 16, 2001
CSE143 Exam with answers Problem numbering may differ from the test as given. All multiple choice questions are equally weighted. You can generally assume that code shown in the questions is intended to
More informationMultiple 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 informationReview: C++ Basic Concepts. Dr. Yingwu Zhu
Review: C++ Basic Concepts Dr. Yingwu Zhu Outline C++ class declaration Constructor Overloading functions Overloading operators Destructor Redundant declaration A Real-World Example Question #1: How to
More informationFunctions, Arrays & Structs
Functions, Arrays & Structs Unit 1 Chapters 6-7, 11 Function Definitions l Function definition pattern: datatype identifier (parameter1, parameter2,...) { statements... Where a parameter is: datatype identifier
More information#include <iostream> #include <algorithm> #include <cmath> using namespace std; int f1(int x, int y) { return (double)(x/y); }
1. (9 pts) Show what will be output by the cout s in this program. As in normal program execution, any update to a variable should affect the next statement. (Note: boolalpha simply causes Booleans to
More informationName Section: M/W T/TH Number Definition Matching (8 Points)
Name Section: M/W T/TH Number Definition Matching (8 Points) 1. (8 pts) Match the words with their definitions. Choose the best definition for each word. Iteration Counter Event Counter Loop Abstract Step
More informationWeek 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 informationCS2141 Software Development using C/C++ C++ Basics
CS2141 Software Development using C/C++ C++ Basics Integers Basic Types Can be short, long, or just plain int C++ does not define the size of them other than short
More informationChapter 5: Loops and Files
Chapter 5: Loops and Files 5.1 The Increment and Decrement Operators The Increment and Decrement Operators ++ is the increment operator. It adds one to a variable. val++; is the same as val = val + 1;
More informationC++ Final Exam 2017/2018
1) All of the following are examples of integral data types EXCEPT. o A Double o B Char o C Short o D Int 2) After the execution of the following code, what will be the value of numb if the input value
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 informationCSCS 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 informationThe 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 2013 Last Name :... ID:... First Name:... Form
More informationExam 3 Chapters 7 & 9
Exam 3 Chapters 7 & 9 CSC 2100-002/003 29 Mar 2017 Read through the entire test first BEFORE starting Put your name at the TOP of every page The test has 4 sections worth a total of 100 points o True/False
More informationShort Notes of CS201
#includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system
More informationExam 2. CSI 201: Computer Science 1 Fall 2016 Professors: Shaun Ramsey and Kyle Wilson. Question Points Score Total: 80
Exam 2 CSI 201: Computer Science 1 Fall 2016 Professors: Shaun Ramsey and Kyle Wilson Question Points Score 1 18 2 29 3 18 4 15 Total: 80 I understand that this exam is closed book and closed note and
More informationFinal Exam Solutions PIC 10B, Spring 2016
Final Exam Solutions PIC 10B, Spring 2016 Problem 1. (10 pts) Consider the Fraction class, whose partial declaration was given by 1 class Fraction { 2 public : 3 Fraction ( int num, int den ); 4... 5 int
More informationCS201 - Introduction to Programming Glossary By
CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with
More informationConcepts Review. 2. A program is the implementation of an algorithm in a particular computer language, like C and C++.
Concepts Review 1. An algorithm is a sequence of steps to solve a problem. 2. A program is the implementation of an algorithm in a particular computer language, like C and C++. 3. A flowchart is the graphical
More informationThe 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. Howaida Ismail Final Exam Spring 2013 Last Name :... ID:... First Name:...
More informationIntroduction to Programming I COS1511 School of Computing Revision Notes
Introduction to Programming I COS1511 School of Computing Revision Notes UNISA 2018 1 Introduction Some key basic principles to remember: Apply the BODMAS rules of Mathematics for all calculations; The
More informationMidterm Exam #2 Spring (1:00-3:00pm, Friday, March 15)
Print Your Name: Signature: USC email address: CSCI 101L Fundamentals of Computer Programming Midterm Exam #2 Spring 2013 (1:00-3:00pm, Friday, March 15) Instructor: Prof Tejada Problem #1 (20 points):
More informationName Section: M/W T/TH Number Definition Matching (6 Points)
Name Section: M/W T/TH Number Definition Matching (6 Points) 1. (6 pts) Match the words with their definitions. Choose the best definition for each word. Event Counter Iteration Counter Loop Flow of Control
More informationArrays. Arizona State University 1
Arrays CSE100 Principles of Programming with C++, Fall 2018 (based off Chapter 8 slides by Pearson) Ryan Dougherty Arizona State University http://www.public.asu.edu/~redoughe/ Arizona State University
More information1) What of the following sets of values for A, B, C, and D would cause the string "one" to be printed?
Instructions: This homework assignment focuses primarily on some of the basic syntax and semantics of C++. The answers to the following questions can be determined from Chapters 6 and 7 of the lecture
More informationTotal 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 informationWeek 2. Relational Operators. Block or compound statement. if/else. Branching & Looping. Gaddis: Chapters 4 & 5. CS 5301 Spring 2018.
Week 2 Branching & Looping Gaddis: Chapters 4 & 5 CS 5301 Spring 2018 Jill Seaman 1 Relational Operators l relational operators (result is bool): == Equal to (do not use =)!= Not equal to > Greater than
More informationCS2255 HOMEWORK #1 Fall 2012
CS55 HOMEWORK #1 Fall 01 1.What is assigned to the variable a given the statement below with the following assumptions: x = 10, y = 7, and z, a, and b are all int variables. a = x >= y; a. 10 b. 7 c. The
More informationName. 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 informationExam 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 information2 nd Week Lecture Notes
2 nd Week Lecture Notes Scope of variables All the variables that we intend to use in a program must have been declared with its type specifier in an earlier point in the code, like we did in the previous
More information! Pass by value: when an argument is passed to a. ! It is implemented using variable initialization. ! Changes to the parameter in the function body
Week 3 Pointers, References, Arrays & Structures Gaddis: Chapters 6, 7, 9, 11 CS 5301 Fall 2013 Jill Seaman 1 Arguments passed by value! Pass by value: when an argument is passed to a function, its value
More informationThis test is OPEN Textbook and CLOSED notes. The use of computing and/or communicating devices is NOT permitted.
University of Toronto Faculty of Applied Science and Engineering ECE 244F PROGRAMMING FUNDAMENTALS Fall 2013 Midterm Test Examiners: T.S. Abdelrahman, V. Betz, M. Stumm and H. Timorabadi Duration: 110
More informationName SECTION: 12:45 2:20. True or False (12 Points)
Name SECION: 12:45 2:20 rue or False (12 Points) 1. (12 pts) Circle for true and F for false: F a) Local identifiers have name precedence over global identifiers of the same name. F b) Local variables
More information7.1. Chapter 7: Arrays Hold Multiple Values. Array - Memory Layout. A single variable can only hold one value. Declared using [] operator:
Chapter 7: 7.1 Arrays Arrays Hold Multiple Values Arrays Hold Multiple Values Array - Memory Layout A single variable can only hold one value int test; 95 Enough memory for 1 int What if we need to store
More informationVariable Definitions and Scope
Variable Definitions and Scope The scope of a variable is the part of the program where the variable may be used. For a variable defined inside a function, its scope is the function, from the point of
More informationCSC 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 informationGovernment Polytechnic, Muzaffarpur. Name of the Lab: OBJECT ORIENTED PROGRAMMING
Government Polytechnic, Muzaffarpur. Name of the Lab: OBJECT ORIENTED PROGRAMMING THROUGH C++ Practical: OOPS THROUGH C++ Subject Code: 1618407 PROGRAM NO.1 Programming exercise on executing a Basic C++
More informationChapter 3 Problem Solving and the Computer
Chapter 3 Problem Solving and the Computer An algorithm is a step-by-step operations that the CPU must execute in order to solve a problem, or to perform that task. A program is the specification of an
More informationChapter 3. More Flow of Control. Copyright 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Chapter 3 More Flow of Control Overview 3.1 Using Boolean Expressions 3.2 Multiway Branches 3.3 More about C++ Loop Statements 3.4 Designing Loops Slide 3-3 Flow Of Control Flow of control refers to the
More informationCS31 Discussion 1E Spring 17 : week 08
CS31 Discussion 1E Spring 17 : week 08 TA: Bo-Jhang Ho bojhang@cs.ucla.edu Credit to former TA Chelsea Ju Project 5 - Map cipher to crib Approach 1: For each pair of positions, check two letters in cipher
More informationWeek 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 informationLAB 4.1 Relational Operators and the if Statement
LAB 4.1 Relational Operators and the if Statement // This program tests whether or not an initialized value of num2 // is equal to a value of num1 input by the user. int main( ) int num1, // num1 is not
More informationCS 6456 OBJCET ORIENTED PROGRAMMING IV SEMESTER/EEE
CS 6456 OBJCET ORIENTED PROGRAMMING IV SEMESTER/EEE PART A UNIT I 1. Differentiate object oriented programming from procedure oriented programming. 2. Define abstraction and encapsulation. 3. Differentiate
More informationPage. No. 1/15 CS201 Introduction to Programmming Solved Subjective Questions From spring 2010 Final Term Papers By vuzs Team
Page. No. 1/15 CS201 Introduction to Programmming Solved Subjective Questions From spring 2010 Final Term Papers By vuzs Team Question No: 1 ( Marks: 2 ) Write a declaration statement for an array of 10
More informationAbstract Data Types (ADT) and C++ Classes
Abstract Data Types (ADT) and C++ Classes 1-15-2013 Abstract Data Types (ADT) & UML C++ Class definition & implementation constructors, accessors & modifiers overloading operators friend functions HW#1
More informationKingdom of Saudi Arabia Princes Nora bint Abdul Rahman University College of Computer Since and Information System CS242 ARRAYS
Kingdom of Saudi Arabia Princes Nora bint Abdul Rahman University College of Computer Since and Information System CS242 1 ARRAYS Arrays 2 Arrays Structures of related data items Static entity (same size
More informationCSCI 101L - Data Structures. Practice problems for Final Exam. Instructor: Prof Tejada
CSCI 101L - Data Structures Practice problems for Final Exam Instructor: Prof Tejada 1 Problem 1. Debug this code Given the following code to increase the value of a variable: void Increment(int x) { x
More informationCSCE 110 PROGRAMMING FUNDAMENTALS
CSCE 110 PROGRAMMING FUNDAMENTALS WITH C++ Prof. Amr Goneid AUC Part 15. Dictionaries (1): A Key Table Class Prof. amr Goneid, AUC 1 Dictionaries(1): A Key Table Class Prof. Amr Goneid, AUC 2 A Key Table
More informationKapil Sehgal PGT Computer. Science Ankleshwar Gujarat
Classes Chapter 4 Classes and Objects Data Hiding and Encapsulation Function in a Class Using Objects Static Class members Classes Class represents a group of Similar objects A class is a way to bind the
More information2. It is possible for a structure variable to be a member of another structure variable.
FORM 1(put name, form, and section number on scantron!!!) CS 162 Exam I True (A) / False (B) (2 pts) 1. What value will the function eof return if there are more characters to be read in the input stream?
More informationReview Problems for Final Exam. 1. What is the output of the following program? #include <iostream> #include <string> using namespace std;
Review Problems for Final Exam 1. What is the output of the following program? int draw(int n); int n = 4; while (n>0) n = draw(n); int draw(int n) for(int i = 0; i < n; i++) cout
More informationREPETITION CONTROL STRUCTURE LOGO
CSC 128: FUNDAMENTALS OF COMPUTER PROBLEM SOLVING REPETITION CONTROL STRUCTURE 1 Contents 1 Introduction 2 for loop 3 while loop 4 do while loop 2 Introduction It is used when a statement or a block of
More informationLecture-5. Miscellaneous topics Templates. W3101: Programming Languages C++ Ramana Isukapalli
Lecture-5 Miscellaneous topics Templates W3101: Programming Languages C++ Miscellaneous topics Miscellaneous topics const member functions, const arguments Function overloading and function overriding
More information