CMPE110, Sample questions

Size: px
Start display at page:

Download "CMPE110, Sample questions"

Transcription

1 CMPE110, Sample questions Number : Name :... Q1)Give the correct answer for following: 1. What is the value of x after the following statement? double x; x = 3.0 / / 4 a b c d ANSWER: 2. What is the correct way to write the condition y < x < z in C++ form? a. (y < x < z) b. ( (y < x) && z) c. ((y > x) (y < z)) d. ((y < x) && (x < z)) ANSWER: 3. What is the output of the following code fragment? int x=0; while( x < 5) cout << x << endl; x ++; cout << x << endl; a. 0 b. 5 c. 4 d. unable to determine ANSWER: 4. Given the following code fragment, which of the following expressions is always true? int x; cin >> x; a. if( x < 3) b. if( x==1) c. if( (x / 3) >1 ) d. if( x = 1) ANSWER:. 5. Which of the following will correctly assign all the values in one array to the other array? (Assume both arrays are of the same type and have SIZE elements) a. array1=array2; b. array1[]=array2; c. for(i=0;i<size;i++) array1[i]=array2[i]; d. for(i=0;i<size;i++) array1[]=array2[]; ANSWER:

2 6. What is wrong with the following switch statement? int ans; cout <<"Type y for yes on n for no\n"; cin >> ans; switch (ans) { case 'y': case 'Y': cout << "You said yes\n"; break; case 'n': case 'N': cout << "You said no\n"; break; default: cout <<"invalid answer\n"; a. ans is an int b. break; is illegal syntax c. nothing d. there are no break statements on 2 cases. ANSWER: 7. What is the value returned by the following function? int function() { int value = 35; return value + 5; value += 10; a. 35 b. 40 c. 50 d. 10 ANSWER: 8. What is the output of the following function call? //function body int f1(int n) { int p=1; while(n > 0) { P* = n; n--; return product; //function call cout << f1(4); a. 4 b. 0 c. 24 d. 48 ANSWER:

3 Q2) It is required to write a C++ code to multiply two complex numbers. Complete the following code to perform the specified tasks. Note that two complex numbers can be multiplied as (a+i b)x(c+i d)=(ac-bd)+i(ad+bc) A sample run of the code can be Enter the real and the imaginary parts of Object N1: 2 3 Enter the real and the imaginary parts of Object N2: 4 6 The value of the N3 object is i class Complex{public:double RePart, ImPart;; int main() {//Declare complex objects N1, N2, N3 of type Complex // Read the real and imaginary part members of N1 and N2 objects // Compute the real part member of object N3 // Compute the imaginary part member object N3 // Print the result of the multiplication as requested return 0;

4 Q3) Complete the following code to that will compute the volume and the surface area of a cylinder. The volume and the surface area are computed, respectively, as 2 volume r h and surface area 2 r h 2 r The function DisplayMessage should display the following messages: Enter 1 to compute the volume. Enter 2 to compute the surface area. void DisplayMessage(void); double Compute_Volume(double); double Compute_Surface_Area(double); int main() {int Choice; double Radius, Height, Volume, SurfaceArea; cout< Enter the radius and the height of the cylinder: ; cin>>radius>>height; //activate the function Display message cin>>choice; if (choice = = 1) {//activate Compute_Volume function to compute the volume cout< The volume = << Volume; else if (choice = = 2) {//activate Compute_Surface_Area function to compute the surface area cout< The surface area = << SurfaceArea; else cout<< Wrong Choice is entered. ; return 0; //DisplayMessage Function definition // Convert_Volume Function definition // Convert_Surface_Area Function definition 2

5 Q4)Circle the correct answer for the following: 1. Which of the following statements is NOT legal? a. char ch='b'; b. char ch='0'; c. char ch='$'; d. char ch="cc"; 2. What is the correct way to write the condition y < x < z? a. (y < x < z) b. ( (y < x) && z) c. ((y > x) (y < z)) d. ((y < x) && (x < z)) 3. Given the following code fragment, what is the output? int x=5; if( x > 5) cout << "x is bigger than 5. "; cout <<"That is all. "; cout << "Goodbye\n"; a. x is bigger than 5. That is all b. x is bigger than 5 c. That is all. Goodbye d. Goodbye 4. Given the following code fragment, which of the following expressions is always true (no matter the value of x is)? int x; cin >> x; a. if( x < 3) b. if( x==1) c. if( (x / 3) >1 ) d. if( x = 1)

6 Q5)Write a C++ code to implement the following flowchart. Use switch statement to implement the selective structure. Do not use if-thenelse structure. Let the variables N1, N2 be of type integer and Op variable be of type character. Begin Read Op, N1, N2 F? Op = + T F? Op= - T R=N1-N2 R=N1+N2 Print Wrong Operator Print R Print R using namesapce std; int main(){// declaration.. //read the inputs from the Keyboard. //perform the required calculations using switch statement //and print the result on the monitor return 0;.... End

7 Q6) Complete the following C++ code that should compute the number of times that the global minimum appears in an integer array named List that contains 10 elements, i.e., List[10]. A sample run can be Enter the array elements: Global minimum is 2 Global minimum appears 4 times. #include <iostream> #define SIZE 10 int main(){int List[SIZE], Minimum, MinCount, i; cout<< Enter the array elemnets: ; for(i=0;i<size;i++) cin>>list[i]; // Find the Minimum // Find the global Minimum Count (MinCount) // Print the Minimum // Print the MinCount return 0;

8 Q7) It is required to write a C++ code to add two complex numbers. Complete the following code to perform the specified tasks. A sample run of the code can be Enter the real and the imaginary parts of Object A: 2 3 Enter the real and the imaginary parts of Object B: 4 6 The value of the C object is 6+9i class Complex{public: double RePart, ImPart;; int main() {// Declare complex objects A, B, C of type Complex // Read the real and imaginary part members of A and B objects // Compute the real part member of object C // Compute the imaginary part member object C // Print the result of the addition as requested return 0; Q8) Trace and show the output of the following code: Trace section int main(){ int M1[3][3]={1,5,3,2,6,4,1,0,-7; int i, j,s=0; for (i=0; i<3; i++) { for (j=0; j<3; j++) { if(i>=j) S+=M1[i][j]; cout<< The sum is <<S<<endl; return 0; Output section

9 Q9)Conisder the following code which reads from the keyboard the value of an integer variable n and the value of a double variable x and then computes the result of the following formula: 2 n f 1 x x x int main() { int n,i; double x,f=1.0,t=1.0; cin >> n >> x ; for (i = 1; i <= n; i++) { t*=x; f+=t; cout << "f=" << f << endl; return 0; // function definition // main function int main(){int n,m; double x,y;... // Activate FindSum to print z cout << "z=" <<... ; return 0; It is required to write a code to compute 2 n 1 x x x z 1 2 m y y y Where m in integer and y is double variables. Complete the given C++ code to do this task. Note: To compute the series, it is required to use a function with the following prototype: double FindSum(double, int);

10 Q10)Complete the following code to perform the specified tasks. using namespace std; class Student {public: double Grade1, Grade2; double Average; ; int main() {// Declare student object Student1 of type Student Student Student1; // Read the values of grade1 and grade2 members of Student1 object cin>>student1.grade1>>student1.grade2; // Compute the average grade of Student1 object as // Average = grade1+grade2 2 Student1.Average=(Student1.grade1+Stduent1.grade2)/2; // Print the average grade of Student1 object cout<<stduent1.average; return 0; Q11) What is the output of the following code: int main(){ int M1[3][3]={{1,5,3,{2,6,4,{1,0,-7; int i, j,s=0; for (i=0; i<3; i++) { for (j=0; j<3; j++) { if(i<=j)s+=m1[i][j]; cout<< The sum is <<S<<endl; return 0; The sum is 12

11 Q12)Complete the following code that will print all odd integers between two numbers N1 and N2. Note: Firstly, you must find the the minimum and the maximum of N1 and N2. For example, if N1=13 and N2=4, then the program should find Min=4, Max=13 and then prints on the monitor the following odd integers: #include <iostream> int main() {int N1, N2, Min, Max,i; cin>>n1>>n2; // Find the minimum (Min) and the maximum (Max) of N1 and N2 if(n1<n2){min=n1;max=n2;. else {Min=N2;Max=N1;.... // Print all odd integer numbers between Min and Max for(i=min;i<=max;i++. if(i%2==1)cout<<i<<endl;.. return 0;

12 Q13)Complete the following C++ code which will find the global minimum and then computes the number of times that the global minimum appears in an integer array named List that contains 100 elements, i.e., List[100]. For example, in the list 3, 2, 7, 5, 2, 8, 2, 4, 2, the global minimum is 2 and it appears 4 times. #include <iostream> #define SIZE 100 int main() {int List[SIZE], Minimum, MinCount, i; // Read elements of the array list for(i=0;i<size;i++) cin>>list[i]; // Find the global minimum (Minimum) Minimum=List[0]; for(i=0;i<size;i++) if(list[i]<minimum) Minimum=List[i]; // Print the global minimum cout<<minimum; // Find the number of times that global minimum appears in the // List (MinCount) MinCount=0; for(i=0;i<size;i++) if(list[i]==minimum)mincount++; // Print the MinCount cout<<mincount; return 0;

13 Q14)What is the output of the following C++ code segments: a) int a = 5, b = 8; temp = a; a = b; b = a; cout << a<< ", " << b; b) int Num1=10, Num2=15; M=Num1 > Num2?Num1:Num2; cout<< M; c) for(sum=0,int i=1; i<5; i++) {if (i==4) break; Sum+=i; cout << Sum; d) for(sum=0,int i=1; i<10; i++) {if (i%2==1) continue; Sum+=i; cout << Sum; 8, e) int a = 5, b = 8, temp; temp = a; a = b; b = temp; cout << a<< ", " << b; 8,5

