Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

Size: px
Start display at page:

Download "Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program."

Transcription

1 Name: Class: Date: Exam #1 - Prep True/False Indicate whether the statement is true or false. 1. Programming is the process of writing a computer program in a language that the computer can respond to and that other programmers can understand. 2. Computers are designed to respond to heuristic commands. 3. A data object consists of exactly one piece of data. 4. When all of the statements in a source program are translated before any one statement is executed, the programming language used is called a compiled language. 5. A keyword is a word that is set aside by the C++ language for a special purpose and should only be used in a specified manner. 6. A good function name should never be a mnemonic. 7. A C++ program does not always require a main() function. 8. The iostream file is referred to as a header file because a reference to it is always placed at the top, or head, of a C++ program using the #include command. 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program. 10. Properly coded programs do not need comments if the program code is self-explanatory. 11. To prevent the programmer from attempting to perform an inappropriate operation, C++ allows only certain operations to be performed on certain types of data. 12. The term literal reflects the fact that such a value explicitly identifies itself. 13. Limitations of small and extremely expensive memory are a major concern for the vast majority of programs. 14. When the escape character is placed directly in front of a select group of characters, it tells the compiler to escape from the way these characters would normally be interpreted. 15. Both the char and bool data types are signed data types. 16. Floating-point numbers cannot be written in exponential notation. 17. Character data cannot be displayed using cout. 2

2 Name: 18. The endl item is an example of an escape sequence. 19. C++ does not allow mixed-mode expressions. 20. Two binary arithmetic operator symbols may be placed side by side. 21. Expressions containing more than one addition or subtraction are evaluated from left to right as each operator is encountered. 22. An operator s associativity establishes its priority in relation to all other operators. 23. Assignment statements always have an equals (=) sign and one variable name immediately to the left of this sign. 24. Variables that hold single-precision values are declared using the keyword float, whereas variables that hold double-precision values are declared using the keywords double float. 25. Variables that have the same data type can always be grouped together and declared by using a single declaration statement. 26. Declaring multiple variables in a single declaration statement requires giving the data type of variables only once, separating all variable names by commas, and using only one semicolon to terminate the declaration. 27. Current C++ compilers can allocate sufficient storage for a variable without knowing the variable s data type. 28. The compiler only generates an error message for undeclared variables if they are not used in the program. 29. An expression is any combination of constants, variables, and function calls that can be evaluated to yield a result. 30. An example of coercion occurs when an integer value is assigned to a real variable. 31. The statement sum = sum + 10; causes a new value to be stored in sum. 32. The statement variable = variable + newvalue; is an example of an accounting statement. 33. The argument to the sqrt function must be a rational number. 34. The expression sqrt(pow(abs(num1), num2)) is a valid expression. 35. The C type cast syntax does not work in C Data for programs that are going to be executed only once should never be included directly in the program. 37. A well-constructed program should validate user input and ensure that a program does not either crash or produce nonsensical output due to unexpected input. 2

3 Name: 38. C++ does not provide a way for programmers to assign symbolic names to constants, such as the mathematical constant PI. 39. The expression (count + n)++ is a valid expression. 40. Relational expressions cannot be used to compare operands. 41. The logical operators AND, OR and NOT are used to create more complex relational expressions. 42. Tests for equality of single-precision and double-precision values and variables using the relational operator == are usually reliable. 43. The if-else statement directs the computer to select between two statements based on the result of a comparison. 44. The use of braces to enclose a set of individual statements creates a single block of statements, which may be used anywhere in a C++ program in place of a single statement. 45. The statement following if (expression) is executed only if the expression has a nonzero value (a true condition). 46. if-else statements can not contain other if-else statements. 47. An if-else chain is stopped once a true condition is found. 48. An if-else chain can not be continued indefinitely by repeatedly making the last statement another if-else statement. 49. In a switch statement, the keyword case is used to identify individual values that are compared to the value of the switch expression. 50. Using the assignment operator, =, in place of the relational operator, ==, is a commonly made C++ programming error. Multiple Choice Identify the choice that best completes the statement or answers the question. 1. Another term for a computer program is. a. hardware c. object b. software d. procedure 2. Programs written in low-level languages usually execute than programs written in high-level languages. a. more accurately c. faster b. less accurately d. slower 3

4 Name: 3. The purpose of a procedure is to accept as input and transform it in some manner to produce a specific result as an output. a. numbers c. formulas b. objects d. data 4. An algorithm is a step-by-step sequence of that describes how a computation is to be performed. a. data c. objects b. instructions d. classes 5. When English-like phrases are used to describe an algorithm (the processing steps), the description is called. a. a formula c. a program b. a flowchart d. pseudocode 6. The writing of an algorithm using computer-language statements is called the algorithm. a. compiling c. interpreting b. coding d. debugging 7. The concept of creating a particular object from a larger defining set called a is fundamental to all object-oriented programming languages, such as C++. a. super-set c. class b. master set d. relationship 8. To generate a program that can be executed by the computer requires that the C++ program, which is referred to as a source program, be translated into the computer s. a. data c. objects b. machine language d. classes 9. You cannot write a C++ program without relying on some. a. high level code c. machine language b. procedural code d. pseudocode 10. A(n) program is simply a translated version of the source program that can be executed by the computer system with one more processing step. a. compiled c. object b. debugged d. C Most C++ programs contain statements that use for input and output and for finding such quantities as square roots, absolute values, and other commonly encountered mathematical calculations. a. classes c. databases b. objects d. preprogrammed routines 12. In C++, modules can be either or functions. a. classes c. objects b. methods d. procedures 13. The first character of an identifier must be a or an underscore (_). a. number c. letter b. mnemonic d. special character 4

