Programming I Final Exam 2010-2011 - Review. Question..True or False (Please click on the answer...) Variables hold data that may change while the program.

Slides:



Advertisements
Similar presentations
© 2007 Lawrenceville Press Slide 1 Assignment Statement An assignment statement gives a value to a variable. Assignment can take several forms: x = 5;
Advertisements

L2:CSC © Dr. Basheer M. Nasef Lecture #2 By Dr. Basheer M. Nasef.
Slide 1 Chapter 4 Assignment Statement An assignment statement gives a value to a variable. Assignment can take several forms: x = 5; a literal (5) is.
Lecture 2 Introduction to C Programming
Introduction to C Programming
Data Types in Java Data is the information that a program has to work with. Data is of different types. The type of a piece of data tells Java what can.
 2007 Pearson Education, Inc. All rights reserved Introduction to C Programming.
Data types and variables
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Adrian Ilie COMP 14 Introduction to Programming Adrian Ilie June 27, 2005.
Chapter 2 Data Types, Declarations, and Displays
JavaScript, Third Edition
C++ for Engineers and Scientists Third Edition
Introduction to C Programming
CSci 142 Data and Expressions. 2  Topics  Strings  Primitive data types  Using variables and constants  Expressions and operator precedence  Data.
Admin Office hours 2:45-3:15 today due to department meeting if you change addresses during the semester, please unsubscribe the old one from the.
Introduction To C++ Programming 1.0 Basic C++ Program Structure 2.0 Program Control 3.0 Array And Structures 4.0 Function 5.0 Pointer 6.0 Secure Programming.
1 Chapter Two Using Data. 2 Objectives Learn about variable types and how to declare variables Learn how to display variable values Learn about the integral.
Objectives You should be able to describe: Data Types
CPS120: Introduction to Computer Science Lecture 8.
Java Primitives The Smallest Building Blocks of the Language (corresponds with Chapter 2)
Copyright 2006 Addison-Wesley Brief Version of Starting Out with C++ Chapter 2 Introduction to C++
Chapter 2: Basic Elements of Java J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program Design, Second Edition.
2440: 211 Interactive Web Programming Expressions & Operators.
Chapter 2 Basic Elements of Java. Chapter Objectives Become familiar with the basic components of a Java program, including methods, special symbols,
1 Do you have a CS account? Primitive types –“ building blocks ” for more complicated types Java is strongly typed –All variables in a Java program must.
CPS120: Introduction to Computer Science Variables and Constants Lecture 8 - B.
Chapter 4 Variables and Constants. Goals and Objectives 1. Understand simple data types (int, boolean, double). 2. Declare and initialize variables using.
1 Chapter 4: Selection Structures. In this chapter, you will learn about: – Selection criteria – The if-else statement – Nested if statements – The switch.
Program A computer program (also software, or just a program) is a sequence of instructions written in a sequence to perform a specified task with a computer.
Introduction to Java Applications Part II. In this chapter you will learn:  Different data types( Primitive data types).  How to declare variables?
Chapter 2: Using Data.
CPS120: Introduction to Computer Science
Week 1 Algorithmization and Programming Languages.
C++ Programming: Basic Elements of C++.
Java Programming: From Problem Analysis to Program Design, 4e Chapter 2 Basic Elements of Java.
CPS120: Introduction to Computer Science Operations Lecture 9.
PHY-102 SAPVariables and OperatorsSlide 1 Variables and Operators In this section we will learn how about variables in Java and basic operations one can.
Chapter 2 Variables.
1 Week 5 l Primitive Data types l Assignment l Expressions l Documentation & Style Primitive Types, Assignments, and Expressions.
CHAPTER 2 PROBLEM SOLVING USING C++ 1 C++ Programming PEG200/Saidatul Rahah.
C++ for Engineers and Scientists Second Edition
Tokens in C  Keywords  These are reserved words of the C language. For example int, float, if, else, for, while etc.  Identifiers  An Identifier is.
Java Programming: From Problem Analysis to Program Design, Second Edition 1 Lecture 1 Objectives  Become familiar with the basic components of a Java.
1 1 Chapter 2 Elementary Programming. 2 2 Motivations In the preceding chapter, you learned how to create, compile, and run a Java program. Starting from.
1 2. Program Construction in Java. 01 Java basics.
Introduction to Algorithmic Processes CMPSC 201C Fall 2000.
Chapter 4.  Variables – named memory location that stores a value.  Variables allows the use of meaningful names which makes the code easier to read.
© 2006 Lawrenceville Press Slide 1 Chapter 4 Variables  A variable is a name for a value stored in memory.  Variables are created using a declaration.
Slide 1 Chapter 3 Variables  A variable is a name for a value stored in memory.  Variables are created using a declaration statement. For example: Dim.
Lecture 3: More Java Basics Michael Hsu CSULA. Recall From Lecture Two  Write a basic program in Java  The process of writing, compiling, and running.
What will each of the following lines print? System.out.println("number" ); number645 System.out.println("number" + (6 + 4)+ 5); number105 System.out.println(6.
Chapter 2 Variables and Constants. Objectives Explain the different integer variable types used in C++. Declare, name, and initialize variables. Use character.
A variable is a name for a value stored in memory.
Chapter 2 Variables.
Chapter 4 Assignment Statement
BASIC ELEMENTS OF A COMPUTER PROGRAM
2.5 Another Java Application: Adding Integers
Multiple variables can be created in one declaration
The Selection Structure
Chapter 3 Assignment Statement
Java Programming: From Problem Analysis to Program Design, 4e
2.1 Parts of a C++ Program.
Introduction to C++ Programming
Chapter 2 Variables.
elementary programming
Chapter 2: Introduction to C++.
Unit 3: Variables in Java
Chapter 2 Variables.
Introduction to C Programming
Variables and Constants
Presentation transcript:

Programming I Final Exam Review

Question..True or False (Please click on the answer...) Variables hold data that may change while the program is running. True False

Question..True or False (Please click on the answer...) Another term for integers is whole numbers. True False

Question..True or False (Please click on the answer...) Initializing a variable means assigning a value to it. True False

Question..True or False (Please click on the answer...) C++ keywords cannot be used as identifiers. True False

Question..True or False (Please click on the answer...) In C++ it is possible to declare more than one variable in one statement. True False

Question..True or False (Please click on the answer...) In C++ it is possible to declare more than one variable in one statement. True False

Question..True or False (Please click on the answer...) Boolean variables are those that can have only three possible values. True False

Question..True or False (Please click on the answer...) In C++ constants hold data that does not change as the program runs. True False

Question..True or False (Please click on the answer...) Constants do not have data types. True False

Question..True or False (Please click on the answer...) The modulus operator is the % sign. True False

Question..True or False (Please click on the answer...) Overflow occurs when a number is too small for a variable. True False

Question..True or False (Please click on the answer...) The * operator performs multiplication. True False

Question..True or False (Please click on the answer...) Floating-point precision can affect calculations. True False

Question..True or False (Please click on the answer...) The % operator returns the remainder of integer division. True False

Question..True or False (Please click on the answer...) The number 5.6e15 is an example of exponential notation. True False

Question..True or False (Please click on the answer...) A floating-point number would be truncated if it were converted to an integer. True False

Question..True or False (Please click on the answer...) Floating-point rounding errors can occur if you are not aware of the data types used in calculations. True False

Question..True or False (Please click on the answer...) Most algorithms follow a single path from beginning to end. True False

Question..True or False (Please click on the answer...) Programs sometimes have to make decisions based on the wishes of the user. True False

Question..True or False (Please click on the answer...) Logical operators allow an expression to evaluate more than one condition. True False

Question..True or False (Please click on the answer...) Structures that make decisions in C++ programs are called sequence structures. True False

Question..True or False (Please click on the answer...) The if/else structure is also called a two- way selection structure. True False

Question..True or False (Please click on the answer...) A statement block has to end with a semicolon after the right curly brace. True False

Question..True or False (Please click on the answer...) Programs sometimes have to make decisions based on the wishes of the user. True False

Question..True or False (Please click on the answer...) C++ identifiers can begin with a letter or number. True False

Question..Multiple Choice (Please click on the answer...) What is another term for integer? a.Whole number b.Fractional number c.Floating point number d.Character

Question..Multiple Choice (Please click on the answer...) Which of the following is a legal identifier? a.Number of cars b.4saleprice c.double d.number_of_cars

Question..Multiple Choice (Please click on the answer...) Boolean variables can have how many different values? a.1 b.2 c.3 d.4

Question..Multiple Choice (Please click on the answer...) Which of the following is the proper way to declare and initialize a constant? a.const double PI = ; b.double PI = ; c.const PI = ; d.PI = ;

Question..Multiple Choice (Please click on the answer...) When variables are first declared: a.They have a value of zero. b.They reveive the default value for their data type. c.They have an indeterminate value. d.They have a value of null.

Question..Multiple Choice (Please click on the answer...) Which of the following is true of naming variables? a.Variable names can have spaces b.Variable names can begin with numbers c.Variable names may contain an underscore d.Variable names may also be C++ keywords

Question..Multiple Choice (Please click on the answer...) Another name for exponential notation is: a.Long notation b.Unsigned notation c.Scientific notation d.Floating point notation

Question..Multiple Choice (Please click on the answer...) What must identifiers begin with? a.A number b.A letter c.An integer d.A space

Question..Multiple Choice (Please click on the answer...) A group of characters put together to form a word or phrase is called: a.A byte b.A message c.A string d.An ASCII stream

Question..Multiple Choice (Please click on the answer...) Which of the following statements is a valid way to initialize multiple variables to the same value of a single statement line? a.X, y, z = 200; b.X = y = z = 200; c.X; y; & z= 200; d.X & Y & Z = 200;

Question..Multiple Choice (Please click on the answer...) The highest precedence when evaluating an expression is a.Addition or subtraction b.Minus sign used to change sign c.Multiplication and division d.None of these

Question..Multiple Choice (Please click on the answer...) An overflow condition occurs when a.A value is too large for its data type b.A decimal value is stored into an integer field c.Too many variables are defined in one program d.An integer is divided by a floating-point number

Question..Multiple Choice (Please click on the answer...) If y=3 and z=5, the statement x = y + ++z; will return a value of _____. a.8 b.9 c.10 d.11

Question..Multiple Choice (Please click on the answer...) The symbol used in C++ for the modulus operator is the a.& b.* c.% d.$

Question..Multiple Choice (Please click on the answer...) A variable set to a Boolean value of false will contain a(n) ____ in memory. a.one b.zero c.F d.No

Question..Multiple Choice (Please click on the answer...) Which of the following statements does not use a relational operator? a.x = (4 > 5); b.x = (4 <= 5); c.x = (4 != 5); d.x = (4 = 5);

Question..Multiple Choice (Please click on the answer...) The symbol used for the not logical operator is a.& b.! c.- d.~

Question..Multiple Choice (Please click on the answer...) Decision-making structures in C++ are called ____ structures. a.sequence b.selection c.control d.branching

Question..Multiple Choice (Please click on the answer...) Which of the following shows the symbols that must surround a block of code for an if structure? a.[ ] b.( ) c.{ } d.: :

Question..Multiple Choice (Please click on the answer...) The ____ keyword can be used within a switch structure to execute specific code if no other conditions are matched. a.continue b.break c.if_other d.default

Question..Multiple Choice (Please click on the answer...) Which operator is used to represent "less than or equal to"? a.< b.>= c.<= d.=<

Question..Multiple Choice (Please click on the answer...) In the problem solving steps of software development, which step occurs after program documenting? a.Run the program. b.Test the results. c.Write code for the program. d. Algorithm development.

Question..Multiple Choice (Please click on the answer...) Name an issue that is not important during problem solving for a programming team. a.Writing style b.Technique c.Rewriting code d.Communication

Question..Multiple Choice (Please click on the answer...) What can a valid identifier not consist of? a.Forward slashes b.Underscore c.Letters d. Digits

Question..Multiple Choice (Please click on the answer...) Tell if the expression is double, int, or neither: a.double b.int c.neither

Question..Multiple Choice (Please click on the answer...) Tell if the expression is double, int, or neither: 5 / 3 a.double b.int c.neither

Question..Multiple Choice (Please click on the answer...) Which of the following statements would assign the value of 40 to the variable Test8? a.Test8 < = 40 b.Test8 = 40 c.40 = Test8 d.cin >> (Test8 = 40)

Question..Multiple Choice (Please click on the answer...) Which of the following expressions would assign the sum of A, B, and C to the variable D? a.D = A + B + C b.A + B + C = D c.D <= A + B + C d.sum (D = A + B + C)

Question..Multiple Choice (Please click on the answer...) Which is not a C++ data type? a.double b.constant c.int d.char

Question..Multiple Choice (Please click on the answer...) Which is not a relational operator? a.!! b.>= c.== d.>

Question..Multiple Choice (Please click on the answer...) Which of the following values can be assigned to a Boolean variable? a.15 b.T c.true d.tr

Question..Multiple Choice (Please click on the answer...) Given the statement: if (A > 70) || (A < 110).... which value of A would make this statement true? a.60 b.75 c.130 d.All of these.

Wrong Click on button to return to question slide.

Correct Click on button to return to question slide.