14 Q15)Write down the correct answer for the following: 1. An algorithm is a. The inputs and outputs of a program b. The part of the computer that does the processing c. A finite set of steps to solve a problem d. A complete computer program ANSWER: c 2. Which of the following statements is NOT legal? a. char ch='b'; b. char ch='0'; c. char ch='$'; d. char ch="cc"; ANSWER: d 3. What is the correct way to write the condition y < x < z? a. (y < x < z) b. ( (y < x) && z) c. ((y > x) (y < z)) d. ((y < x) && (x < z)) ANSWER: d 4. Given the following code fragment, what is the output? int x=5; if( x > 5) cout << "x is bigger than 5. "; cout <<"That is all. "; cout << "Goodbye\n"; a. x is bigger than 5. That is all b. x is bigger than 5 c. That is all. Goodbye d. Goodbye ANSWER: c 5. Given the following code fragment, which of the following expressions is always true? int x; cin >> x; a. if( x < 3) b. if( x==1) c. if( (x / 3) >1 ) d. if( x = 1) ANSWER: d

15 Q16)Write a C++ code to implement the following flowchart. Use switch statement to implement the selective structure. Do not use if-then-else structure. Let the variables N1, N2 be of type integer and Op variable be of type character. Begin Read Op, N1, N2 F? Op = + T F? Op= - T R=N1-N2 R=N1+N2 Print Wrong Operator Print R Print R using namesapce std; int main(){// declaration int N1, N2, R;. char Op;. //read the inputs from the Keyboard cin>>n1>>n2>>op;. cin>>op;. //perform the required calculations using switch statement //and print the result on the monitor return 0; End switch(op). {case + : R=N1+N2;cout<<R;break;. case - : R=N1-N2;cout<<R;break;. default:cout<< Wrong Operator ;.

16 Q17) Complete the following code to perform the specified tasks. class Manager{public: int Category; float ExtHours, ExtPayment;; int main() {// Declare manager object Manager1 of type Manager Manager Manager1; // Read the value of the ExtHours and // Category members of Manager1 object from keyboard cin>>manager1.exthours>>manager1.category; // Compute ExtPayment for Manager1 object assuming that // ExtPayment = ExtHours X Category Manager1.ExtPayment = Manager1.ExtHours * Manager1.Category; // Print the ExtPayment of Manager1 object on the monitor cout<<manager1.extpayment; return 0; Q18) Consider the following program and write the outputs of this program for the various inputs given in the boxes below. Use the corresponding boxes for your answers. int main() { int score; cout<<"enter your score: "; cin>>score; Enter your score: 10 Enter your score: 55 if (score<20) cout<<"red"; else if (score<=45) cout<<"green"; if (score>45) cout<<"blue"; return 0; Enter your score: 40 Enter your score: 45

17 Q19) Answer the following questions. PART A) Write down the output of the following code fragment. int i; for (i=1; i<10; i++) { switch ( i / 3 ) { case 0: cout<< i; break; case 1: cout<< "1"; break; case 3: cout<< "3"; break; default: cout<< "E"; Q20) Let A be a 1-D integer array which contains 20 elements, fill in the following code to find the maximum element and its position (index value). int main(){//declarations int Max_Element, Max_Position,i; int A[20]; // get the array elements from the Keyboard for (i=0; i<20; i++) cin>>a[i]; // find the maximum element and its position (index value) Max_Element=A[0]; Max_Position=0; for (i=1; i<20; i++) {if(a[i]>max_element) {Max_Element=A[i]; Max_Position=i; // print the maximum element and its position (index value) cout<< Maximum element is <<Max_Element<<endl; cout<< Maximum element position is <<Max_Position<<endl; return 0;

18 Q21) Trace the following code and show its output: int main(){ int M1[3][3]={{1,5,3,{2,1,3,{1,0,2; int i, j,s=0; for (i=0; i<2; i++) { for (j=i+1; j<3; j++) { s+=m1[i][j]; cout<< S= <<s<<endl return 0; Trace section i i<2 j j<3 s 0 0 T 1 T 0+5=5 2 T 5+3=8 3 F 1 T 2 T 8+3=11 3 F 2 F Output section S=11 Q22) A/ Re-write the following if/else using switch statement: if(digit==0 Digit==1) cout<< Binary ; else cout Not Binary ; Switch(Digit){ case 0: case 1: printf( Binary );break; default: printf( Not Binary ); B/ Re-write the following code using for-loop: year=1900; sum=0; while(year<=4002) { sum+=year; cout<<"year="<<year; year+=sum; Sum=1900; for(year=1900; year<=4002;year+=sum) {sum+=year; cout<<"year="<<year; C/ What is the output of the following code segment: int j=2,i; for (i=3; i<=8; i+=2) {j+=i; if (j>6) break; cout<< j= <<j; Trace j i i<=8 j>6 2 3 T 5 F 5 T 10 T J=10

19 D/ What is the output of the following code segment: int i,sum=2; for (i=3; i<=10; i+=2) {if (i%3 == 0) continue; sum+=i; cout<<"sum= <<sum; Trace sum i i<=10 i%3==0 2 3 T T 5 T F 2+5=7 7 T F 7+7=14 9 T T 11 F Sum=14 Q23) Answer the following question. Complete the missing statements in the following program to compute R=n!-m!, where n! is the factorial of n computed as n!=1*2*3*..*n Note: the function Factorial (int a) computes the factorial of a, i.e., a!. int Factorial(int a) { int i, p=1; for (i=1, i<=a; i++) p=p*i; return p; int main( ) { int num1, num2, R; cout<< Enter an integer to calculate its factorial: ; cin>> num1>>num2; // Call the function to find num1!-num2! and assign the result to R variable R=Factorial(num1) Factorial(num2); cout<< Result = << R <<endl; return 0;

20 Q24) Complete the following C++ code to perform the specified tasks. class Student {public: int id_no; float grade1; float grade2; float avg_grade; ; int main() {; // Declare student object Student1 of type Student Student Student1; // Declare student object Student2 of type Student Student Student2; // Read from the keyboard the values of grade1 and grade2 members of // Student1 object cin>>student1.grade1>>student1.grade2; // Read from the keyboard the values of grade1 and grade2 members of // Student2 object cin>>student2.grade1>>student2.grade2; // Compute and print the average grade of Student1 object // Assume that avg_grade = (grade1+grade2)/2 Student1.avg_grade=(Student1.grade1 + Student1.grade2) /2; cout<<student1.avg_grade<<endl; // Compute and print the average grade of Student2 object // Assume that avg_grade = (grade1+grade2)/2 Student2.avg_grade=(Student2.grade1 + Student2.grade2) /2; cout<<student2.avg_grade<<endl; return 0;

Computer Engineering Department CMPE110 Midterm Sample Questions, 2017/ Fall

Computer Engineering Department CMPE110 Midterm Sample Questions, 2017/ Fall Computer Engineering Department CMPE110 Midterm Sample Questions, 2017/2018 - Fall Q1) Give the correct answer for following: 1. What is the value of x after the following statement? double x; x = 3.0

More information

Test Bank for Problem Solving with C++: The Object of Programming, 8/e Chapter 2 C++ Basics

Test Bank for Problem Solving with C++: The Object of Programming, 8/e Chapter 2 C++ Basics TRUE/FALSE 1. In the following code fragment, x has the value of 3. int x = 3; ANSWER: TRUE 2. The body of a do-while loop always executes at least once. ANSWER: TRUE 3. The body of a while loop may never

More information

1- Write a single C++ statement that: A. Calculates the sum of the two integrates 11 and 12 and outputs the sum to the consol.

1- Write a single C++ statement that: A. Calculates the sum of the two integrates 11 and 12 and outputs the sum to the consol. 1- Write a single C++ statement that: A. Calculates the sum of the two integrates 11 and 12 and outputs the sum to the consol. B. Outputs to the console a floating point number f1 in scientific format

More information

GE U111 Engineering Problem Solving & Computation Lecture 6 February 2, 2004

GE 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 information

o Counter and sentinel controlled loops o Formatting output o Type casting o Top-down, stepwise refinement

o Counter and sentinel controlled loops o Formatting output o Type casting o Top-down, stepwise refinement Last Time Let s all Repeat Together 10/3/05 CS150 Introduction to Computer Science 1 1 We covered o Counter and sentinel controlled loops o Formatting output Today we will o Type casting o Top-down, stepwise

More information

The American University in Cairo Department of Computer Science & Engineering CSCI &09 Dr. KHALIL Exam-I Fall 2011

The American University in Cairo Department of Computer Science & Engineering CSCI &09 Dr. KHALIL Exam-I Fall 2011 The American University in Cairo Department of Computer Science & Engineering CSCI 106-07&09 Dr. KHALIL Exam-I Fall 2011 Last Name :... ID:... First Name:... Form I Section No.: EXAMINATION INSTRUCTIONS

More information

DHA Suffa University CS 103 Object Oriented Programming Fall 2015 Lab #01: Introduction to C++

DHA Suffa University CS 103 Object Oriented Programming Fall 2015 Lab #01: Introduction to C++ DHA Suffa University CS 103 Object Oriented Programming Fall 2015 Lab #01: Introduction to C++ Objective: To Learn Basic input, output, and procedural part of C++. C++ Object-orientated programming language

More information

LAB 4.1 Relational Operators and the if Statement

LAB 4.1 Relational Operators and the if Statement LAB 4.1 Relational Operators and the if Statement // This program tests whether or not an initialized value of num2 // is equal to a value of num1 input by the user. int main( ) int num1, // num1 is not

More information

1. a) What #include statement do you put at the top of a program that does uses cin, cout or endl?

1. a) What #include statement do you put at the top of a program that does uses cin, cout or endl? Exercises with solutions. 1. a) What #include statement do you put at the top of a program that does uses cin, cout or endl? #include b) What using statement do you always put at the top of

More information

WARM UP LESSONS BARE BASICS

WARM UP LESSONS BARE BASICS WARM UP LESSONS BARE BASICS CONTENTS Common primitive data types for variables... 2 About standard input / output... 2 More on standard output in C standard... 3 Practice Exercise... 6 About Math Expressions

More information

CSCE Practice Midterm. Data Types

CSCE Practice Midterm. Data Types CSCE 2004 - Practice Midterm This midterm exam was given in class several years ago. Work each of the following questions on your own. Once you are done, check your answers. For any questions whose answers

More information

1) What of the following sets of values for A, B, C, and D would cause the string "one" to be printed?

1) What of the following sets of values for A, B, C, and D would cause the string one to be printed? Instructions: This homework assignment focuses primarily on some of the basic syntax and semantics of C++. The answers to the following questions can be determined from Chapters 6 and 7 of the lecture

More information

C++ Final Exam 2017/2018

C++ Final Exam 2017/2018 1) All of the following are examples of integral data types EXCEPT. o A Double o B Char o C Short o D Int 2) After the execution of the following code, what will be the value of numb if the input value

More information

Consider the following statements. string str1 = "ABCDEFGHIJKLM"; string str2; After the statement str2 = str1.substr(1,4); executes, the value of str2 is " ". Given the function prototype: float test(int,

More information

CMPE Experiment 3 Selective Structures

CMPE Experiment 3 Selective Structures Page1 CMPE 108 - Experiment 3 Selective Structures OBJECTIVES: Understand how to edit, compile and execute C computer codes. Understand C programming: sequential and selective structures NOTES: You should

More information

UEE1302(1066) F12: Introduction to Computers and Programming Function (II) - Parameter

UEE1302(1066) F12: Introduction to Computers and Programming Function (II) - Parameter UEE1302(1066) F12: Introduction to Computers and Programming Function (II) - Parameter What you will learn from Lab 7 In this laboratory, you will understand how to use typical function prototype with

More information

CS 201 (Intro. to Computing) Fall 2015 Sabancı University Sample Questions for Midterm 1

CS 201 (Intro. to Computing) Fall 2015 Sabancı University Sample Questions for Midterm 1 CS 201 (Intro. to Computing) Fall 2015 Sabancı University Sample Questions for Midterm 1 Those questions do not imply any favorite subject or question type for the questions in the actual exam Please also

More information

Sample Paper - II Subject Computer Science

Sample Paper - II Subject Computer Science Sample Paper - II Subject Computer Science Max Marks 70 Duration 3 hrs Note:- All questions are compulsory Q1) a) What is significance of My Computer? 2 b) Explain different types of operating systems.

More information

Number: Name-Surname :... Group:...

Number: Name-Surname :... Group:... COMPUTER ENGINEERING DEPARTMENT CMPE110 Midterm Exam, 2017-2018 Fall Instructors: O. Ramadan (01) and C. Ergun (02) Date: 24/11/2017 Duration: 100 min. Number: Name-Surname :... Group:... Q1 Q2 Q3 Q4 Q5

More information

ASSIGNMENT CLASS-11 COMPUTER SCIENCE [C++]

ASSIGNMENT CLASS-11 COMPUTER SCIENCE [C++] ASSIGNMENT-1 2016-17 CLASS-11 COMPUTER SCIENCE [C++] 1 Consider the following C++ snippet: int x = 25000; int y = 2*x; cout

More information

#include <iostream> #include <algorithm> #include <cmath> using namespace std; int f1(int x, int y) { return (double)(x/y); }

#include <iostream> #include <algorithm> #include <cmath> using namespace std; int f1(int x, int y) { return (double)(x/y); } 1. (9 pts) Show what will be output by the cout s in this program. As in normal program execution, any update to a variable should affect the next statement. (Note: boolalpha simply causes Booleans to

More information

I SEMESTER EXAM : : XI :COMPUTER SCIENCE : MAX MARK a) What is the difference between Hardware and Software? Give one example for each.

I SEMESTER EXAM : : XI :COMPUTER SCIENCE : MAX MARK a) What is the difference between Hardware and Software? Give one example for each. I SEMESTER EXAM : : XI :COMPUTER SCIENCE : MAX MARK 70. a) What is the difference between Hardware and Software? Give one example for each. b) Give two differences between primary and secondary memory.