5 Name: 14. We can tell the program which class or function to use by indicating the where we want the compiler to look for the class or function. a. location c. module b. address d. namespace 15. A programming language s is the set of rules for formulating statements that are grammatically correct for the language. a. syntax c. dictionary b. namespace d. format 16. A data is defined as a set of values and a set of operations that can be applied to these values. a. type c. base b. set d. dictionary 17. A(n) value consists of digits only and can optionally be preceded by a plus (+) or minus (-) sign. a. integer c. floating-point b. char d. signed 18. The ANSI C++ standard requires that an int must provide as much storage as a short int. a. at least c. three times b. twice d. four times 19. The value of 1.625e3 is. a c b d The C++ statement cout << (6 + 15); yields the result. a. (6 + 15) c. error b. 21 d. (21) 21. The keyword endl is an example of a C++. a. literal c. object b. character d. manipulator 22. An expression containing only integer values as operands is called a(n) expression. a. standard c. regular b. whole d. integer 23. An expression containing only floating-point values (single-precision and double-precision) as operands is called a expression. a. complex c. real b. mixed d. block 24. An expression containing integer and floating-point values is called a expression. a. whole c. mixed-mode b. standard d. real 25. statements are used to force the compiler to reserve enough physical memory storage for each variable. a. Initialization c. Declamation b. Assignment d. Definition 5

6 Name: 26. All operands used in an expression must before the expression is evaluated. a. have values assigned to them c. be parameterized b. be simplified d. be printed out 27. If b is an integer and d is a double-precision number, the evaluation of the expression b*d is a(n) value. a. integer c. real b. float d. double-precision 28. If n is initialized to the value 5, the expression --n changes the value of n to. a. 1 c. 5 b. 4 d In C++ there are square root functions all named sqrt, with the data type of the argument determining which function is actually called. a. one c. three b. two d. four 30. The compile-time cast is a operator having the syntax datatype (expression). a. unary c. coercive b. binary d. switch 31. The cin object is used to enter data into a program while it is. a. compiling c. interpreting b. running d. loading 32. When a cout statement prints a string that tells the person at the terminal what should be typed, the output string used in this manner is called a(n). a. prompt c. interrupt b. checkpoint d. pause 33. The cin extraction operation data type conversions. a. always makes the correct c. can make some b. can make no d. makes only integer to float 34. The const qualifier specifies that the declared identifier is read-only after it is. a. defined c. edited b. initialized d. validated 35. If it is necessary to change the value of a constant with a symbolic name, the change need only be made. a. at compile time c. twice b. once d. at execution time 36. Using letters is customary in C++ to make const identifiers easy to identify. a. lowercase c. bold b. italic d. uppercase 37. The increment and decrement operators can be applied only to variables. a. expressions involving two or fewer c. individual b. expressions involving three or fewer d. real 6

7 Name: 38. The extraction operator used with cin is. a. << c., b. >> d. <> 39. One of the most common C++ programming errors is forgetting to values for all variables that are used in an expression. a. assign or initialize c. compute b. read in d. parameterize 40. A computer s capability can be used to create an intelligence-like facility. a. adding c. subtracting b. comparison d. thinking 41. A relational expression consists of a relational operator connecting two variable and/or constant operands. a. standard c. single b. default d. simple 42. Like all C++ expressions, relational expressions are evaluated to yield a result. a. single-precision c. Boolean b. double-precision d. numerical 43. letters is essential in alphabetizing names. a. Comparing c. Deleting b. Capitalizing d. Adding 44. can be used to alter the assigned operator priority and improve the readability of relational expressions. a. Colons c. Parentheses b. Semicolons d. Braces 45. Many numbers cannot be represented exactly in binary form using a finite number of bits. a. small c. integer b. large d. decimal 46. For single-precision and double-precision operands, the general expression operand_1 == operand_2 should be replaced by this condition: a. operand_1 operand_2 < EPSILON b. abs(operand_1 operand_2) < EPSILON c. operand_2 operand_1 < EPSILON d. operand_1 operand_2 >= EPSILON 47. Using to enclose a set of statements creates a single block of statements. a. semicolons c. parentheses b. colons d. braces 48. If age is initialized to equal 18, the statement age == 40 has a value of. a. 0 c. 18 b. 1 d case labels may be contained within a switch statement. a. Up to 1 c. Up to 100 b. Up to 10 d. Any number of 7

8 Name: 50. It is to terminate the last case in a switch statement with a break. a. required c. a syntax error b. mandatory d. not necessary 8

9 Exam #1 - Prep Answer Section TRUE/FALSE 1. ANS: T PTS: 1 REF: 4 2. ANS: F PTS: 1 REF: 5 3. ANS: F PTS: 1 REF: 9 4. ANS: T PTS: 1 REF: ANS: T PTS: 1 REF: ANS: F PTS: 1 REF: ANS: F PTS: 1 REF: ANS: T PTS: 1 REF: ANS: T PTS: 1 REF: ANS: F PTS: 1 REF: ANS: T PTS: 1 REF: ANS: T PTS: 1 REF: ANS: F PTS: 1 REF: ANS: T PTS: 1 REF: ANS: F PTS: 1 REF: ANS: F PTS: 1 REF: ANS: F PTS: 1 REF: ANS: F PTS: 1 REF: ANS: F PTS: 1 REF: ANS: F PTS: 1 REF: ANS: T PTS: 1 REF: ANS: F PTS: 1 REF: ANS: T PTS: 1 REF: ANS: F PTS: 1 REF: ANS: T PTS: 1 REF: ANS: T PTS: 1 REF: ANS: F PTS: 1 REF: ANS: F PTS: 1 REF: ANS: T PTS: 1 REF: ANS: T PTS: 1 REF: ANS: T PTS: 1 REF: ANS: F PTS: 1 REF: ANS: F PTS: 1 REF: ANS: T PTS: 1 REF: ANS: F PTS: 1 REF: ANS: F PTS: 1 REF: ANS: T PTS: 1 REF: ANS: F PTS: 1 REF: ANS: F PTS: 1 REF: ANS: F PTS: 1 REF: 138 1

