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

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

The American University in Cairo Computer Science & Engineering Department CSCE Dr. KHALIL Exam II Spring 2010

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. Instructor: Final Exam Fall Section No.

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

The American University in Cairo Computer Science & Engineering Department CSCE 106 Fundamentals of Computer Science

Total 100. The American University in Cairo Computer Science & Engineering Department CSCE Instructor: Final Exam Fall 2014

The American University in Cairo Computer Science & Engineering Department CSCE 106 Fundamentals of Computer Science

Solve only 2 out of 3 questions

Review: Exam 1. Your First C++ Program. Declaration Statements. Tells the compiler. Examples of declaration statements

CSCE Practice Midterm. Data Types

2. Distinguish between a unary, a binary and a ternary operator. Give examples of C++ operators for each one of them.

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

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

Exam 1. CSI 201: Computer Science 1 Fall 2018 Professors: Shaun Ramsey

LAB 4.1 Relational Operators and the if Statement

CSCE Practice Midterm. Data Types

A First Program - Greeting.cpp

Exam 1 Practice CSE 232 Summer 2018 (1) DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN.

Note: The buy help from the TA for points will apply on this exam as well, so please read that carefully.

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

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

Week 2: Console I/O and Operators Arithmetic Operators. Integer Division. Arithmetic Operators. Gaddis: Chapter 3 (2.14,3.1-6,3.9-10,5.

Review of Important Topics in CS1600. Functions Arrays C-strings

Objectives. Chapter 2: Basic Elements of C++ Introduction. Objectives (cont d.) A C++ Program (cont d.) A C++ Program

Chapter 2: Basic Elements of C++

University of Michigan EECS 183: Elem. Programming Concepts Fall 2011 Exam 1: Part 1: Form 1. Professors: ML Dorf, Elliot Soloway

WARM UP LESSONS BARE BASICS

Chapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction

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

CSc Introduc/on to Compu/ng. Lecture 8 Edgardo Molina Fall 2011 City College of New York

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.

Engineering Problem Solving with C++, 3e Chapter 2 Test Bank

CMSC 202 Midterm Exam 1 Fall 2015

Introduction to Computer Science Midterm 3 Fall, Points

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

Computer Programming. Basic Control Flow - Loops. Adapted from C++ for Everyone and Big C++ by Cay Horstmann, John Wiley & Sons

! A program is a set of instructions that the. ! It must be translated. ! Variable: portion of memory that stores a value. char

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

Overloading Functions & Command Line Use in C++ CS 16: Solving Problems with Computers I Lecture #6

CSCE 2004 Midterm Exam Spring 2017

Midterm Exam #2 Spring (1:00-3:00pm, Friday, March 15)

CSCI 102L - Data Structures Midterm Exam #1 Fall 2011

Computer Department. Question (1): State whether each of the following is true or false. Question (2): Select the correct answer from the following:

Errata for C++ and Algorithmic Thinking for the Complete Beginner

CS 141, Introduction to Computer Science Fall Midterm Exam

CSCI 111 First Midterm Exam Fall Solutions 09.00am 09.50am, Wednesday, October 18, 2017

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

1. Match each of the following data types with literal constants of that data type. A data type can be used more than once. A.

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

CSCI 111 Midterm 1, version A Exam Fall Solutions 09.00am 09.50am, Tuesday, October 13, 2015

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

Fundamentals of Programming CS-110. Lecture 2

Do not turn to the next page until the start of the exam.

Basic memory model Using functions Writing functions. Basics Prototypes Parameters Return types Functions and memory Names and namespaces

Final Exam, Version 3 CSci 127: Introduction to Computer Science Hunter College, City University of New York

Exam 3 Chapters 7 & 9

CPE 112 Spring 2015 Exam III (100 pts) April 8, True or False (12 Points)

Tutorial Letter 103/1/2017 Introduction to Programming I

VARIABLES & ASSIGNMENTS

True or False (12 Points)

CS 216 Exam 1 Fall SOLUTION

Lecture 23: Pointer Arithmetic

Add Subtract Multiply Divide

FORM 1 (Please put your name and form # on the scantron!!!!) CS 161 Exam I: True (A)/False(B) (2 pts each):

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

EECS402 Lecture 02. Functions. Function Prototype

Jordan University of Science & Technology Department of Computer Science CS 211 Exam #1 (23/10/2010) -- Form A

Basic program The following is a basic program in C++; Basic C++ Source Code Compiler Object Code Linker (with libraries) Executable

Programming Language. Functions. Eng. Anis Nazer First Semester

Objectives. In this chapter, you will:

Faculty of Science, Engineering and Technology

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

Functions, Arrays & Structs

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

Agenda. The main body and cout. Fundamental data types. Declarations and definitions. Control structures

Multiple Choice Questions (20 questions * 5 points per question = 100 points)

CS101 PLEDGED SPRING 2001

Chapter 6: User-Defined Functions. Objectives (cont d.) Objectives. Introduction. Predefined Functions 12/2/2016

Multiple Choice Questions (20 questions * 6 points per question = 120 points)

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

Problem Solving: Storyboards for User Interaction

Summary of basic C++-commands

Introduction to Programming EC-105. Lecture 2

CS 101 Computer Programming and utilization. Dr Deepak B Phatak Subrao Nilekani Chair Professor Department of CSE, Kanwal Rekhi Building IIT Bombay

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

CSCI 111 First Midterm Exam Spring Solutions 09.05am 09.55am, Wednesday, March 14, 2018

Overview. - General Data Types - Categories of Words. - Define Before Use. - The Three S s. - End of Statement - My First Program

CSCI 111 Midterm 2 Exam Spring Solutions 09.00am 09.50am, Wednesday, May 04, 2016

Week 4 EECS 183 MAXIM ALEKSA. maximal.io

CSCE 110 PROGRAMMING FUNDAMENTALS

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

CSC 126 FINAL EXAMINATION FINAL Spring 2012 B. Name (last, First) Instructor. Total Possible. Received

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

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

1. Word Analysis: (Which nouns suggest a need for memory (a variable) and which verbs suggest a need for action (a function maybe).

Name Section: M/W or T/TH. True or False (14 Points)

CSCE 206: Structured Programming in C++

CSCE 206: Structured Programming in C++

Transcription:

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 * Do not turn this page until asked to do so. * Exam time is 75 minutes. * Put the answers on the same question sheet, do not use any additional papers, even for scratch. * Write your name, ID, section no. in the indicated places. * Read the exam instructions. * Read the honesty policy. * Sign the following statement. Academic Integrity Policy Cheating in Exams is a violation of the Academic Integrity policy of AUC. Whispering, talking, looking at someone else s paper, or copying from any source is considered cheating. Any one who does any of these actions or her/his answers indicates that she/he did any of them, will receive a punishment ranging from zero in this exam to failing the course. If repeated, it may lead to dismissal from AUC. I have read the honesty policy and exam instructions and I am presenting this exam as entirely my effort. Signature: --------------------------------------------------------------------------------------------------------------------------- DO NOT USE THIS SECTION Question Points Grade 1 20 2 20 3 10 4 20 5 30 Total 100 1

Question 1 (20 points) a. A result of (CD)16 was was produced in an accumulator of 8-bit structure. Give the value of this result in decimal notation for each of the following cases: 1. The computer is performing its operations in two s complement integer format: 2. The computer is performing its operations in sign-magnitute integer format: b. Subtract 35 from 17 using 8-bit two s complement computation. c. Perform the following conversion operations to the number systems indicated: (1100)10 = ( )2 = ( )16 2

Question 2 (20 points) Trace the following C++ program; i.e., show the effect of each numbered statement using the given table. #include <iostream> #include <cmath> using namespace std; void main () { float a = 1.5, b = 4.0, c = 2.5; // statement 1 int x = 5, y = 3.5, z, s, t; // statement 2 const int two = 2; // statement 3 c = (x + y) / x * a; // statement 4 z = y % x + sqrt(b); // statement 5 if (x % y == 0) // statement 6 s = (two * b + pow(x, y)) / (two * b); // statement 7 else s = (two * b + pow(y, two)) / (two * b); // statement 8 t = y / x * a + two * pow(two, y); // statement 9 } cout << z = << z << endl; // statement 10 cout << c = << c << endl; // statement 11 cout << s = << s << endl; // statement 12 cout << t = << t << endl; // statement 13 Use the following table to trace the given program (i.e., to plot the value of different variables as instructions are executed one after the other and finally showing the output). Statement Number 1 2 3 4 5 6 7 8 9 10 11 12 13 a b c x y z s t 3

Question 3 (10 points) Draw the evaluation tree for the following expressions: r = ( -b + a * c ) / ( 2 * a ) Question 4 (20 points) The following C++ program takes a positive integer number less than 16 and displays its equivalent binary value. There are some missings (represented by dots) in the given program. Complete these missings such that the program could be compiled and run correctly. # include <iostream> using namespace std; void main () { // Declaration int num, d8, d4, d2, d1, rem; const int eight = 8;..; const int two = 2; // Input cout << Enter a positive integer lest than 16: << endl; cin >> num; // Processing d8 =....; rem =....; d4 =. ; rem =.; d2 =.. ; d1 =..; // Output cout << The Equivalent Binary: <<.. <<.. <<.. <<.. << endl; } 4

Question 5 (30 points) Solve (A) or (B) (A) Draw a Flow chart and write a complete C++ program that asks the user to enter integer number greater than or equal to 0 and less than 1000. The program has to check the entered number and if it is less than 10, write out the words ONE DIGIT BIG!, If it is between 10 and 99, write out the words TWO DIGITS BIG! and if the user s number is greater than 99, write out the phrase THREE DIGITS BIG!. Be sure to use proper formatting and appropriate comments in your code. The output should be clearly labeled. Show the three phases of software development: the analysis, design (draw a Flow Chart), and implementation. (B) In some computer applications, the birthdate of a person is represented as one integer number of six digits according to the format DDMMYY, where DD is the day, MM is the month, and YY is the year of birth. For example, the integer number 231185 is a birthdate of a person, where 23 is the day of his/her birth, 11 is the month, and 85 is the year. Write a C++ program that takes the birthdate of a person as one integer number of six digits according to the previous format and outputs the day, month, and year of birth, each on a separate line. Be sure to use proper formatting and appropriate comments in your code. The output should be clearly labeled. Show the three phases of software development: the analysis, design (draw a Flow Chart), and implementation. The Analysis 5

6 The Flow Chart

The Program Good Luck 7