More information

Chapter 01 Arrays Prepared By: Dr. Murad Magableh 2013

Chapter 01 Arrays Prepared By: Dr. Murad Magableh 2013 Chapter 01 Arrays Prepared By: Dr. Murad Magableh 2013 One Dimensional Q1: Write a program that declares two arrays of integers and fills them from the user. Then exchanges their values and display the

More information

Chapter 3 Problem Solving and the Computer

Chapter 3 Problem Solving and the Computer Chapter 3 Problem Solving and the Computer An algorithm is a step-by-step operations that the CPU must execute in order to solve a problem, or to perform that task. A program is the specification of an

More information

CHRIST THE KING BOYS MATRIC HR. SEC. SCHOOL, KUMBAKONAM CHAPTER 9 C++

CHRIST THE KING BOYS MATRIC HR. SEC. SCHOOL, KUMBAKONAM CHAPTER 9 C++ CHAPTER 9 C++ 1. WRITE ABOUT THE BINARY OPERATORS USED IN C++? ARITHMETIC OPERATORS: Arithmetic operators perform simple arithmetic operations like addition, subtraction, multiplication, division etc.,

More information

Superior University. Department of Electrical Engineering CS-115. Computing Fundamentals. Experiment No.7. User Defined Functions II

Superior University. Department of Electrical Engineering CS-115. Computing Fundamentals. Experiment No.7. User Defined Functions II Superior University Department of Electrical Engineering CS-115 Computing Fundamentals Experiment No.7 User Defined Functions II Prepared for By: Name: ID: Section: Semester: Total Marks: Obtained Marks:

More information

CSCE 2004 Midterm Exam Spring 2017

CSCE 2004 Midterm Exam Spring 2017 CSCE 2004 Midterm Exam Spring 2017 Student Name: Student UAID: Instructions: This is a 50 minute exam. Students are allowed one 8.5 by 11 page of study notes. Calculators, cell phones and computers are

More information

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

C++ Programming: From Problem Analysis to Program Design, Third Edition C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 4: Control Structures I (Selection) Control Structures A computer can proceed: In sequence Selectively (branch) - making

More information

Total 100. The American University in Cairo Computer Science & Engineering Department CSCE 106. Dr. Khalil Exam II Fall 2011

Total 100. The American University in Cairo Computer Science & Engineering Department CSCE 106. Dr. Khalil Exam II Fall 2011 The American University in Cairo Computer Science & Engineering Department CSCE 106 Dr. Khalil Exam II Fall 2011 Last Name :... ID:... First Name:... Form I Section No.: ( ) EXAMINATION INSTRUCTIONS *

More information

Week 3. Function Definitions. Example: Function. Function Call, Return Statement. Functions & Arrays. Gaddis: Chapters 6 and 7.

Week 3. Function Definitions. Example: Function. Function Call, Return Statement. Functions & Arrays. Gaddis: Chapters 6 and 7. Week 3 Functions & Arrays Gaddis: Chapters 6 and 7 CS 5301 Fall 2015 Jill Seaman 1 Function Definitions! Function definition pattern: datatype identifier (parameter1, parameter2,...) { statements... Where

More information

Programming Language. Functions. Eng. Anis Nazer First Semester

Programming 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 information

CSCE Practice Midterm. Data Types

CSCE Practice Midterm. Data Types CSCE 2004 - Practice Midterm This midterm exam was given in class several years ago. Work each of the following questions on your own. Once you are done, check your answers. For any questions whose answers

More information

3. Functions. Modular programming is the dividing of the entire problem into small sub problems that can be solved by writing separate programs.

3. Functions. Modular programming is the dividing of the entire problem into small sub problems that can be solved by writing separate programs. 1 3. Functions 1. What are the merits and demerits of modular programming? Modular programming is the dividing of the entire problem into small sub problems that can be solved by writing separate programs.

More information

BEng (Hons) Electronic Engineering. Resit Examinations for / Semester 1

BEng (Hons) Electronic Engineering. Resit Examinations for / Semester 1 BEng (Hons) Electronic Engineering Cohort: BEE/10B/FT Resit Examinations for 2016-2017 / Semester 1 MODULE: Programming for Engineers MODULE CODE: PROG1114 Duration: 3 Hours Instructions to Candidates:

More information

Programming. C++ Basics

Programming. C++ Basics Programming C++ Basics Introduction to C++ C is a programming language developed in the 1970s with the UNIX operating system C programs are efficient and portable across different hardware platforms C++

More information

Multiple Choice (Questions 1 13) 26 Points Select all correct answers (multiple correct answers are possible)

Multiple 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 information

EECS402 Lecture 02. Functions. Function Prototype

EECS402 Lecture 02. Functions. Function Prototype The University Of Michigan Lecture 02 Andrew M. Morgan Savitch Ch. 3-4 Functions Value and Reference Parameters Andrew M. Morgan 1 Functions Allows for modular programming Write the function once, call

More information

Agenda / Learning Objectives: 1. Map out a plan to study for mid-term Review the C++ operators up to logical operators. 3. Read about the tips

Agenda / Learning Objectives: 1. Map out a plan to study for mid-term Review the C++ operators up to logical operators. 3. Read about the tips Agenda / Learning Objectives: 1. Map out a plan to study for mid-term 2. 2. Review the C++ operators up to logical operators. 3. Read about the tips and pitfalls on using arrays (see below.) 4. Understand

More information

Programming Fundamentals. With C++ Variable Declaration, Evaluation and Assignment 1

Programming 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 information

CS2255 HOMEWORK #1 Fall 2012

CS2255 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 information

REPETITION CONTROL STRUCTURE LOGO

REPETITION CONTROL STRUCTURE LOGO CSC 128: FUNDAMENTALS OF COMPUTER PROBLEM SOLVING REPETITION CONTROL STRUCTURE 1 Contents 1 Introduction 2 for loop 3 while loop 4 do while loop 2 Introduction It is used when a statement or a block of

More information

Basic 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 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 information

Lecture 4. 1 Statements: 2 Getting Started with C++: LESSON FOUR

Lecture 4. 1 Statements: 2 Getting Started with C++: LESSON FOUR 1 Statements: A statement in a computer carries out some action. There are three types of statements used in C++; they are expression statement, compound statement and control statement. Expression statement

More information

Multiple Choice (Questions 1 13) 26 Points Select all correct answers (multiple correct answers are possible)

Multiple 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 information

Exam 2. CSI 201: Computer Science 1 Fall 2016 Professors: Shaun Ramsey and Kyle Wilson. Question Points Score Total: 80

Exam 2. CSI 201: Computer Science 1 Fall 2016 Professors: Shaun Ramsey and Kyle Wilson. Question Points Score Total: 80 Exam 2 CSI 201: Computer Science 1 Fall 2016 Professors: Shaun Ramsey and Kyle Wilson Question Points Score 1 18 2 29 3 18 4 15 Total: 80 I understand that this exam is closed book and closed note and

More information

Laboratory 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++ 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 information

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

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 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 information

EE 109 Lab 8a Conversion Experience

EE 109 Lab 8a Conversion Experience EE 109 Lab 8a Conversion Experience 1 Introduction In this lab you will write a small program to convert a string of digits representing a number in some other base (between 2 and 10) to decimal. The user

More information

a. a * c - 10 = b. a % b + (a * d) + 7 =

a. a * c - 10 = b. a % b + (a * d) + 7 = Exam #2 CISC1110, MW 10:35-12:40pm Fall 2011 Name 1 Evaluate each expression according to C++ rules (8 pts) Given: Integers a = 3, b = 2, c = 5, and float d = 40 a a * c - 10 = b a % b + (a * d) + 7 =

More information

Introduction to Computer Science Midterm 3 Fall, Points

Introduction 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 information

3/12/2018. Structures. Programming in C++ Sequential Branching Repeating. Loops (Repetition)

3/12/2018. Structures. Programming in C++ Sequential Branching Repeating. Loops (Repetition) Structures Programming in C++ Sequential Branching Repeating Loops (Repetition) 2 1 Loops Repetition is referred to the ability of repeating a statement or a set of statements as many times this is necessary.

More information

CS Introduction to Programming Midterm Exam #2 - Prof. Reed Fall 2015

CS Introduction to Programming Midterm Exam #2 - Prof. Reed Fall 2015 CS 141 - Introduction to Programming Midterm Exam #2 - Prof. Reed Fall 2015 You may take this test with you after the test, but you must turn in your answer sheet. This test has the following sections:

More information

Practice Exercises #8

Practice Exercises #8 Practice Exercises #8 Chapter 6 Functions Page 1 Practice Exercises #8 Functions Related Chapter Chapter Title 6 Functions STUDENT LEARNING OUTCOMES: Upon completion of this practical exercise, a successful

More information

The University Of Michigan. EECS402 Lecture 02. Andrew M. Morgan. Savitch Ch. 3-4 Functions Value and Reference Parameters.

The University Of Michigan. EECS402 Lecture 02. Andrew M. Morgan. Savitch Ch. 3-4 Functions Value and Reference Parameters. The University Of Michigan Lecture 02 Andrew M. Morgan Savitch Ch. 3-4 Functions Value and Reference Parameters Andrew M. Morgan 1 Functions Allows for modular programming Write the function once, call

More information

What we will learn about this week: Declaring and referencing arrays. arrays as function arguments. Arrays

What we will learn about this week: Declaring and referencing arrays. arrays as function arguments. Arrays What we will learn about this week: Declaring and referencing arrays Arrays in memory Initializing arrays indexed variables arrays as function arguments Arrays a way of expressing many of the same variable

More information

FORM 1 (Please put your name and section number (001/10am or 002/2pm) on the scantron!!!!) CS 161 Exam II: True (A)/False(B) (2 pts each):

FORM 1 (Please put your name and section number (001/10am or 002/2pm) on the scantron!!!!) CS 161 Exam II: True (A)/False(B) (2 pts each): FORM 1 (Please put your name and section number (001/10am or 002/2pm) on the scantron!!!!) CS 161 Exam II: True (A)/False(B) (2 pts each): 1. If a function has default arguments, they can be located anywhere

More information

The American University in Cairo Computer Science & Engineering Department CSCE 106 Fundamentals of Computer Science. Instructor: Final Exam Fall 2011

The American University in Cairo Computer Science & Engineering Department CSCE 106 Fundamentals of Computer Science. Instructor: Final Exam Fall 2011 The American University in Cairo Computer Science & Engineering Department CSCE 106 Fundamentals of Computer Science Instructor: Final Exam Fall 2011 Last Name :... ID:... First Name:... Section No.: EXAMINATION

More information

University of Technology. Laser & Optoelectronics Engineering Department. C++ Lab.

University of Technology. Laser & Optoelectronics Engineering Department. C++ Lab. University of Technology Laser & Optoelectronics Engineering Department C++ Lab. Fifth week Control Structures A program is usually not limited to a linear sequence of instructions. During its process

More information

CHAPTER 2.2 CONTROL STRUCTURES (ITERATION) Dr. Shady Yehia Elmashad

CHAPTER 2.2 CONTROL STRUCTURES (ITERATION) Dr. Shady Yehia Elmashad CHAPTER 2.2 CONTROL STRUCTURES (ITERATION) Dr. Shady Yehia Elmashad Outline 1. C++ Iterative Constructs 2. The for Repetition Structure 3. Examples Using the for Structure 4. The while Repetition Structure

More information

Add Subtract Multiply Divide

Add Subtract Multiply Divide ARITHMETIC OPERATORS if AND if/else AND while LOOP Order of Operation (Precedence Part 1) Copyright 2014 Dan McElroy Add Subtract Multiply Divide + Add - Subtract * Multiply / Divide = gives the quotient

More information

CS242 COMPUTER PROGRAMMING

CS242 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 information

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

Multiple 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 information

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

Chapter 3. More Flow of Control. Copyright 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 3 More Flow of Control Overview 3.1 Using Boolean Expressions 3.2 Multiway Branches 3.3 More about C++ Loop Statements 3.4 Designing Loops Slide 3-3 Flow Of Control Flow of control refers to the

More information

The following expression causes a divide by zero error:

The following expression causes a divide by zero error: Chapter 2 - Test Questions These test questions are true-false, fill in the blank, multiple choice, and free form questions that may require code. The multiple choice questions may have more than one correct

More information

Exercise1. // classes first example. #include <iostream> using namespace std; class Rectangle. int width, height; public: void set_values (int,int);

Exercise1. // classes first example. #include <iostream> using namespace std; class Rectangle. int width, height; public: void set_values (int,int); Exercise1 // classes first example class Rectangle int width, height; void set_values (int,int); int area() return width*height; ; void Rectangle::set_values (int x, int y) width = x; height = y; int main

More information

2. ARRAYS What is an Array? index number subscrip 2. Write array declarations for the following: 3. What is array initialization?

2. ARRAYS What is an Array? index number subscrip 2. Write array declarations for the following: 3. What is array initialization? 1 2. ARRAYS 1. What is an Array? Arrays are used to store a set of values of the same type under a single variable name. It is a collection of same type elements placed in contiguous memory locations.

More information

Increment and the While. Class 15

Increment and the While. Class 15 Increment and the While Class 15 Increment and Decrement Operators Increment and Decrement Increase or decrease a value by one, respectively. the most common operation in all of programming is to increment

More information

1) You want to determine whether time has run out. The following code correctly implements this:

1) You want to determine whether time has run out. The following code correctly implements this: Exam Name TRUE/FALSE. Write ʹTʹ if the statement is true and ʹFʹ if the statement is false. 1) You want to determine whether time has run out. The following code correctly implements this: 1)!time > limit

More information

5.1. Chapter 5: The Increment and Decrement Operators. The Increment and Decrement Operators. The Increment and Decrement Operators

5.1. Chapter 5: The Increment and Decrement Operators. The Increment and Decrement Operators. The Increment and Decrement Operators Chapter 5: 5.1 Looping The Increment and Decrement Operators The Increment and Decrement Operators The Increment and Decrement Operators ++ is the increment operator. It adds one to a variable. val++;

More information

(6) The specification of a name with its type in a program. (7) Some memory that holds a value of a given type.

(6) The specification of a name with its type in a program. (7) Some memory that holds a value of a given type. CS 7A - Fall 2016 - Midterm 1 10/20/16 Write responses to questions 1 and 2 on this paper or attach additional sheets, as necessary For all subsequent problems, use separate paper Do not use a computer

More information

Introduction to C++ 2. A Simple C++ Program. A C++ program consists of: a set of data & function definitions, and the main function (or driver)

Introduction to C++ 2. A Simple C++ Program. A C++ program consists of: a set of data & function definitions, and the main function (or driver) Introduction to C++ 1. General C++ is an Object oriented extension of C which was derived from B (BCPL) Developed by Bjarne Stroustrup (AT&T Bell Labs) in early 1980 s 2. A Simple C++ Program A C++ program

