CSC 307 DATA STRUCTURES AND ALGORITHM ANALYSIS IN C++ SPRING 2011
|
|
- Willis Cummings
- 6 years ago
- Views:
Transcription
1 CSC 307 DATA STRUCTURES AND ALGORITHM ANALYSIS IN C++ SPRING 2011 Date: 01/18/2011 (Due date: 01/20/2011) Name and ID (print): CHAPTER 6 USER-DEFINED FUNCTIONS I 1. The C++ function pow has parameters. A: zero B: one C: two D: three 2. To avoid compilation errors, function are typically placed before any function definition, including the definition of main. A: headers B: prototypes C: declarations D: bodies 3. A call to a value-returning function with an empty formal parameter list has the form. A: functionname B: void functionname C: functionname() D: functionname(void) 4. The code required to accomplish the task of a function is called the function. A: definition B: body C: header D: prototype 5. Which of the following functions has one parameter of type int? A: exp B: cos
2 C: fabs D: abs 6. To remove the first or last digit of an integer, you can use the operator. A: digit B: rem C: mod D: div 7. A(n) declaration is one in which a variable is declared inside a block to be used only within that block. A: actual B: limited C: function D: local 8. The statements of a function enclosed within curly braces form the of a function. A: body B: definition C: prototype D: header 9. Which of the following statements will output the character 'A'? A: cout << (toupper('a'); B: cout << toupper(a); C: cout << static_cast<char> (toupper('a')); D: cout << static_cast <string>(toupper('a')); 10. In the C++ function sqrt(x), x is called a of the function sqrt. A: value B: function C: return type D: parameter 11. The general syntax of a function prototype of a value-returning function is. A: functiontype functionname (parameter list); B: functiontype functionname (parameter list)
3 C: functiontype functionname (); D: functionname (parameter list); 12. Which of the following is true of the relationship between actual and formal parameters? A: The number of actual and formal parameters may differ. B: The data types of corresponding actual and formal parameters must match. C: Corresponding actual and formal parameters do not have to be listed in the same order. D: All of the above. 13. The function definition consists of the function. A: header and body B: header and prototype C: header D: prototype and body 14. The ceil function is defined in the header file. A: iostream B: cmath C: iomanip D: cstdlib 15. In what order does a compiler translate a program? A: It translates the program sequentially from beginning to end. B: It compiles all functions except main, and then compiles the main function. C: It compiles the main function first, then compiles the remaining functions in order. D: It compiles functions in the order that they are called in the main function. 16. Given the function header double larger(double x, double y), which of the following would be a valid function call to larger? A: larger(5, 6) B: larger() C: larger(double 5, double 6) D: double larger(double 5, double 6) 17. What is the syntax of a formal parameter list (brackets indicate optional elements)? A: datatype (identifier) [, datatype (identifier)...] B: datatype identifier [; datatype identifier...]
4 C: identifier (datatype) [, identifier (datatype)...] D: (datatype identifier) [, (datatype identifier)...] 18. functions are functions that have a return type. A: Value-returning B: Void C: Predefined D: Concrete 19. The C++ function calculates the largest whole number that is less than or equal to x. A: floor(x) B: ceil(x) C: abs(x) D: eqwhole(x) 20. Which of the following elements do NOT have to be included in a function prototype? A: The variable names of the parameters. B: The data types of the parameters. C: The return type of the function. D: The parentheses enclosing the parameter list (if the parameter list is empty). CHAPTER 7 USER-DEFINED FUNCTIONS II 1. The of an identifier refers to where in the program an identifier is accessible. A: function B: scope C: parameters D: reference 2. With the reserved word extern, a function can access a global variable. A: even when the global variable is declared after the function definition. B: only if the function has no local variables C: even if the function has an identifier with the same name D: only if it is declared directly before the function heading 3. If a function's name is overloaded, the determines which function to execute. A: actual parameter list
5 B: main function C: formal parameter list D: return type 4. The actual parameter list of a void function has the following syntax:. A: void variable [, variable...] B: datatype[&] variable [, datatype[&] variable...] C: (void) D: expression or variable [, expression or variable...] 5. When using a reference parameter, a constant value or an expression can only be passed to parameter. A: a nonconstant reference parameter B: a nonconstant value parameter C: a constant reference D: none of the above 6. A identifier is declared within a function or block. A: local B: global C: block D: default 7. To declare an external variable inside a function, you use the syntax. A: extern::identifier; B: extern identifier (datatype); C: extern datatype identifier; D: external datatype identifier; 8. C++ relaxes the rule of one-to-one correspondence between formal and actual parameters with the use of parameters. A: global B: reference C: actual D: default 9. The formal parameter list of a void function has the following syntax:.
6 A: void variable [, variable...] B: datatype[&] variable [, datatype[&] variable...] C: (void) D: expression or variable [, expression or variable...] 10. variables in a function have memory allocated in the function data area. A: External B: Reference C: Global D: Local 11. A identifier is declared outside any function definition. A: local B: global C: block D: default 12. Global variables should be used primarily for. A: value parameters B: named constants C: reference parameters D: all of the above 13. Default values for default parameters can be. A: constants B: global variables C: function calls D: all of the above 14. C++ functions that do not have a data type are called functions. A: void B: parameterized C: reference D: value-returning 15. A parameter receives a copy of the content of the corresponding actual parameter.
7 A: value B: static C: reference D: global 16. When using a reference parameter, the content of the formal parameter is. A: the address of the calling function B: the name of the actual parameter C: the address of the actual parameter D: the value of the actual parameter 17. Which of the following can be true for a global identifier to be accessible by a function or block? A: A local variable of the function has the same name as the global identifier. B: The function name is the same as the name of the global identifier. C: A parameter of the function has the same name as the global identifier. D: The global identifier is declared before the function definition. 18. A variable for which memory is allocated at block entry and deallocated at block exit is called a(n) variable. A: function B: global C: automatic D: static 19. Program execution always begins with the first statement in the. A: first void function B: function main C: program D: first function 20. A parameter receives the location of the corresponding actual parameter. A: value B: static C: reference D: global
8 CHAPTER 8 USER-DEFINED SIMPLE DATA TYPES, NAMESPACES, AND THE STRING TYPE 1. Many compiler vendors begin their global identifier names with a(n). A: pound sign B: underscore C: ampersand D: asterisk 2. The length function. A: specifies the maximum possible length of a string B: returns the number of characters currently in the string C: returns the maximum number of characters the string can hold D: returns the length of the longest word in the string 3. Which of the following is a valid enumeration type definition? A: enum grades {'A', 'B', 'C', 'D', 'E'}; B: enum colors {BROWN, BLUE, RED, GREEN}; C: enum rank {1ST, 2ND, 3RD, 4TH}; D: enum array {[0], [1], [2], [3]}; 4. The mechanism helps solve the problem of overlapping global identifier names. A: include B: enum C: namespace D: typedef 5. The syntax of the length function is. A: strvar.length B: strvar (length) C: strvar.length() D: strvar.length (numchars) 6. The syntax for declaring variables of an enumeration type is. A: enum identifier, identifier... ; B: datatype identifier, identifier... ; C: enum datatype, datatype... ;
9 D: datatype enum; 7. Which of the following can be a namespace member? A: named constant B: variable declaration C: another namespace D: All of the above 8. The length function returns a value of type. A: signed long B: string::int_type C: string::size_type D: char 9. Which of the following operators can be used with enumeration types? A: = B: + C: * D: All of the above 10. The scope of a namespace is. A: global to the C++ library B: undefined C: local to the namespace D: global to all namespaces in the same directory 11. The find function returns a value of type. A: signed long B: string::int_type C: string::size_type D: char 12. Which of the following operators can be used with enumeration types? A: / B: ++ C: <=
10 D: All of the above 13. The general syntax for accessing a namespace member is. A: identifier::namespace::name B: namespace_name.identifier C: namespace_name (identifier) D: namespace_name::identifier 14. The function returns the same value as the length function. A: min B: substr C: max D: size 15. The enumeration type is a(n) type. A: Boolean B: character C: string D: integral 16. You can simplify the accessing of namespace members with the statement. A: using B: include C: typedef D: define 17. The function searches a string to find the first occurrence of a particular substring. A: swap B: length C: substr D: find 18. You can use the operator to increment or decrement the value of an enumeration type. A: scope resolution B: stream C: cast
11 D: assignment 19. A using statement is typically placed. A: in the function in which the namespace members are used B: with the variable declarations in main C: directly before the namespace declaration D: directly after the namespace declaration 20. Which of the following functions has two forms? A: size B: find C: substr D: swap CHAPTER 9 ARRAYS AND STRINGS 1. The of an array is the address of the first array component. A: formal parameter B: subscript C: base address D: index location 2. C++ does not allow. A: arrays to be copied B: component-wise operations on an array C: aggregate operations on an array D: any of the above 3. A array is a collection of a fixed number of components arranged in rows and columns, wherein all components are of the same data type. A: parallel B: two-dimensional C: tabular D: composite 4. You typically step through the elements of an array using a(n). A: switch statement
12 B: named constant C: additional array D: loop 5. C-strings are. A: enclosed in single quotation marks B: enclosed in double quotation marks C: not enclosed in quotes D: are stored in computer memory without a null termination character 6. The of an array specifies the position of a component in an array. A: index value B: data type C: element value D: dimension 7. The last character in a C-string is always. A: the last element of the input string B: the null character C: the integer zero D: the newline character 8. An array is a data type. A: structured B: simple C: constant D: primitive 9. Given an array mylist, what is the result of the statement cout << mylist? A: The compiler generates an error. B: The base address of mylist is output. C: The value of the first element in mylist is output. D: All of the values of mylist are output. 10. A(n) operation on an array is any operation that manipulates the array as an entire unit. A: aggregate
13 B: component C: legal D: composite 11. In the declaration of a two-dimensional array, the value inside the second set of brackets indicates. A: the base address of the array B: the size of the array C: the number of columns in the array D: the number of rows in the array 12. Which of the following will input data into a ten element array named sales? A: for (index = 0; index < 10; index++) cin > > sales[index]; B: cin > > sales; C: for (index = 0; index <= 10; index++) cin > > sales[index]; D: cin > > index; 13. Which of the following aggregate operations can be performed on C-strings? A: comparison B: assignment C: input/output D: none of the above 14. The value inside the brackets of an array declaration specifies the. A: maximum value that can be held by any item in the array B: value of the first element of the array C: number of components in the array D: the number of bytes set aside in memory for the array 15. A C-string can contain any of the following characters anywhere within the string except the character. A: blank B: null C: backslash D: concatenation operator 16. Which of the following is true of an array?
14 A: Each element can be of a different data type. B: The number of elements can be modified at any time. C: It is not part of the C++ language. D: It can have one or more dimensions. 17. When you pass an array as a parameter, the of the actual array is/are passed to the formal parameter. A: exact size B: number of elements C: first element D: base address 18. In C++, arrays. A: cannot be passed to a function B: can be passed by reference or by value C: are passed by value only D: are passed by reference only 19. A(n) is typically used to process an entire two-dimensional array. A: additional array B: a nested switch structure C: single loop D: nested for loop 20. The index of an array is in bounds if. A: index > = 0 and index < = ARRAY_SIZE B: index > = 0 and index < = ARRAY_SIZE + 1 C: index = 0 or index < = ARRAY_SIZE D: index > = 0 and index < = ARRAY_SIZE - 1 CHAPTER 10 APPLICATIONS OF ARRAYS AND THE VECTOR TYPE 1. For a list of length n, on average, the insertion sort makes about item assignments. A: n (n - 1) / 2 B: + 3n - 4 / 4 C: n - 1 / 2
15 D: n (n - 1) / 4 2. A binary search can be performed. A: on sorted or unsorted lists B: only on sorted lists C: only on unsorted lists D: on sorted or partially sorted lists 3. The binary search function presented in this chapter returns to indicate an unsuccessful search. A: -1 B: 0 C: 1 D: false 4. The statement creates a vector object named veclist without any elements. A: vector<elemtype> veclist; B: vectorveclist; C: veclist; D: vector veclist(elemtype); 5. The function size(). A: initializes a vector object to hold zero elements B: returns the maximum number of elements that can be inserted into a vector object C: initializes a vector object to hold a specified number of elements D: returns the number of elements currently held in a vector object 6. The array you use to store a list should be declared with the size of the list. A: minimum B: maximum C: exact D: initial 7. A(n) search sequentially searches an array starting with the first component, and continues until the item is found or when no more data is left in the list. A: linear B: binary
16 C: random D: elemental 8. On average, the number of key comparisons made by a sequential search is equal to. A: half the size of the list B: the size of the list C: the number of unique elements in the list D: the size of the array containing the list 9. The temp variable used in the "swap" code for the bubble sort in this chapter is used to hold the. A: index value of the element to be swapped B: element with the larger value in the swap C: element with the smaller value in the swap D: return value of the function 10. For a list of length n, on average, the selection sort makes key comparisons. A: n (n - 1) / 2 B: n (n -1) / 4 C: n - 1 / 2 D: n / Which of the following sorts, on average, makes the least number of key comparisons? A: bubble B: selection C: insertion D: binary 12. A binary search uses a technique to search the list. A: linear B: sequential C: divide and conquer D: search and remove 13. The binary search function presented in this chapter returns to indicate a successful search. A: the integer 0 B: the value of the element
17 C: the location of the item D: a true value 14. The statement creates a vector object, veclist, with size elements and initialized with default values. A: vector veclist(size); B: vector veclist(size, value); C: vector veclist(value); D: vectorvec<elemtype> List(size); 15. The function can be used to increase the size of a vector object. A: resize() B: size() C: push() D: max_size() 16. To search a list, you need. A: the data structure containing the list B: the length of the list C: the item for which you are searching D: all of the above 17. A sequential search function. A: requires a Boolean variable to exit the search loop B: must return a Boolean value indicating success or failure C: may be implemented with or without a Boolean variable to exit the search loop D: must include the return value inside the search loop 18. The sequential search algorithm. A: assumes that the list is sorted B: does not assume the list is sorted C: always sorts the list before searching D: cannot be performed on a sorted list 19. The code to perform a "swap" for the sorts presented in this chapter requires assignment statements. A: one
18 B: two C: three D: four 20. For a list of length n, on average, the selection sort makes item assignments. A: n (n - 1) / 2 B: n (n - 1) / 4 C: n - 1 / 2 D: 3 (n - 1)
6. User Defined Functions I
6 User Defined Functions I Functions are like building blocks They are often called modules They can be put togetherhe to form a larger program Predefined Functions To use a predefined function in your
More informationChapter 8 Arrays and Strings. Objectives. Objectives (cont d.) Introduction. Arrays 12/23/2016. In this chapter, you will:
Chapter 8 Arrays and Strings Objectives In this chapter, you will: Learn about arrays Declare and manipulate data into arrays Learn about array index out of bounds Learn about the restrictions on array
More informationLecture 2 Arrays, Searching and Sorting (Arrays, multi-dimensional Arrays)
Lecture 2 Arrays, Searching and Sorting (Arrays, multi-dimensional Arrays) In this lecture, you will: Learn about arrays Explore how to declare and manipulate data into arrays Understand the meaning of
More informationChapter 8 - Notes User-Defined Simple Data Types, Namespaces, and the string Type
Chapter 8 - Notes User-Defined Simple Data Types, Namespaces, and the string Type I. Enumeration Type A. Data Type: A set of values together with a set of operations on those values. 1. C++ provides the
More informationC++ Programming: From Problem Analysis to Program Design, Third Edition
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 2: Basic Elements of C++ Objectives (continued) Become familiar with the use of increment and decrement operators Examine
More informationObjectives. In this chapter, you will:
Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates arithmetic expressions Learn about
More informationObjectives. Chapter 2: Basic Elements of C++ Introduction. Objectives (cont d.) A C++ Program (cont d.) A C++ Program
Objectives Chapter 2: Basic Elements of C++ In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates
More informationChapter 2: Basic Elements of C++
Chapter 2: Basic Elements of C++ Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates
More informationChapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction
Chapter 2: Basic Elements of C++ C++ Programming: From Problem Analysis to Program Design, Fifth Edition 1 Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers
More informationChapter 6: User-Defined Functions. Objectives (cont d.) Objectives. Introduction. Predefined Functions 12/2/2016
Chapter 6: User-Defined Functions Objectives In this chapter, you will: Learn about standard (predefined) functions Learn about user-defined functions Examine value-returning functions Construct and use
More informationLab 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 informationObjectives. Chapter 8 Arrays and Strings. Objectives (cont d.) Introduction 12/14/2014. In this chapter, you will:
Objectives Chapter 8 Arrays and Strings In this chapter, you will: Learn about arrays Declare and manipulate data into arrays Learn about array index out of bounds Learn about the restrictions on array
More informationProgramming 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 informationChapter 2 Basic Elements of C++
C++ Programming: From Problem Analysis to Program Design, Fifth Edition 2-1 Chapter 2 Basic Elements of C++ At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class Discussion
More informationcalling a function - function-name(argument list); y = square ( z ); include parentheses even if parameter list is empty!
Chapter 6 - Functions return type void or a valid data type ( int, double, char, etc) name parameter list void or a list of parameters separated by commas body return keyword required if function returns
More informationC++ Basic Elements of COMPUTER PROGRAMMING. Special symbols include: Word symbols. Objectives. Programming. Symbols. Symbols.
EEE-117 COMPUTER PROGRAMMING Basic Elements of C++ Objectives General Questions Become familiar with the basic components of a C++ program functions, special symbols, and identifiers Data types Arithmetic
More informationCSCE 110 PROGRAMMING FUNDAMENTALS
CSCE 110 PROGRAMMING FUNDAMENTALS WITH C++ Prof. Amr Goneid AUC Part 2. Overview of C++ Prof. Amr Goneid, AUC 1 Overview of C++ Prof. Amr Goneid, AUC 2 Overview of C++ Historical C++ Basics Some Library
More informationBy the end of this section you should: Understand what the variables are and why they are used. Use C++ built in data types to create program
1 By the end of this section you should: Understand what the variables are and why they are used. Use C++ built in data types to create program variables. Apply C++ syntax rules to declare variables, initialize
More informationIntroduction 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 informationCSc 10200! Introduction to Computing. Lecture 2-3 Edgardo Molina Fall 2013 City College of New York
CSc 10200! Introduction to Computing Lecture 2-3 Edgardo Molina Fall 2013 City College of New York 1 C++ for Engineers and Scientists Third Edition Chapter 2 Problem Solving Using C++ 2 Objectives In this
More informationCSc Introduction to Computing
CSc 10200 Introduction to Computing Lecture 2 Edgardo Molina Fall 2011 - City College of New York Thursday, September 1, 2011 Introduction to C++ Modular program: A program consisting of interrelated segments
More informationBITG 1233: Introduction to C++
BITG 1233: Introduction to C++ 1 Learning Outcomes At the end of this lecture, you should be able to: Identify basic structure of C++ program (pg 3) Describe the concepts of : Character set. (pg 11) Token
More informationLOGO BASIC ELEMENTS OF A COMPUTER PROGRAM
LOGO BASIC ELEMENTS OF A COMPUTER PROGRAM Contents 1. Statements 2. C++ Program Structure 3. Programming process 4. Control Structure STATEMENTS ASSIGNMENT STATEMENTS Assignment statement Assigns a value
More informationUEE1302 (1102) F10: Introduction to Computers and Programming
Computational Intelligence on Automation Lab @ NCTU Learning Objectives UEE1302 (1102) F10: Introduction to Computers and Programming Programming Lecture 00 Programming by Example Introduction to C++ Origins,
More informationEngineering Problem Solving with C++, Etter/Ingber
Engineering Problem Solving with C++, Etter/Ingber Chapter 2 Simple C++ Programs C++, Second Edition, J. Ingber 1 Simple C++ Programs Program Structure Constants and Variables C++ Operators Standard Input
More informationCS201 Latest Solved MCQs
Quiz Start Time: 09:34 PM Time Left 82 sec(s) Question # 1 of 10 ( Start time: 09:34:54 PM ) Total Marks: 1 While developing a program; should we think about the user interface? //handouts main reusability
More informationChapter 7 - Notes User-Defined Functions II
Chapter 7 - Notes User-Defined Functions II I. VOID Functions ( The use of a void function is done as a stand alone statement.) A. Void Functions without Parameters 1. Syntax: void functionname ( void
More informationIntroduction to C++ Introduction to C++ 1
1 What Is C++? (Mostly) an extension of C to include: Classes Templates Inheritance and Multiple Inheritance Function and Operator Overloading New (and better) Standard Library References and Reference
More informationPace University. Fundamental Concepts of CS121 1
Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction
More informationChapter 6 - Notes User-Defined Functions I
Chapter 6 - Notes User-Defined Functions I I. Standard (Predefined) Functions A. A sub-program that performs a special or specific task and is made available by pre-written libraries in header files. B.
More informationCSI33 Data Structures
Outline Department of Mathematics and Computer Science Bronx Community College October 24, 2018 Outline Outline 1 Chapter 8: A C++ Introduction For Python Programmers Expressions and Operator Precedence
More informationCS242 COMPUTER PROGRAMMING
CS242 COMPUTER PROGRAMMING I.Safa a Alawneh Variables Outline 2 Data Type C++ Built-in Data Types o o o o bool Data Type char Data Type int Data Type Floating-Point Data Types Variable Declaration Initializing
More informationC++ Programming: From Problem Analysis to Program Design, Fifth Edition. Chapter 6: User-Defined Functions I
C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 6: User-Defined Functions I In this chapter, you will: Objectives Learn about standard (predefined) functions and discover
More informationComputer Programming : C++
The Islamic University of Gaza Engineering Faculty Department of Computer Engineering Fall 2017 ECOM 2003 Muath i.alnabris Computer Programming : C++ Experiment #1 Basics Contents Structure of a program
More informationQuiz Start Time: 09:34 PM Time Left 82 sec(s)
Quiz Start Time: 09:34 PM Time Left 82 sec(s) Question # 1 of 10 ( Start time: 09:34:54 PM ) Total Marks: 1 While developing a program; should we think about the user interface? //handouts main reusability
More informationUNIT- 3 Introduction to C++
UNIT- 3 Introduction to C++ C++ Character Sets: Letters A-Z, a-z Digits 0-9 Special Symbols Space + - * / ^ \ ( ) [ ] =!= . $, ; : %! &? _ # = @ White Spaces Blank spaces, horizontal tab, carriage
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 informationHigh Institute of Computer Science & Information Technology Term : 1 st. El-Shorouk Academy Acad. Year : 2013 / Year : 2 nd
El-Shorouk Academy Acad. Year : 2013 / 2014 High Institute of Computer Science & Information Technology Term : 1 st Year : 2 nd Computer Science Department Object Oriented Programming Section (1) Arrays
More information2.1. Chapter 2: Parts of a C++ Program. Parts of a C++ Program. Introduction to C++ Parts of a C++ Program
Chapter 2: Introduction to C++ 2.1 Parts of a C++ Program Copyright 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 2-1 Parts of a C++ Program Parts of a C++ Program // sample C++ program
More informationBasic memory model Using functions Writing functions. Basics Prototypes Parameters Return types Functions and memory Names and namespaces
Basic memory model Using functions Writing functions Basics Prototypes Parameters Return types Functions and memory Names and namespaces When a program runs it requires main memory (RAM) space for Program
More informationCS201 Some Important Definitions
CS201 Some Important Definitions For Viva Preparation 1. What is a program? A program is a precise sequence of steps to solve a particular problem. 2. What is a class? We write a C++ program using data
More information3. Except for strings, double quotes, identifiers, and keywords, C++ ignores all white space.
Chapter 2: Problem Solving Using C++ TRUE/FALSE 1. Modular programs are easier to develop, correct, and modify than programs constructed in some other manner. ANS: T PTS: 1 REF: 45 2. One important requirement
More informationTutorial 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 informationTechnical Questions. Q 1) What are the key features in C programming language?
Technical Questions Q 1) What are the key features in C programming language? Portability Platform independent language. Modularity Possibility to break down large programs into small modules. Flexibility
More informationLecture 3 The character, string data Types Files
Lecture 3 The character, string data Types Files The smallest integral data type Used for single characters: letters, digits, and special symbols Each character is enclosed in single quotes 'A', 'a', '0',
More informationChapter 2: Introduction to C++
Chapter 2: Introduction to C++ Copyright 2010 Pearson Education, Inc. Copyright Publishing as 2010 Pearson Pearson Addison-Wesley Education, Inc. Publishing as Pearson Addison-Wesley 2.1 Parts of a C++
More informationC++ PROGRAMMING SKILLS Part 4: Arrays
C++ PROGRAMMING SKILLS Part 4: Arrays Outline Introduction to Arrays Declaring and Initializing Arrays Examples Using Arrays Sorting Arrays: Bubble Sort Passing Arrays to Functions Computing Mean, Median
More informationChapter 2: Special Characters. Parts of a C++ Program. Introduction to C++ Displays output on the computer screen
Chapter 2: Introduction to C++ 2.1 Parts of a C++ Program Copyright 2009 Pearson Education, Inc. Copyright 2009 Publishing Pearson as Pearson Education, Addison-Wesley Inc. Publishing as Pearson Addison-Wesley
More informationUsing Free Functions
Chapter 3 Using Free Functions 3rd Edition Computing Fundamentals with C++ Rick Mercer Franklin, Beedle & Associates Goals Evaluate some mathematical and trigonometric functions Use arguments in function
More informationFunctions. Lecture 6 COP 3014 Spring February 11, 2018
Functions Lecture 6 COP 3014 Spring 2018 February 11, 2018 Functions A function is a reusable portion of a program, sometimes called a procedure or subroutine. Like a mini-program (or subprogram) in its
More informationIntroduction to C++ Systems Programming
Introduction to C++ Systems Programming Introduction to C++ Syntax differences between C and C++ A Simple C++ Example C++ Input/Output C++ Libraries C++ Header Files Another Simple C++ Example Inline Functions
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 informationC++ Programming: Functions
C++ Programming: Functions Domingos Begalli Saddleback College, Computer Science CS1B, Spring 2018 1 / Domingos Begalli CS1B Sprint 2018 C++ Introduction 1/22 22 we will cover predefined functions user-defined
More informationChapter 10 - Notes Applications of Arrays
Chapter - Notes Applications of Arrays I. List Processing A. Definition: List - A set of values of the same data type. B. Lists and Arrays 1. A convenient way to store a list is in an array, probably a
More informationCSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING Chapter 6: One Dimensional Array
Lesson Outcomes At the end of this chapter, student should be able to: Define array Understand requirement of array Know how to access elements of an array Write program using array Know how to pass array
More informationReview of the C Programming Language for Principles of Operating Systems
Review of the C Programming Language for Principles of Operating Systems Prof. James L. Frankel Harvard University Version of 7:26 PM 4-Sep-2018 Copyright 2018, 2016, 2015 James L. Frankel. All rights
More informationOutline. Functions. Functions. Predefined Functions. Example. Example. Predefined functions User-defined functions Actual parameters Formal parameters
Outline Functions Predefined functions User-defined functions Actual parameters Formal parameters Value parameters Variable parameters Functions 1 Functions 2 Functions Predefined Functions In C++ there
More informationLab # 02. Basic Elements of C++ _ Part1
Lab # 02 Basic Elements of C++ _ Part1 Lab Objectives: After performing this lab, the students should be able to: Become familiar with the basic components of a C++ program, including functions, special
More informationSuperior University. Department of Electrical Engineering CS-115. Computing Fundamentals. Experiment No.6
Superior University Department of Electrical Engineering CS-115 Computing Fundamentals Experiment No.6 Pre-Defined Functions, User-Defined Function: Value Returning Functions Prepared for By: Name: ID:
More informationPIC10B/1 Winter 2014 Exam I Study Guide
PIC10B/1 Winter 2014 Exam I Study Guide Suggested Study Order: 1. Lecture Notes (Lectures 1-8 inclusive) 2. Examples/Homework 3. Textbook The midterm will test 1. Your ability to read a program and understand
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 informationIntroduction to C Final Review Chapters 1-6 & 13
Introduction to C Final Review Chapters 1-6 & 13 Variables (Lecture Notes 2) Identifiers You must always define an identifier for a variable Declare and define variables before they are called in an expression
More informationC++ Support Classes (Data and Variables)
C++ Support Classes (Data and Variables) School of Mathematics 2018 Today s lecture Topics: Computers and Programs; Syntax and Structure of a Program; Data and Variables; Aims: Understand the idea of programming
More information1 Lexical Considerations
Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Spring 2013 Handout Decaf Language Thursday, Feb 7 The project for the course is to write a compiler
More informationC++ 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 informationArrays. Week 4. Assylbek Jumagaliyev
Arrays Week 4 Assylbek Jumagaliyev a.jumagaliyev@iitu.kz Introduction Arrays Structures of related data items Static entity (same size throughout program) A few types Pointer-based arrays (C-like) Arrays
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 informationStarting Out with C++: Early Objects, 9 th ed. (Gaddis, Walters & Muganda) Chapter 2 Introduction to C++ Chapter 2 Test 1 Key
Starting Out with C++ Early Objects 9th Edition Gaddis TEST BANK Full clear download (no formatting errors) at: https://testbankreal.com/download/starting-c-early-objects-9thedition-gaddis-test-bank/ Starting
More informationFORM 1 (Please put your name and form # on the scantron!!!!) CS 161 Exam I: True (A)/False(B) (2 pts each):
FORM 1 (Please put your name and form # on the scantron!!!!) CS 161 Exam I: True (A)/False(B) (2 pts each): 1. The basic commands that a computer performs are input (get data), output (display result),
More information5. Assuming gooddata is a Boolean variable, the following two tests are logically equivalent. if (gooddata == false) if (!
FORM 2 (Please put your name and form # on the scantron!!!!) CS 161 Exam I: True (A)/False(B) (2 pts each): 1. Assume that all variables are properly declared. The following for loop executes 20 times.
More informationFeatures of C. Portable Procedural / Modular Structured Language Statically typed Middle level language
1 History C is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell Labs. C was originally first implemented on the DEC
More informationChapter 4 - Arrays. 4.1 Introduction. Arrays Structures of related data items Static entity (same size throughout program) A few types
Chapter 4 - Arrays 1 4.1 Introduction 4.2 Arrays 4.3 Declaring Arrays 4.4 Examples Using Arrays 4.5 Passing Arrays to Functions 4.6 Sorting Arrays 4.7 Case Study: Computing Mean, Median and Mode Using
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 informationIntroduction. What is function? Multiple functions form a larger program Modular programming
FUNCTION CSC128 Introduction What is function? Module/mini program/sub-program Each function/module/sub-program performs specific task May contains its own variables/statements Can be compiled/tested independently
More informationChapter 4. Procedural Abstraction and Functions That Return a Value. Copyright 2014 Pearson Addison-Wesley. All rights reserved.
Chapter 4 Procedural Abstraction and Functions That Return a Value 1 Overview 4.1 Top-Down Design 4.2 Predefined Functions 4.3 Programmer-Defined Functions 4.4 Procedural Abstraction 4.5 Local Variables
More informationBITG 1233: Array (Part 1) LECTURE 8 (Sem 2, 17/18)
BITG 1233: Array (Part 1) LECTURE 8 (Sem 2, 17/18) 1 LEARNING OUTCOMES At the end of this lecture, you should be able to: 1. Describe the fundamentals of arrays 2. Describe the types of array: One Dimensional
More informationChapter 4 - Arrays. 4.1 Introduction. Arrays Structures of related data items Static entity (same size throughout program)
Chapter - Arrays 1.1 Introduction 2.1 Introduction.2 Arrays.3 Declaring Arrays. Examples Using Arrays.5 Passing Arrays to Functions.6 Sorting Arrays. Case Study: Computing Mean, Median and Mode Using Arrays.8
More informationReview: Exam 1. Your First C++ Program. Declaration Statements. Tells the compiler. Examples of declaration statements
Review: Exam 1 9/20/06 CS150 Introduction to Computer Science 1 1 Your First C++ Program 1 //*********************************************************** 2 // File name: hello.cpp 3 // Author: Shereen Khoja
More informationB.V. Patel Institute of Business Management, Computer & Information Technology, Uka Tarsadia University
Unit 1 Programming Language and Overview of C 1. State whether the following statements are true or false. a. Every line in a C program should end with a semicolon. b. In C language lowercase letters are
More informationC++ Programming Chapter 7 Pointers
C++ Programming Chapter 7 Pointers Yih-Peng Chiou Room 617, BL Building (02) 3366-3603 ypchiou@cc.ee.ntu.edu.tw Photonic Modeling and Design Lab. Graduate Institute of Photonics and Optoelectronics & Department
More informationC++ basics Getting started with, and Data Types.
C++ basics Getting started with, and Data Types pm_jat@daiict.ac.in Recap Last Lecture We talked about Variables - Variables, their binding to type, storage etc., Categorization based on storage binding
More informationIntroduction to C++ Professor Hugh C. Lauer CS-2303, System Programming Concepts
Introduction to C++ Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2 nd edition, by Kernighan and Ritchie, Absolute C++, by Walter
More informationChapter 3. Numeric Types, Expressions, and Output
Chapter 3 Numeric Types, Expressions, and Output 1 Chapter 3 Topics Constants of Type int and float Evaluating Arithmetic Expressions Implicit Type Coercion and Explicit Type Conversion Calling a Value-Returning
More informationFull file at
Java Programming: From Problem Analysis to Program Design, 3 rd Edition 2-1 Chapter 2 Basic Elements of Java At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class
More informationLexical Considerations
Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Spring 2010 Handout Decaf Language Tuesday, Feb 2 The project for the course is to write a compiler
More informationCS201- Introduction to Programming Latest Solved Mcqs from Midterm Papers May 07,2011. MIDTERM EXAMINATION Spring 2010
CS201- Introduction to Programming Latest Solved Mcqs from Midterm Papers May 07,2011 Lectures 1-22 Moaaz Siddiq Asad Ali Latest Mcqs MIDTERM EXAMINATION Spring 2010 Question No: 1 ( Marks: 1 ) - Please
More informationArrays. Chapter 7 (Done right after 4 arrays and loops go together, especially for loops)
Arrays Chapter 7 (Done right after 4 arrays and loops go together, especially for loops) Object Quick Primer A large subset of Java s features are for OOP Object- Oriented Programming We ll get to that
More informationGE 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 informationComputer Programming C++ (wg) CCOs
Computer Programming C++ (wg) CCOs I. The student will analyze the different systems, and languages of the computer. (SM 1.4, 3.1, 3.4, 3.6) II. The student will write, compile, link and run a simple C++
More informationCSC Web Programming. Introduction to JavaScript
CSC 242 - Web Programming Introduction to JavaScript JavaScript JavaScript is a client-side scripting language the code is executed by the web browser JavaScript is an embedded language it relies on its
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 informationBITG 1113: Array (Part 1) LECTURE 8
BITG 1113: Array (Part 1) LECTURE 8 1 1 LEARNING OUTCOMES At the end of this lecture, you should be able to: 1. Describe the fundamentals of arrays 2. Describe the types of array: One Dimensional (1 D)
More informationGetting started with C++ (Part 2)
Getting started with C++ (Part 2) CS427: Elements of Software Engineering Lecture 2.2 11am, 16 Jan 2012 CS427 Getting started with C++ (Part 2) 1/22 Outline 1 Recall from last week... 2 Recall: Output
More informationData Types, Variables and Arrays. OOC 4 th Sem, B Div Prof. Mouna M. Naravani
Data Types, Variables and Arrays OOC 4 th Sem, B Div 2016-17 Prof. Mouna M. Naravani Identifiers in Java Identifiers are the names of variables, methods, classes, packages and interfaces. Identifiers must
More informationProgramming Fundamentals. With C++ Variable Declaration, Evaluation and Assignment 1
300580 Programming Fundamentals 3 With C++ Variable Declaration, Evaluation and Assignment 1 Today s Topics Variable declaration Assignment to variables Typecasting Counting Mathematical functions Keyboard
More informationChapter Two MULTIPLE CHOICE
Chapter Two MULTIPLE CHOICE 1. In a C++ program, two slash marks ( // ) indicate: a. The end of a statement b. The beginning of a comment c. The end of the program d. The beginning of a block of code 2.
More informationObject-oriented Programming for Automation & Robotics Carsten Gutwenger LS 11 Algorithm Engineering
Object-oriented Programming for Automation & Robotics Carsten Gutwenger LS 11 Algorithm Engineering Lecture 3 Winter 2011/12 Oct 25 Visual C++: Problems and Solutions New section on web page (scroll down)
More informationWeek 2: Console I/O and Operators Arithmetic Operators. Integer Division. Arithmetic Operators. Gaddis: Chapter 3 (2.14,3.1-6,3.9-10,5.
Week 2: Console I/O and Operators Gaddis: Chapter 3 (2.14,3.1-6,3.9-10,5.1) CS 1428 Fall 2014 Jill Seaman 1 2.14 Arithmetic Operators An operator is a symbol that tells the computer to perform specific
More informationLaboratory 0 Week 0 Advanced Structured Programming An Introduction to Visual Studio and C++
Laboratory 0 Week 0 Advanced Structured Programming An Introduction to Visual Studio and C++ 0.1 Introduction This is a session to familiarize working with the Visual Studio development environment. It
More informationUNIT - I. Introduction to C Programming. BY A. Vijay Bharath
UNIT - I Introduction to C Programming Introduction to C C was originally developed in the year 1970s by Dennis Ritchie at Bell Laboratories, Inc. C is a general-purpose programming language. It has been
More information