10 41. ANS: T PTS: 1 REF: ANS: F PTS: 1 REF: ANS: T PTS: 1 REF: ANS: T PTS: 1 REF: ANS: T PTS: 1 REF: ANS: F PTS: 1 REF: ANS: T PTS: 1 REF: ANS: F PTS: 1 REF: ANS: T PTS: 1 REF: ANS: T PTS: 1 REF: 173 MULTIPLE CHOICE 1. ANS: B PTS: 1 REF: 3 2. ANS: C PTS: 1 REF: 4 3. ANS: D PTS: 1 REF: 4 4. ANS: B PTS: 1 REF: 5 5. ANS: D PTS: 1 REF: ANS: B PTS: 1 REF: 8 7. ANS: C PTS: 1 REF: 9 8. ANS: B PTS: 1 REF: 9 9. ANS: B PTS: 1 REF: ANS: C PTS: 1 REF: ANS: D PTS: 1 REF: ANS: A PTS: 1 REF: ANS: C PTS: 1 REF: ANS: D PTS: 1 REF: ANS: A PTS: 1 REF: ANS: A PTS: 1 REF: ANS: A PTS: 1 REF: ANS: A PTS: 1 REF: ANS: C PTS: 1 REF: ANS: B PTS: 1 REF: ANS: D PTS: 1 REF: ANS: D PTS: 1 REF: ANS: C PTS: 1 REF: ANS: C PTS: 1 REF: ANS: D PTS: 1 REF: ANS: A PTS: 1 REF: ANS: D PTS: 1 REF: ANS: B PTS: 1 REF: ANS: C PTS: 1 REF: ANS: A PTS: 1 REF: ANS: B PTS: 1 REF: ANS: A PTS: 1 REF: 118 2

11 33. ANS: C PTS: 1 REF: ANS: B PTS: 1 REF: ANS: B PTS: 1 REF: ANS: D PTS: 1 REF: ANS: C PTS: 1 REF: ANS: B PTS: 1 REF: ANS: A PTS: 1 REF: ANS: B PTS: 1 REF: ANS: D PTS: 1 REF: ANS: D PTS: 1 REF: ANS: A PTS: 1 REF: ANS: C PTS: 1 REF: ANS: D PTS: 1 REF: ANS: B PTS: 1 REF: ANS: D PTS: 1 REF: ANS: A PTS: 1 REF: ANS: D PTS: 1 REF: ANS: D PTS: 1 REF: 171 3

Simple C++ Programs. Engineering Problem Solving with C++, Etter/Ingber. Dev-C++ Dev-C++ Windows Friendly Exit. The C++ Programming Language

Simple C++ Programs. Engineering Problem Solving with C++, Etter/Ingber. Dev-C++ Dev-C++ Windows Friendly Exit. The C++ Programming Language Simple C++ Programs Engineering Problem Solving with C++, Etter/Ingber Chapter 2 Simple C++ Programs Program Structure Constants and Variables C++ Operators Standard Input and Output Basic Functions from

More information

Chapter One Introduction to Programming

Chapter One Introduction to Programming Chapter One Introduction to Programming 1-1 Algorithm and Flowchart Algorithm is a step-by-step procedure for calculation. More precisely, algorithm is an effective method expressed as a finite list of

More information

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C Embedded Systems A Review of ANSI C and Considerations for Embedded C Programming Dr. Jeff Jackson Lecture 2-1 Review of ANSI C Topics Basic features of C C fundamentals Basic data types Expressions Selection

More information

Chapter 2: Elements of Java

Chapter 2: Elements of Java Chapter 2: Elements of Java Basic components of a Java program Primitive data types Arithmetic expressions Type casting. The String type (introduction) Basic I/O statements Importing packages. 1 Introduction

More information

Sources: On the Web: Slides will be available on:

Sources: On the Web: Slides will be available on: C programming Introduction The basics of algorithms Structure of a C code, compilation step Constant, variable type, variable scope Expression and operators: assignment, arithmetic operators, comparison,

More information

Chapter 5. Selection 5-1

Chapter 5. Selection 5-1 Chapter 5 Selection 5-1 Selection (Decision) The second control logic structure is selection: Selection Choosing between two or more alternative actions. Selection statements alter the sequential flow

More information

Bachelors of Computer Application Programming Principle & Algorithm (BCA-S102T)

Bachelors of Computer Application Programming Principle & Algorithm (BCA-S102T) Unit- I Introduction to c Language: C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating

More information

C++ Language Tutorial

C++ Language Tutorial cplusplus.com C++ Language Tutorial Written by: Juan Soulié Last revision: June, 2007 Available online at: http://www.cplusplus.com/doc/tutorial/ The online version is constantly revised and may contain

More information

VB.NET Programming Fundamentals

VB.NET Programming Fundamentals Chapter 3 Objectives Programming Fundamentals In this chapter, you will: Learn about the programming language Write a module definition Use variables and data types Compute with Write decision-making statements

More information

Lecture 2 Notes: Flow of Control