More information

Functions. CS111 Lab Queens College, CUNY Instructor: Kent Chin

Functions. CS111 Lab Queens College, CUNY Instructor: Kent Chin Functions CS111 Lab Queens College, CUNY Instructor: Kent Chin Functions They're everywhere! Input: x Function: f Output: f(x) Input: Sheets of Paper Function: Staple Output: Stapled Sheets of Paper C++

More information

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

5. Assuming gooddata is a Boolean variable, the following two tests are logically equivalent. if (gooddata == false) if (!

5. 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 information

Sample Paper Class XI Subject Computer Sience UNIT TEST II

Sample Paper Class XI Subject Computer Sience UNIT TEST II Sample Paper Class XI Subject Computer Sience UNIT TEST II (General OOP concept, Getting Started With C++, Data Handling and Programming Paradigm) TIME: 1.30 Hrs Max Marks: 40 ALL QUESTIONS ARE COMPULSURY.

More information

UNIVERSITY OF SWAZILAND SUPPLEMENTARY EXAMINATION, JULY 2013

UNIVERSITY OF SWAZILAND SUPPLEMENTARY EXAMINATION, JULY 2013 UNIVERSITY OF SWAZILAND SUPPLEMENTARY EXAMINATION, JULY 2013 Title of Paper : STRUCTURED PROGRAMMING - I Course number: CS243 Time allowed Instructions : Three (3) hours. : (1) Read all the questions in

More information

In this chapter you will learn:

In this chapter you will learn: 1 In this chapter you will learn: Essentials of counter-controlled repetition. Use for, while and do while to execute statements in program repeatedly. Use nested control statements in your program. 2

More information

Scheme G. Sample Test Paper-I. Course Name : Computer Engineering Group Course Code : CO/CD/CM/CW/IF Semester : Second Subject Tile : Programming in C

Scheme G. Sample Test Paper-I. Course Name : Computer Engineering Group Course Code : CO/CD/CM/CW/IF Semester : Second Subject Tile : Programming in C Sample Test Paper-I Marks : 25 Time:1 Hrs. Q1. Attempt any THREE 09 Marks a) State four relational operators with meaning. b) State the use of break statement. c) What is constant? Give any two examples.

More information

Week 3. Function Definitions. Example: Function. Function Call, Return Statement. Functions & Arrays. Gaddis: Chapters 6 and 7. CS 5301 Spring 2018

Week 3. Function Definitions. Example: Function. Function Call, Return Statement. Functions & Arrays. Gaddis: Chapters 6 and 7. CS 5301 Spring 2018 Week 3 Functions & Arrays Gaddis: Chapters 6 and 7 CS 5301 Spring 2018 Jill Seaman 1 Function Definitions l Function definition pattern: datatype identifier (parameter1, parameter2,...) { statements...

More information

CSCE 206: Structured Programming in C++

CSCE 206: Structured Programming in C++ CSCE 206: Structured Programming in C++ 2017 Spring Exam 2 Monday, March 20, 2017 Total - 100 Points B Instructions: Total of 13 pages, including this cover and the last page. Before starting the exam,

More information

Structured Programming. Flowchart Symbols. Structured Programming. Selection. Sequence. Control Structures ELEC 330 1

Structured Programming. Flowchart Symbols. Structured Programming. Selection. Sequence. Control Structures ELEC 330 1 ELEC 330 1 Structured Programming Control Structures ELEC 206 Computer Applications for Electrical Engineers Dr. Ron Hayne Algorithm Development Conditional Expressions Selection Statements Loops 206_C3

More information

FORM 2 (Please put your name and form # on the scantron!!!!)

FORM 2 (Please put your name and form # on the scantron!!!!) CS 161 Exam 2: FORM 2 (Please put your name and form # on the scantron!!!!) True (A)/False(B) (2 pts each): 1. Recursive algorithms tend to be less efficient than iterative algorithms. 2. A recursive function

More information

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

Name MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. CMPSC11 Final (Study Guide) Fall 11 Prof Hartman Name MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. 1) This is a collection of statements that performs

More information

CHAPTER 4 FUNCTIONS. 4.1 Introduction

CHAPTER 4 FUNCTIONS. 4.1 Introduction CHAPTER 4 FUNCTIONS 4.1 Introduction Functions are the building blocks of C++ programs. Functions are also the executable segments in a program. The starting point for the execution of a program is main

More information

Programming in C++ The manager of a company. Lecture Notes 6. Functions (Procedures) 4/24/2018. he he he. Does Does Does

Programming in C++ The manager of a company. Lecture Notes 6. Functions (Procedures) 4/24/2018. he he he. Does Does Does The manager of a company Programming in C++ Lecture Notes 6 Functions (Procedures) Does Does Does he he he pay the bills? answer the phone? clean the office? 2 1 Division of Labor Our programs until now

More information

b) Give the output of the following program: 6,70,70 2,70 210,282,59290

b) Give the output of the following program: 6,70,70 2,70 210,282,59290 Set II 1. a) Name the header file for the following built-in functions: i) fabs() math.h ii) isalpha() ctype.h iii) toupper() ctype.h iv) cos() math.h b) Give the output of the following program: 6,70,70