Lecture 2 Notes: Flow of Control 6.096 Introduction to C++ January, 2011 Massachusetts Institute of Technology John Marrero Lecture 2 Notes: Flow of Control 1 Motivation Normally, a program executes statements from first to last. The

More information

JavaScript: Control Statements I

JavaScript: Control Statements I 1 7 JavaScript: Control Statements I 7.1 Introduction 2 The techniques you will learn here are applicable to most high-level languages, including JavaScript 1 7.2 Algorithms 3 Any computable problem can

More information

Introduction to Java Applications. 2005 Pearson Education, Inc. All rights reserved.

Introduction to Java Applications. 2005 Pearson Education, Inc. All rights reserved. 1 2 Introduction to Java Applications 2.2 First Program in Java: Printing a Line of Text 2 Application Executes when you use the java command to launch the Java Virtual Machine (JVM) Sample program Displays

More information

Introduction to Python

Introduction to Python Caltech/LEAD Summer 2012 Computer Science Lecture 2: July 10, 2012 Introduction to Python The Python shell Outline Python as a calculator Arithmetic expressions Operator precedence Variables and assignment

More information

Chapter 8 Selection 8-1

Chapter 8 Selection 8-1 Chapter 8 Selection 8-1 Selection (Decision) The second control logic structure is selection: Selection Choosing between two or more alternative actions. Selection statements alter the sequential flow

More information

PL / SQL Basics. Chapter 3

PL / SQL Basics. Chapter 3 PL / SQL Basics Chapter 3 PL / SQL Basics PL / SQL block Lexical units Variable declarations PL / SQL types Expressions and operators PL / SQL control structures PL / SQL style guide 2 PL / SQL Block Basic

More information

Informatica e Sistemi in Tempo Reale

Informatica e Sistemi in Tempo Reale Informatica e Sistemi in Tempo Reale Introduction to C programming Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 25, 2010 G. Lipari (Scuola Superiore Sant Anna)

More information

PART-A Questions. 2. How does an enumerated statement differ from a typedef statement?

PART-A Questions. 2. How does an enumerated statement differ from a typedef statement? 1. Distinguish & and && operators. PART-A Questions 2. How does an enumerated statement differ from a typedef statement? 3. What are the various members of a class? 4. Who can access the protected members

More information

Moving from CS 61A Scheme to CS 61B Java