More information

CSE030 Fall 2012 Final Exam Friday, December 14, PM

CSE030 Fall 2012 Final Exam Friday, December 14, PM CSE030 Fall 2012 Final Exam Friday, December 14, 2012 3-6PM Write your name here and at the top of each page! Name: Select your lab session: Tuesdays Thursdays Paper. If you have any questions or need

More information

Programming - 1. Computer Science Department 011COMP-3 لغة البرمجة 1 لطالب كلية الحاسب اآللي ونظم المعلومات 011 عال- 3

Programming - 1. Computer Science Department 011COMP-3 لغة البرمجة 1 لطالب كلية الحاسب اآللي ونظم المعلومات 011 عال- 3 Programming - 1 Computer Science Department 011COMP-3 لغة البرمجة 1 011 عال- 3 لطالب كلية الحاسب اآللي ونظم المعلومات 1 1.1 Machine Language A computer programming language which has binary instructions

More information

conditional statements

conditional statements L E S S O N S E T 4 Conditional Statements PU RPOSE PROCE DU RE 1. To work with relational operators 2. To work with conditional statements 3. To learn and use nested if statements 4. To learn and use

More information

I/O Streams and Standard I/O Devices (cont d.)

I/O Streams and Standard I/O Devices (cont d.) Chapter 3: Input/Output Objectives In this chapter, you will: Learn what a stream is and examine input and output streams Explore how to read data from the standard input device Learn how to use predefined

More information

Unit 7. 'while' Loops

Unit 7. 'while' Loops 1 Unit 7 'while' Loops 2 Control Structures We need ways of making decisions in our program To repeat code until we want it to stop To only execute certain code if a condition is true To execute one segment

More information

The American University in Cairo Department of Computer Science & Engineeringt CSCI &09 Dr. KHALIL Exam-I Fall 2009

The American University in Cairo Department of Computer Science & Engineeringt CSCI &09 Dr. KHALIL Exam-I Fall 2009 The American University in Cairo Department of Computer Science & Engineeringt CSCI 106-05&09 Dr. KHALIL Exam-I Fall 2009 Last Name :... ID:... First Name:... Form I Section No.: EXAMINATION INSTRUCTIONS

More information

C++ Programming for Non-C Programmers. Supplement

C++ Programming for Non-C Programmers. Supplement C++ Programming for Non-C Programmers Supplement ii C++ Programming for Non-C Programmers C++ Programming for Non-C Programmers Published by itcourseware, 10333 E. Dry Creek Rd., Suite 150, Englewood,

More information

Precedence and Associativity Table. % specifiers in ANSI C: String Control Codes:

Precedence and Associativity Table. % specifiers in ANSI C: String Control Codes: CMPE108, Homework-2 (C Fundamentals, Expressions, and Selection Structure.) Student Nr:... Name,Surname:...:... CMPE108 Group:... Signature... Please print this homework, and solve all questions on the

More information

BITG 1113: Array (Part 1) LECTURE 8

BITG 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 information

Help File on C++ and Programming at CSUSM by Rika Yoshii

Help File on C++ and Programming at CSUSM by Rika Yoshii Help File on C++ and Programming at CSUSM by Rika Yoshii Compiler versus Editor empress.csusm.edu is a machine that you remotely log into from anywhere using putty, empress.csusm.edu uses the operating

More information

More Flow Control Functions in C++ CS 16: Solving Problems with Computers I Lecture #4

More Flow Control Functions in C++ CS 16: Solving Problems with Computers I Lecture #4 More Flow Control Functions in C++ CS 16: Solving Problems with Computers I Lecture #4 Ziad Matni Dept. of Computer Science, UCSB Administrative CHANGED T.A. OFFICE/OPEN LAB HOURS! Thursday, 10 AM 12 PM

More information

Homework #3 CS2255 Fall 2012

Homework #3 CS2255 Fall 2012 Homework #3 CS2255 Fall 2012 MULTIPLE CHOICE 1. The, also known as the address operator, returns the memory address of a variable. a. asterisk ( * ) b. ampersand ( & ) c. percent sign (%) d. exclamation

More information

Review. Relational Operators. The if Statement. CS 151 Review #4

Review. Relational Operators. The if Statement. CS 151 Review #4 Review Relational Operators You have already seen that the statement total=5 is an assignment statement; that is, the integer 5 is placed in the variable called total. Nothing relevant to our everyday

More information

Chapter 4 - Notes Control Structures I (Selection)

Chapter 4 - Notes Control Structures I (Selection) Chapter 4 - Notes Control Structures I (Selection) I. Control Structures A. Three Ways to Process a Program 1. In Sequence: Starts at the beginning and follows the statements in order 2. Selectively (by

More information