Moving from CS 61A Scheme to CS 61B Java Moving from CS 61A Scheme to CS 61B Java Introduction Java is an object-oriented language. This document describes some of the differences between object-oriented programming in Scheme (which we hope you

More information

Moving from C++ to VBA

Moving from C++ to VBA Introduction College of Engineering and Computer Science Mechanical Engineering Department Mechanical Engineering 309 Numerical Analysis of Engineering Systems Fall 2014 Number: 15237 Instructor: Larry

More information

PROBLEM SOLVING SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON

PROBLEM SOLVING SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON PROBLEM SOLVING WITH SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON Addison Wesley Boston San Francisco New York London

More information

Object Oriented Software Design

Object Oriented Software Design Object Oriented Software Design Introduction to Java - II Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa September 14, 2011 G. Lipari (Scuola Superiore Sant Anna) Introduction

More information

9 Control Statements. 9.1 Introduction. 9.2 Objectives. 9.3 Statements

9 Control Statements. 9.1 Introduction. 9.2 Objectives. 9.3 Statements 9 Control Statements 9.1 Introduction The normal flow of execution in a high level language is sequential, i.e., each statement is executed in the order of its appearance in the program. However, depending

More information

13 Classes & Objects with Constructors/Destructors

13 Classes & Objects with Constructors/Destructors 13 Classes & Objects with Constructors/Destructors 13.1 Introduction In object oriented programming, the emphasis is on data rather than function. Class is a way that binds the data & function together.

More information

Creating Basic Excel Formulas

Creating Basic Excel Formulas Creating Basic Excel Formulas Formulas are equations that perform calculations on values in your worksheet. Depending on how you build a formula in Excel will determine if the answer to your formula automatically

More information

6. Control Structures

6. Control Structures - 35 - Control Structures: 6. Control Structures A program is usually not limited to a linear sequence of instructions. During its process it may bifurcate, repeat code or take decisions. For that purpose,

More information

JavaScript: Introduction to Scripting. 2008 Pearson Education, Inc. All rights reserved.

JavaScript: Introduction to Scripting. 2008 Pearson Education, Inc. All rights reserved. 1 6 JavaScript: Introduction to Scripting 2 Comment is free, but facts are sacred. C. P. Scott The creditor hath a better memory than the debtor. James Howell When faced with a decision, I always ask,

More information

Conditions & Boolean Expressions

Conditions & Boolean Expressions Conditions & Boolean Expressions 1 In C++, in order to ask a question, a program makes an assertion which is evaluated to either true (nonzero) or false (zero) by the computer at run time. Example: In

More information

Appendix K Introduction to Microsoft Visual C++ 6.0

Appendix K Introduction to Microsoft Visual C++ 6.0 Appendix K Introduction to Microsoft Visual C++ 6.0 This appendix serves as a quick reference for performing the following operations using the Microsoft Visual C++ integrated development environment (IDE):

More information

Pemrograman Dasar. Basic Elements Of Java

Pemrograman Dasar. Basic Elements Of Java Pemrograman Dasar Basic Elements Of Java Compiling and Running a Java Application 2 Portable Java Application 3 Java Platform Platform: hardware or software environment in which a program runs. Oracle

More information

What is a Loop? Pretest Loops in C++ Types of Loop Testing. Count-controlled loops. Loops can be...

What is a Loop? Pretest Loops in C++ Types of Loop Testing. Count-controlled loops. Loops can be... What is a Loop? CSC Intermediate Programming Looping A loop is a repetition control structure It causes a single statement or a group of statements to be executed repeatedly It uses a condition to control

More information

Keywords are identifiers having predefined meanings in C programming language. The list of keywords used in standard C are : unsigned void

Keywords are identifiers having predefined meanings in C programming language. The list of keywords used in standard C are : unsigned void 1. Explain C tokens Tokens are basic building blocks of a C program. A token is the smallest element of a C program that is meaningful to the compiler. The C compiler recognizes the following kinds of

More information

PROGRAMMING IN C PROGRAMMING IN C CONTENT AT A GLANCE

PROGRAMMING IN C PROGRAMMING IN C CONTENT AT A GLANCE PROGRAMMING IN C CONTENT AT A GLANCE 1 MODULE 1 Unit 1 : Basics of Programming Unit 2 : Fundamentals Unit 3 : C Operators MODULE 2 unit 1 : Input Output Statements unit 2 : Control Structures unit 3 :

More information

Topics. Parts of a Java Program. Topics (2) CS 146. Introduction To Computers And Java Chapter Objectives To understand:

Topics. Parts of a Java Program. Topics (2) CS 146. Introduction To Computers And Java Chapter Objectives To understand: Introduction to Programming and Algorithms Module 2 CS 146 Sam Houston State University Dr. Tim McGuire Introduction To Computers And Java Chapter Objectives To understand: the meaning and placement of

More information

C++ Programming: From Problem Analysis to Program Design, Fifth Edition. Chapter 3: Input/Output

C++ Programming: From Problem Analysis to Program Design, Fifth Edition. Chapter 3: Input/Output C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 3: Input/Output Objectives In this chapter, you will: Learn what a stream is and examine input and output streams Explore

More information

Operator Overloading. Lecture 8. Operator Overloading. Running Example: Complex Numbers. Syntax. What can be overloaded. Syntax -- First Example

Operator Overloading. Lecture 8. Operator Overloading. Running Example: Complex Numbers. Syntax. What can be overloaded. Syntax -- First Example Operator Overloading Lecture 8 Operator Overloading C++ feature that allows implementer-defined classes to specify class-specific function for operators Benefits allows classes to provide natural semantics

More information

MATLAB Programming. Problem 1: Sequential

MATLAB Programming. Problem 1: Sequential Division of Engineering Fundamentals, Copyright 1999 by J.C. Malzahn Kampe 1 / 21 MATLAB Programming When we use the phrase computer solution, it should be understood that a computer will only follow directions;

More information

PROG0101 Fundamentals of Programming PROG0101 FUNDAMENTALS OF PROGRAMMING. Chapter 3 Algorithms

PROG0101 Fundamentals of Programming PROG0101 FUNDAMENTALS OF PROGRAMMING. Chapter 3 Algorithms PROG0101 FUNDAMENTALS OF PROGRAMMING Chapter 3 1 Introduction to A sequence of instructions. A procedure or formula for solving a problem. It was created mathematician, Mohammed ibn-musa al-khwarizmi.

More information

Programming in Java. 2013 Course Technology, a part of Cengage Learning.

Programming in Java. 2013 Course Technology, a part of Cengage Learning. C7934_chapter_java.qxd 12/20/11 12:31 PM Page 1 Programming in Java Online module to accompany Invitation to Computer Science, 6th Edition ISBN-10: 1133190820; ISBN-13: 9781133190820 (Cengage Learning,

More information

Introduction to Programming (in C++) Loops. Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. of Computer Science, UPC

Introduction to Programming (in C++) Loops. Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. of Computer Science, UPC Introduction to Programming (in C++) Loops Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. of Computer Science, UPC Example Assume the following specification: Input: read a number N > 0 Output:

More information

Example. Introduction to Programming (in C++) Loops. The while statement. Write the numbers 1 N. Assume the following specification:

Example. Introduction to Programming (in C++) Loops. The while statement. Write the numbers 1 N. Assume the following specification: Example Introduction to Programming (in C++) Loops Assume the following specification: Input: read a number N > 0 Output: write the sequence 1 2 3 N (one number per line) Jordi Cortadella, Ricard Gavaldà,

More information

Sequential Program Execution

Sequential Program Execution Sequential Program Execution Quick Start Compile step once always g++ -o Realtor1 Realtor1.cpp mkdir labs cd labs Execute step mkdir 1 Realtor1 cd 1 cp../0/realtor.cpp Realtor1.cpp Submit step cp /samples/csc/155/labs/1/*.

More information

The C Programming Language course syllabus associate level

The C Programming Language course syllabus associate level TECHNOLOGIES The C Programming Language course syllabus associate level Course description The course fully covers the basics of programming in the C programming language and demonstrates fundamental programming

More information

Objective-C Tutorial

Objective-C Tutorial Objective-C Tutorial OBJECTIVE-C TUTORIAL Simply Easy Learning by tutorialspoint.com tutorialspoint.com i ABOUT THE TUTORIAL Objective-c tutorial Objective-C is a general-purpose, object-oriented programming

More information

Perl in a nutshell. First CGI Script and Perl. Creating a Link to a Script. print Function. Parsing Data 4/27/2009. First CGI Script and Perl

Perl in a nutshell. First CGI Script and Perl. Creating a Link to a Script. print Function. Parsing Data 4/27/2009. First CGI Script and Perl First CGI Script and Perl Perl in a nutshell Prof. Rasley shebang line tells the operating system where the Perl interpreter is located necessary on UNIX comment line ignored by the Perl interpreter End

More information

ASSEMBLY LANGUAGE PROGRAMMING (6800) (R. Horvath, Introduction to Microprocessors, Chapter 6)

ASSEMBLY LANGUAGE PROGRAMMING (6800) (R. Horvath, Introduction to Microprocessors, Chapter 6) ASSEMBLY LANGUAGE PROGRAMMING (6800) (R. Horvath, Introduction to Microprocessors, Chapter 6) 1 COMPUTER LANGUAGES In order for a computer to be able to execute a program, the program must first be present

More information

Excel: Introduction to Formulas

Excel: Introduction to Formulas Excel: Introduction to Formulas Table of Contents Formulas Arithmetic & Comparison Operators... 2 Text Concatenation... 2 Operator Precedence... 2 UPPER, LOWER, PROPER and TRIM... 3 & (Ampersand)... 4

More information

Boolean Expressions, Conditions, Loops, and Enumerations. Precedence Rules (from highest to lowest priority)

Boolean Expressions, Conditions, Loops, and Enumerations. Precedence Rules (from highest to lowest priority) Boolean Expressions, Conditions, Loops, and Enumerations Relational Operators == // true if two values are equivalent!= // true if two values are not equivalent < // true if left value is less than the

More information

First Java Programs. V. Paúl Pauca. CSC 111D Fall, 2015. Department of Computer Science Wake Forest University. Introduction to Computer Science

First Java Programs. V. Paúl Pauca. CSC 111D Fall, 2015. Department of Computer Science Wake Forest University. Introduction to Computer Science First Java Programs V. Paúl Pauca Department of Computer Science Wake Forest University CSC 111D Fall, 2015 Hello World revisited / 8/23/15 The f i r s t o b l i g a t o r y Java program @author Paul Pauca

More information

Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner.

Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner. Handout 1 CS603 Object-Oriented Programming Fall 15 Page 1 of 11 Handout 1 Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner. Java

More information

Storage Classes CS 110B - Rule Storage Classes Page 18-1 \handouts\storclas

Storage Classes CS 110B - Rule Storage Classes Page 18-1 \handouts\storclas CS 110B - Rule Storage Classes Page 18-1 Attributes are distinctive features of a variable. Data type, int or double for example, is an attribute. Storage class is another attribute. There are four storage

More information

El Dorado Union High School District Educational Services

El Dorado Union High School District Educational Services El Dorado Union High School District Course of Study Information Page Course Title: ACE Computer Programming II (#495) Rationale: A continuum of courses, including advanced classes in technology is needed.

More information

QUIZ-II QUIZ-II. Chapter 5: Control Structures II (Repetition) Objectives. Objectives (cont d.) 20/11/2015. EEE 117 Computer Programming Fall-2015 1

QUIZ-II QUIZ-II. Chapter 5: Control Structures II (Repetition) Objectives. Objectives (cont d.) 20/11/2015. EEE 117 Computer Programming Fall-2015 1 QUIZ-II Write a program that mimics a calculator. The program should take as input two integers and the operation to be performed. It should then output the numbers, the operator, and the result. (For

More information

Object Oriented Software Design

Object Oriented Software Design Object Oriented Software Design Introduction to Java - II Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 28, 2010 G. Lipari (Scuola Superiore Sant Anna) Introduction

More information

Introduction to Visual C++.NET Programming. Using.NET Environment

Introduction to Visual C++.NET Programming. Using.NET Environment ECE 114-2 Introduction to Visual C++.NET Programming Dr. Z. Aliyazicioglu Cal Poly Pomona Electrical & Computer Engineering Cal Poly Pomona Electrical & Computer Engineering 1 Using.NET Environment Start

More information

Exercise 4 Learning Python language fundamentals

Exercise 4 Learning Python language fundamentals Exercise 4 Learning Python language fundamentals Work with numbers Python can be used as a powerful calculator. Practicing math calculations in Python will help you not only perform these tasks, but also

More information

Keil C51 Cross Compiler

Keil C51 Cross Compiler Keil C51 Cross Compiler ANSI C Compiler Generates fast compact code for the 8051 and it s derivatives Advantages of C over Assembler Do not need to know the microcontroller instruction set Register allocation

More information

We will learn the Python programming language. Why? Because it is easy to learn and many people write programs in Python so we can share.

We will learn the Python programming language. Why? Because it is easy to learn and many people write programs in Python so we can share. LING115 Lecture Note Session #4 Python (1) 1. Introduction As we have seen in previous sessions, we can use Linux shell commands to do simple text processing. We now know, for example, how to count words.

More information

Computer Programming C++ Classes and Objects 15 th Lecture

Computer Programming C++ Classes and Objects 15 th Lecture Computer Programming C++ Classes and Objects 15 th Lecture 엄현상 (Eom, Hyeonsang) School of Computer Science and Engineering Seoul National University Copyrights 2013 Eom, Hyeonsang All Rights Reserved Outline

More information

Retrieving Data Using the SQL SELECT Statement. Copyright 2006, Oracle. All rights reserved.

Retrieving Data Using the SQL SELECT Statement. Copyright 2006, Oracle. All rights reserved. Retrieving Data Using the SQL SELECT Statement Objectives After completing this lesson, you should be able to do the following: List the capabilities of SQL SELECT statements Execute a basic SELECT statement

More information

Introduction to Java

Introduction to Java Introduction to Java The HelloWorld program Primitive data types Assignment and arithmetic operations User input Conditional statements Looping Arrays CSA0011 Matthew Xuereb 2008 1 Java Overview A high

More information

Java Basics: Data Types, Variables, and Loops

Java Basics: Data Types, Variables, and Loops Java Basics: Data Types, Variables, and Loops If debugging is the process of removing software bugs, then programming must be the process of putting them in. - Edsger Dijkstra Plan for the Day Variables

More information

IS0020 Program Design and Software Tools Midterm, Feb 24, 2004. Instruction

IS0020 Program Design and Software Tools Midterm, Feb 24, 2004. Instruction IS0020 Program Design and Software Tools Midterm, Feb 24, 2004 Name: Instruction There are two parts in this test. The first part contains 50 questions worth 80 points. The second part constitutes 20 points

More information

Boolean Expressions 1. In C++, the number 0 (zero) is considered to be false, all other numbers are true.

Boolean Expressions 1. In C++, the number 0 (zero) is considered to be false, all other numbers are true. Boolean Expressions Boolean Expressions Sometimes a programmer would like one statement, or group of statements to execute only if certain conditions are true. There may be a different statement, or group

More information

Example of a Java program

Example of a Java program Example of a Java program class SomeNumbers static int square (int x) return x*x; public static void main (String[] args) int n=20; if (args.length > 0) // change default n = Integer.parseInt(args[0]);

More information

Basics of I/O Streams and File I/O

Basics of I/O Streams and File I/O Basics of This is like a cheat sheet for file I/O in C++. It summarizes the steps you must take to do basic I/O to and from files, with only a tiny bit of explanation. It is not a replacement for reading

More information

Chapter 5 Functions. Introducing Functions

Chapter 5 Functions. Introducing Functions Chapter 5 Functions 1 Introducing Functions A function is a collection of statements that are grouped together to perform an operation Define a function Invoke a funciton return value type method name

More information

Chapter 13: Program Development and Programming Languages

Chapter 13: Program Development and Programming Languages Understanding Computers Today and Tomorrow 12 th Edition Chapter 13: Program Development and Programming Languages Learning Objectives Understand the differences between structured programming, object-oriented

More information

Selection Statements

Selection Statements Chapter 5 Selection Statements 1 Statements So far, we ve used return statements and expression ess statements. e ts. Most of C s remaining statements fall into three categories: Selection statements:

More information

Phys4051: C Lecture 2 & 3. Comment Statements. C Data Types. Functions (Review) Comment Statements Variables & Operators Branching Instructions

Phys4051: C Lecture 2 & 3. Comment Statements. C Data Types. Functions (Review) Comment Statements Variables & Operators Branching Instructions Phys4051: C Lecture 2 & 3 Functions (Review) Comment Statements Variables & Operators Branching Instructions Comment Statements! Method 1: /* */! Method 2: // /* Single Line */ //Single Line /* This comment

More information

I PUC - Computer Science. Practical s Syllabus. Contents

I PUC - Computer Science. Practical s Syllabus. Contents I PUC - Computer Science Practical s Syllabus Contents Topics 1 Overview Of a Computer 1.1 Introduction 1.2 Functional Components of a computer (Working of each unit) 1.3 Evolution Of Computers 1.4 Generations

More information

Variables, Constants, and Data Types

Variables, Constants, and Data Types Variables, Constants, and Data Types Primitive Data Types Variables, Initialization, and Assignment Constants Characters Strings Reading for this class: L&L, 2.1-2.3, App C 1 Primitive Data There are eight

More information

Chapter 5 Names, Bindings, Type Checking, and Scopes

Chapter 5 Names, Bindings, Type Checking, and Scopes Chapter 5 Names, Bindings, Type Checking, and Scopes Chapter 5 Topics Introduction Names Variables The Concept of Binding Type Checking Strong Typing Scope Scope and Lifetime Referencing Environments Named

More information

About The Tutorial. Audience. Prerequisites. Copyright & Disclaimer

About The Tutorial. Audience. Prerequisites. Copyright & Disclaimer About The Tutorial C is a general-purpose, procedural, imperative computer programming language developed in 1972 by Dennis M. Ritchie at the Bell Telephone Laboratories to develop the UNIX operating system.

More information

LC-3 Assembly Language

LC-3 Assembly Language LC-3 Assembly Language Programming and tips Textbook Chapter 7 CMPE12 Summer 2008 Assembly and Assembler Machine language - binary Assembly language - symbolic 0001110010000110 An assembler is a program

More information

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

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. Exam Name MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. 1) The JDK command to compile a class in the file Test.java is A) java Test.java B) java

More information

C++ INTERVIEW QUESTIONS

C++ INTERVIEW QUESTIONS C++ INTERVIEW QUESTIONS http://www.tutorialspoint.com/cplusplus/cpp_interview_questions.htm Copyright tutorialspoint.com Dear readers, these C++ Interview Questions have been designed specially to get

More information

Chapter 12 Programming Concepts and Languages

Chapter 12 Programming Concepts and Languages Chapter 12 Programming Concepts and Languages Chapter 12 Programming Concepts and Languages Paradigm Publishing, Inc. 12-1 Presentation Overview Programming Concepts Problem-Solving Techniques The Evolution

More information

Numeral Systems. The number twenty-five can be represented in many ways: Decimal system (base 10): 25 Roman numerals:

Numeral Systems. The number twenty-five can be represented in many ways: Decimal system (base 10): 25 Roman numerals: Numeral Systems Which number is larger? 25 8 We need to distinguish between numbers and the symbols that represent them, called numerals. The number 25 is larger than 8, but the numeral 8 above is larger

More information

JAVA - QUICK GUIDE. Java SE is freely available from the link Download Java. So you download a version based on your operating system.

JAVA - QUICK GUIDE. Java SE is freely available from the link Download Java. So you download a version based on your operating system. http://www.tutorialspoint.com/java/java_quick_guide.htm JAVA - QUICK GUIDE Copyright tutorialspoint.com What is Java? Java is: Object Oriented Platform independent: Simple Secure Architectural- neutral

More information

Chapter 2 Elementary Programming

Chapter 2 Elementary Programming Chapter 2 Elementary Programming 2.1 Introduction You will learn elementary programming using Java primitive data types and related subjects, such as variables, constants, operators, expressions, and input

More information

Curriculum Map. Discipline: Computer Science Course: C++

Curriculum Map. Discipline: Computer Science Course: C++ Curriculum Map Discipline: Computer Science Course: C++ August/September: How can computer programs make problem solving easier and more efficient? In what order does a computer execute the lines of code

More information

Storing Measurement Data

Storing Measurement Data Storing Measurement Data File I/O records or reads data in a file. A typical file I/O operation involves the following process. 1. Create or open a file. Indicate where an existing file resides or where

More information

Compiler Construction

Compiler Construction Compiler Construction Lecture 1 - An Overview 2003 Robert M. Siegfried All rights reserved A few basic definitions Translate - v, a.to turn into one s own language or another. b. to transform or turn from

More information

Java Crash Course Part I

Java Crash Course Part I Java Crash Course Part I School of Business and Economics Institute of Information Systems HU-Berlin WS 2005 Sebastian Kolbe skolbe@wiwi.hu-berlin.de Overview (Short) introduction to the environment Linux

More information

Lecture 1 Introduction to Java

Lecture 1 Introduction to Java Programming Languages: Java Lecture 1 Introduction to Java Instructor: Omer Boyaci 1 2 Course Information History of Java Introduction First Program in Java: Printing a Line of Text Modifying Our First

More information

SOME EXCEL FORMULAS AND FUNCTIONS

SOME EXCEL FORMULAS AND FUNCTIONS SOME EXCEL FORMULAS AND FUNCTIONS About calculation operators Operators specify the type of calculation that you want to perform on the elements of a formula. Microsoft Excel includes four different types

More information

Member Functions of the istream Class

Member Functions of the istream Class Member Functions of the istream Class The extraction operator is of limited use because it always uses whitespace to delimit its reads of the input stream. It cannot be used to read those whitespace characters,

More information

Common Beginner C++ Programming Mistakes

Common Beginner C++ Programming Mistakes Common Beginner C++ Programming Mistakes This documents some common C++ mistakes that beginning programmers make. These errors are two types: Syntax errors these are detected at compile time and you won't

More information

PIC 10A. Lecture 7: Graphics II and intro to the if statement

PIC 10A. Lecture 7: Graphics II and intro to the if statement PIC 10A Lecture 7: Graphics II and intro to the if statement Setting up a coordinate system By default the viewing window has a coordinate system already set up for you 10-10 10-10 The origin is in the

More information

C PROGRAMMING FOR MATHEMATICAL COMPUTING

C PROGRAMMING FOR MATHEMATICAL COMPUTING UNIVERSITY OF CALICUT SCHOOL OF DISTANCE EDUCATION BSc MATHEMATICS (2011 Admission Onwards) VI Semester Elective Course C PROGRAMMING FOR MATHEMATICAL COMPUTING QUESTION BANK Multiple Choice Questions

More information

Chapter 13 Storage classes

Chapter 13 Storage classes Chapter 13 Storage classes 1. Storage classes 2. Storage Class auto 3. Storage Class extern 4. Storage Class static 5. Storage Class register 6. Global and Local Variables 7. Nested Blocks with the Same

More information

6.170 Tutorial 3 - Ruby Basics

6.170 Tutorial 3 - Ruby Basics 6.170 Tutorial 3 - Ruby Basics Prerequisites 1. Have Ruby installed on your computer a. If you use Mac/Linux, Ruby should already be preinstalled on your machine. b. If you have a Windows Machine, you

More information

ExamView Dynamic Questions Training Guide for PC and Mac Users

ExamView Dynamic Questions Training Guide for PC and Mac Users ExamView Dynamic Questions Training Guide for PC and Mac Users Introduction to Building Dynamic Content1 2 Introduction to Building Dynamic Content ExamView Level 1 Training Guide Contact Information In

More information

Outline. Conditional Statements. Logical Data in C. Logical Expressions. Relational Examples. Relational Operators

Outline. Conditional Statements. Logical Data in C. Logical Expressions. Relational Examples. Relational Operators Conditional Statements For computer to make decisions, must be able to test CONDITIONS IF it is raining THEN I will not go outside IF Count is not zero THEN the Average is Sum divided by Count Conditions

More information

Syllabus OBJECT ORIENTED PROGRAMMING C++

Syllabus OBJECT ORIENTED PROGRAMMING C++ 1 Syllabus OBJECT ORIENTED PROGRAMMING C++ 1. Introduction : What is object oriented programming? Why do we need objectoriented. Programming characteristics of object-oriented languages. C and C++. 2.

More information

5 Arrays and Pointers

5 Arrays and Pointers 5 Arrays and Pointers 5.1 One-dimensional arrays Arrays offer a convenient way to store and access blocks of data. Think of arrays as a sequential list that offers indexed access. For example, a list of

More information

Excel Level Two. Introduction. Contents. Exploring Formulas. Entering Formulas

Excel Level Two. Introduction. Contents. Exploring Formulas. Entering Formulas Introduction Excel Level Two This workshop introduces you to formulas, functions, moving and copying data, using autofill, relative and absolute references, and formatting cells. Contents Introduction

More information