1. What is the minimum number of bits needed to store a single piece of data representing: a. An integer between 0 and 100?
|
|
- Paula Brooks
- 6 years ago
- Views:
Transcription
1 1 CS 105 Review Questions Most of these questions appeared on past exams. 1. What is the minimum number of bits needed to store a single piece of data representing: a. An integer between 0 and 100? b. An integer between 1600 and 2000? c. A U.S. state? d. One of the 200 billion stars in the Milky Way galaxy? e. A Chinese character, assuming that 10,000 different characters exist? f. A room in a large hotel? (Please indicate how many rooms you are assuming.) 2. Convert these hexadecimal numbers into binary and octal. a. 0xBEEF b. 0x7c c. 0xff d. 0x33ff99 3. Convert the following values to binary and hexadecimal. a. ( ) + ( ) + ( ) + ( ) b Convert the following into hexadecimal: a. The octal number b. The binary number Convert the following into octal and hexadecimal: a. The binary number b. The decimal number 87.
2 2 6. The highest digit in hexadecimal is, and its value is. 7. The contents of sixteen bytes of data can be described by how many hexadecimal digits? 8. Suppose a binary number needs 7 bits to be represented. In other words, 6 bits would not be enough and 8 bits are not necessary. If this number is written in hexadecimal, what is the first (leftmost) digit? 9. Suppose x is a 30-bit binary number, and y is a 32-bit binary number. If the first 30 bits of y are the same as x, and the last two bits of y are 11, then what is the relationship between the values of x and y? 10. Explain how a computer program can be written in such a way that sometimes it runs correctly, but other times it emits a run-time error, depending on the input data. 11. Suppose that L is the name of a list of ten numbers in a Python program. Write an expression that finds the sum of the first number and last number in the list. 12. Describe in English an algorithm for determining how many times the letter T (capital or lowercase) appears in a sentence. 13. How could we design a program to count the number of words in a sentence? 14. What is wrong with the following Python code that attempts to find the smallest number in a list? min = 0 for number in L: if number < min: number = min a. Show how you would fix the code. b. Show how you would change the code so that we also indicate the location of the smallest number.
3 3 15. What is the difference between a computer program and an algorithm? Which one is generally created first in the problem-solving procedure? 16. Define the following terms: a. Iteration b. Algorithm c. Logical error d. Machine language e. Software f. Variable 17. A simple program usually consists of three phases:, followed by, followed by. 18. Describe the steps necessary in the computer problem-solving procedure. Identify an obstacle that could occur at each step. 19. Write a Python statement that will subtract 5 from the variable count and put the result in a new variable called adjusted_count. 20. Suppose w is a string variable containing a word. a. Show in pseudocode how you would determine whether the letter z appears in w. b. How would your answer to the previous question change if we wanted to know the number of times the letter z appears? c. Assuming that the word w contains at least one letter z, show in pseudocode how you would determine the location of the first z in w. 21. Show in pseudocode how you would get the computer to print the numbers from 1 to 26, using a loop. How would you change your answer if we wanted to print the numbers in reverse order?
4 4 22. Consider the following Python code: number = int(input( Please enter a number )) if : valid = True else: valid = False Notice that the above code will set the variable valid to True if some condition (as yet unspecified) satisfies a certain condition. For each of the following cases, indicate what condition we should enter in the blank in order for the variable valid to be set to True. In all cases, assume that the number entered is an integer. a. The number is a positive 3-digit number. b. The number is between 18 and 65 inclusive. c. The number is not between 18 and 65 inclusive. d. The number is positive. e. The number is a multiple of 5, but not a multiple of 4. f. The number is an odd number. g. The number is 7, 11 or 13. h. The number is not 7, 11 or Given a number of cents (anywhere from 1 to 99), write an algorithm to determine the appropriate change, i.e. the number of quarters, dimes, nickels, and pennies. 24. In Python, what does it mean when a line begins with a #? What is the purpose? 25. What is the output of this Python code? for i in range (2, 8): print (i) 26. The following Python code attempts to find the largest and smallest numbers in a list L. However, I forgot to indent some lines. Show how we should indent the statements. max = L[0] min = L[0] for num in L:
5 5 if num > max: max = num if num < min: min = num print ( The max is + str(max) + and the min is + str(min) +. ) 27. What are the values of these Python expressions? a. 14 / 5 b. 14 % What is the output as the following Python loop executes? for i in range (1, 11): print (22 2 * i) 29. What is the output as the following Python code executes? L = [ 4, 7, 2 ] for num in L: print (num) print ( A ) print ( B ) 30. What type of computer error results when we ask the computer to perform an illegal operation such as taking the square root of a negative number, causing the program to immediately halt? 31. Describe in English how we would design a computer program that solves this problem: Ask the user for the lengths of the three sides of a triangle, and determine if it is isosceles. 32. Suppose we want to know if the Python variable num is divisible by either 7 or 11. The following if-statement has been written incorrectly. Show what the mistake(s) is/are, and rewrite the statement correctly. if num % 7 or 11 = 0:
6 6 33. The computer problem-solving procedure can be divided into five steps. They are given below, but they are out of order. Indicate the correct order of these steps: a. The computer program is translated into machine language b. We describe how to solve the program in English c. Test the program to see if it gives the correct output d. Type the program into the computer. e. Make sure we understand the problem specification. 34. A leap year occurs when the year number (e.g. 1984) is divisible by 4. But there is a special case for years ending in 00: these must be divisible by 400 to be considered a leap year. Thus, 1900 was not a leap year, but 2000 was. Write an if-statement that determines if the integer variable year represents a leap year. Hint: use the % operator for taking remainders. 35. The following code attempts to count how many times the capital letter R appears in a string called word. But there is a mistake in the code. Why will the code not work as is? How should the mistake be corrected? for c in word: count = 0 if c == 'R' : count = count + 1 print count 36. What should be written at the beginning of a computer program in order to assist a person who may want to read and understand your program? a. Assignment statement b. Comment c. Input statement d. Output statement 37. An algorithm is. a. a problem that we wish to solve using the computer b. the solution to a problem that is solved by computer c. a language used for writing instructions d. the set of all mathematical operations available on a computer 38. In Python, what keyword introduces a block of code that is meant to be executed repeatedly?
7 7 39. The following Python program attempts convert a time in Denver to a time in Atlanta by adding 2 hours. However, it does not work in some cases. Show how you would fix the program. hour = int(input( Enter Denver hour )) min = int(input( Enter Denver minute )) hour = hour + 2 if min < 10: print ( The time in Atlanta is + str(hour) + :0 + str(min)) else: print ( The time in Atlanta is + str(hour) + : + str(min)) 40. Consider these two Python programs. L = [ 6,7,2,4,9,8,1,7,3,2,5,3,1,7 ] L = [ 6,7,2,4,9,8,1,7,3,2,5,3,1,7 ] found = false location = 0 for i in range (0,len(L) 1): for i in range(0, len(l)): if L[i] == L[i+1]: if L[i] == 7: found == true location = i break break print (found) print (location) a. What does each program accomplish? In other words, state each program s purpose. b. In each program, what would happen if we took out the break statement? Would it make any difference in the output? 41. Define each of the following types of programming errors, and describe the behavior the computer would exhibit to indicates to us that our program has this kind of error. a. Syntax error b. Logical error c. Run-time error 42. When someone is designing software, what step should take place after the algorithm has been discovered? a. compile the program to check for errors b. pipeline the operations to make the program run faster c. write the program in a programming language
8 8 d. run the program to make sure it gives the correct output e. fetch the next instruction from memory f. save the program to disk 43. What is the value of the variable sum after the following code executes? sum = 0 number = 1 while number <= 10: sum = sum + number number = number Consider the following algorithm. list[0] = 2; list[1] = 3; list[2] = 0; list[3] = 4; list[4] = 1; target = 3 for count = 0 to 4 do: if (target is equal to list[count]) location = count count = count + 1 What is the value of the variable location when this algorithm is finished? 45. Suppose a computer program contains an instruction to open a file for reading. However, this file does not exist. What sort of error does this represent? 46. Suppose you just finished typing in a computer program. But one of the lines that reads if x > 0 should instead be if x < 0, because you had meant to look for a negative number. What type of error is this? 47. The following algorithm attempts to solve the following problem. We have a list of 10 playing cards, and we want to count how many are face cards (jack/queen/king), and print out this number. But there is one mistake. What is it? Assume that the cards have already been initialized in the list. (1) facecard = 0 (2) for count = 0 to 9 (3) if (list[count] is jack, queen or king) (4) facecard = facecard + 1 (5) count = count + 1 (6) print the value of count a. On line 1, facecard should be set to 1 instead of 0. b. On line 2, the 9 should be changed to 10. c. On line 2, the 0 should be changed to 1. d. Lines 4 and 5 should be reversed. e. On line 6, count should be replaced with facecard. f. On line 6, the statement should appear inside the loop, not after it.
9 9 48. What is the difference between an algorithm and a computer program? 49. For each of the following quantities, indicate the appropriate data type. Your choices are int, float, boolean and string. a. the length of a fish in inches b. the number of people on a train c. whether a job applicant has a college degree or not d. the exact number of gallons of gasoline consumed after driving 100 miles e. the user s complete street address f. the number of pounds of rice used in a recipe g. the number of television sets in a house 50. Complete the following if-statement so that it checks to see if the integer value n is between 1 and 12 inclusive. if : 51. Suppose s is a string variable in a Python program. Let s determine if the last two characters in s are the same. Fill in the blank for this if-statement. if : 52. Suppose that n is a variable in a Python program containing a positive integer. Let s determine if this value ends in the digits 65. For example, numbers such as 265, 1965, 99965, etc. Fill in the blank for the if-statement. if : 53. If we were to write out the number 25 million into binary, how many bits would be necessary?
10 Convert the decimal number 44 into binary. 55. Convert the binary number into decimal, octal, and hexadecimal. 56. Consider the following Python code. What is the output when it runs? n = 0 while n <= 12: print(n) n = n Suppose that s is a string variable. Using Python code or pseudo-code, show how we can determine how many times the capital letter A appears in s. 58. For each of the following examples of computer errors, classify it as logical, run-time, or syntax error. a. Writing an assignment statement backwards, as in 3 = c. b. Unnecessarily putting quotation marks around integers when you want to add them, as in concatenating the strings resulting in 84 when instead you wanted = 12. c. Forgetting the closing right parenthesis ) when using the range function. d. Asking if the value of n % 6 equals 8. e. Using the int function on a string that is not an integer, such as int( five ) f. Printing the numbers from 1 to 11, when you had intended to print 1 to 10. g. Forgetting to put a # symbol before a comment.
11 Suppose the Python variables a and b are initialized as follows. Are they equal? If not, which variable contains the larger value? a = 2 ** 2 ** 3 b = 2 ** 3 ** What is the simplified value of this Python expression? 7 // % 5 * What is the output of the following Python code? L = [ 4, 5, 6, 7, 8 ] L.remove(7) print(l) L.insert(3, 0) print(l) 62. Suppose that s is a string variable in Python. This string contains: Silicon Gold. Note that the string does not include the quotes but does include a space between the two words. Indicate the value of the following expressions: a. s[4] b. s[ 4] c. s[2 : 5] d. s[ : : 2] e. s[ : 3] 63. The following code attempts to determine if a list contains an odd number. However, it contains a mistake. Show how you would fix the error. L = [ 3, 4, 7, 9, 12, 8, 5, 6 ] for num in L: if num % 2 == 1: found = True else: found = False
12 64. What is the output as the following Python loop executes? L = [ 4, 7, 2] for num in L: print(num) print("a") print("b") 12
LOOPS. Repetition using the while statement
1 LOOPS Loops are an extremely useful feature in any programming language. They allow you to direct the computer to execute certain statements more than once. In Python, there are two kinds of loops: while
More informationProfessor: Sana Odeh Lecture 3 Python 3.1 Variables, Primitive Data Types & arithmetic operators
1 Professor: Sana Odeh odeh@courant.nyu.edu Lecture 3 Python 3.1 Variables, Primitive Data Types & arithmetic operators Review What s wrong with this line of code? print( He said Hello ) What s wrong with
More informationDEPARTMENT OF MATHS, MJ COLLEGE
T. Y. B.Sc. Mathematics MTH- 356 (A) : Programming in C Unit 1 : Basic Concepts Syllabus : Introduction, Character set, C token, Keywords, Constants, Variables, Data types, Symbolic constants, Over flow,
More informationLesson 5: Introduction to the Java Basics: Java Arithmetic THEORY. Arithmetic Operators
Lesson 5: Introduction to the Java Basics: Java Arithmetic THEORY Arithmetic Operators There are four basic arithmetic operations: OPERATOR USE DESCRIPTION + op1 + op2 Adds op1 and op2 - op1 + op2 Subtracts
More informationPython allows variables to hold string values, just like any other type (Boolean, int, float). So, the following assignment statements are valid:
1 STRINGS Objectives: How text data is internally represented as a string Accessing individual characters by a positive or negative index String slices Operations on strings: concatenation, comparison,
More informationComputer Science Foundation Exam. December 15, Section I A. No Calculators! Name: SSN:
Computer Science Foundation Exam December 15, 1999 Section I A No Calculators! Name: SSN: In this section of the exam, there are three (3) problems. You must do all of them. The weight of each problem
More informationNumber representations
Number representations Number bases Three number bases are of interest: Binary, Octal and Hexadecimal. We look briefly at conversions among them and between each of them and decimal. Binary Base-two, or
More informationCSc 10200! Introduction to Computing. Lecture 2-3 Edgardo Molina Fall 2013 City College of New York
CSc 10200! Introduction to Computing Lecture 2-3 Edgardo Molina Fall 2013 City College of New York 1 C++ for Engineers and Scientists Third Edition Chapter 2 Problem Solving Using C++ 2 Objectives In this
More informationFull file at
Java Programming: From Problem Analysis to Program Design, 3 rd Edition 2-1 Chapter 2 Basic Elements of Java At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class
More informationPrimitive Data, Variables, and Expressions; Simple Conditional Execution
Unit 2, Part 1 Primitive Data, Variables, and Expressions; Simple Conditional Execution Computer Science S-111 Harvard University David G. Sullivan, Ph.D. Overview of the Programming Process Analysis/Specification
More informationIntroduction to Java Applications
2 Introduction to Java Applications OBJECTIVES In this chapter you will learn: To write simple Java applications. To use input and output statements. Java s primitive types. Basic memory concepts. To use
More informationPython Numbers. Learning Outcomes 9/19/2012. CMSC 201 Fall 2012 Instructor: John Park Lecture Section 01 Discussion Sections 02-08, 16, 17
Python Numbers CMSC 201 Fall 2012 Instructor: John Park Lecture Section 01 Discussion Sections 02-08, 16, 17 1 (adapted from Meeden, Evans & Mayberry) 2 Learning Outcomes To become familiar with the basic
More informationFundamentals. Fundamentals. Fundamentals. We build up instructions from three types of materials
Fundamentals We build up instructions from three types of materials Constants Expressions Fundamentals Constants are just that, they are values that don t change as our macros are executing Fundamentals
More information1. What type of error produces incorrect results but does not prevent the program from running? a. syntax b. logic c. grammatical d.
Gaddis: Starting Out with Python, 2e - Test Bank Chapter Two MULTIPLE CHOICE 1. What type of error produces incorrect results but does not prevent the program from running? a. syntax b. logic c. grammatical
More informationCMPT 120 Control Structures in Python. Summer 2012 Instructor: Hassan Khosravi
CMPT 120 Control Structures in Python Summer 2012 Instructor: Hassan Khosravi The If statement The most common way to make decisions in Python is by using the if statement. The if statement allows you
More informationExpressions and Variables
Expressions and Variables Expressions print(expression) An expression is evaluated to give a value. For example: 2 + 9-6 Evaluates to: 5 Data Types Integers 1, 2, 3, 42, 100, -5 Floating points 2.5, 7.0,
More informationIntro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming
Intro to Programming Unit 7 Intro to Programming 1 What is Programming? 1. Programming Languages 2. Markup vs. Programming 1. Introduction 2. Print Statement 3. Strings 4. Types and Values 5. Math Externals
More informationCHAPTER 2 Number Systems
CHAPTER 2 Number Systems Objectives After studying this chapter, the student should be able to: Understand the concept of number systems. Distinguish between non-positional and positional number systems.
More informationThe C++ Language. Arizona State University 1
The C++ Language CSE100 Principles of Programming with C++ (based off Chapter 2 slides by Pearson) Ryan Dougherty Arizona State University http://www.public.asu.edu/~redoughe/ Arizona State University
More informationChapter 5 Conditional and Iterative Statements. Statement are the instructions given to the computer to perform any kind of action.
Chapter 5 Conditional and Iterative Statements Statement Statement are the instructions given to the computer to perform any kind of action. Types of Statement 1. Empty Statement The which does nothing.
More informationIntroduction. Arizona State University 1
Introduction CSE100 Principles of Programming with C++, Fall 2018 (based off Chapter 1 slides by Pearson) Ryan Dougherty Arizona State University http://www.public.asu.edu/~redoughe/ Arizona State University
More informationOutline. policies. with some potential answers... MCS 260 Lecture 19 Introduction to Computer Science Jan Verschelde, 24 February 2016
Outline 1 midterm exam on Friday 26 February 2016 policies 2 questions with some potential answers... MCS 260 Lecture 19 Introduction to Computer Science Jan Verschelde, 24 February 2016 Intro to Computer
More informationAppendix 2 Number Representations
Appendix 2 Number Representations There are many different ways to represent whole numbers. While we are comfortable counting in decimal (0,1,2,3,4,5,6,7,8,9,10,11,12, ), that is only one set of names
More information2.1. Chapter 2: Parts of a C++ Program. Parts of a C++ Program. Introduction to C++ Parts of a C++ Program
Chapter 2: Introduction to C++ 2.1 Parts of a C++ Program Copyright 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 2-1 Parts of a C++ Program Parts of a C++ Program // sample C++ program
More informationOverview of C. Basic Data Types Constants Variables Identifiers Keywords Basic I/O
Overview of C Basic Data Types Constants Variables Identifiers Keywords Basic I/O NOTE: There are six classes of tokens: identifiers, keywords, constants, string literals, operators, and other separators.
More informationMemory Addressing, Binary, and Hexadecimal Review
C++ By A EXAMPLE Memory Addressing, Binary, and Hexadecimal Review You do not have to understand the concepts in this appendix to become well-versed in C++. You can master C++, however, only if you spend
More informationC++ Programming: From Problem Analysis to Program Design, Third Edition
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 2: Basic Elements of C++ Objectives (continued) Become familiar with the use of increment and decrement operators Examine
More informationUNIT - I. Introduction to C Programming. BY A. Vijay Bharath
UNIT - I Introduction to C Programming Introduction to C C was originally developed in the year 1970s by Dennis Ritchie at Bell Laboratories, Inc. C is a general-purpose programming language. It has been
More informationCEN 414 Java Programming
CEN 414 Java Programming Instructor: H. Esin ÜNAL SPRING 2017 Slides are modified from original slides of Y. Daniel Liang WEEK 2 ELEMENTARY PROGRAMMING 2 Computing the Area of a Circle public class ComputeArea
More informationREVIEW. The C++ Programming Language. CS 151 Review #2
REVIEW The C++ Programming Language Computer programming courses generally concentrate on program design that can be applied to any number of programming languages on the market. It is imperative, however,
More informationVariable and Data Type I
The Islamic University of Gaza Faculty of Engineering Dept. of Computer Engineering Intro. To Computers (LNGG 1003) Lab 2 Variable and Data Type I Eng. Ibraheem Lubbad February 18, 2017 Variable is reserved
More informationGateway Regional School District VERTICAL ALIGNMENT OF MATHEMATICS STANDARDS Grades 3-6
NUMBER SENSE & OPERATIONS 3.N.1 Exhibit an understanding of the values of the digits in the base ten number system by reading, modeling, writing, comparing, and ordering whole numbers through 9,999. Our
More informationCS & IT Conversions. Magnitude 10,000 1,
CS & IT Conversions There are several number systems that you will use when working with computers. These include decimal, binary, octal, and hexadecimal. Knowing how to convert between these number systems
More informationReview: Exam 1. Your First C++ Program. Declaration Statements. Tells the compiler. Examples of declaration statements
Review: Exam 1 9/20/06 CS150 Introduction to Computer Science 1 1 Your First C++ Program 1 //*********************************************************** 2 // File name: hello.cpp 3 // Author: Shereen Khoja
More informationReviewing all Topics this term
Today in CS161 Prepare for the Final Reviewing all Topics this term Variables If Statements Loops (do while, while, for) Functions (pass by value, pass by reference) Arrays (specifically arrays of characters)
More informationComputer Programming, I. Laboratory Manual. Experiment #2. Elementary Programming
Think Twice Code Once The Islamic University of Gaza Engineering Faculty Department of Computer Engineering Fall 2017 ECOM 2005 Khaleel I. Shaheen Computer Programming, I Laboratory Manual Experiment #2
More informationWeek One: Introduction A SHORT INTRODUCTION TO HARDWARE, SOFTWARE, AND ALGORITHM DEVELOPMENT
Week One: Introduction A SHORT INTRODUCTION TO HARDWARE, SOFTWARE, AND ALGORITHM DEVELOPMENT Outline In this chapter you will learn: About computer hardware, software and programming How to write and execute
More informationCMSC 201 Fall 2016 Lab 09 Advanced Debugging
CMSC 201 Fall 2016 Lab 09 Advanced Debugging Assignment: Lab 09 Advanced Debugging Due Date: During discussion Value: 10 points Part 1: Introduction to Errors Throughout this semester, we have been working
More informationChapter 2: Overview of C++
Chapter 2: Overview of C++ Problem Solving, Abstraction, and Design using C++ 6e by Frank L. Friedman and Elliot B. Koffman C++ Background Introduced by Bjarne Stroustrup of AT&T s Bell Laboratories in
More informationUNIT- 3 Introduction to C++
UNIT- 3 Introduction to C++ C++ Character Sets: Letters A-Z, a-z Digits 0-9 Special Symbols Space + - * / ^ \ ( ) [ ] =!= . $, ; : %! &? _ # = @ White Spaces Blank spaces, horizontal tab, carriage
More informationQ1 Q2 Q3 Q4 Q5 Total 1 * 7 1 * 5 20 * * Final marks Marks First Question
Page 1 of 6 Template no.: A Course Name: Computer Programming1 Course ID: Exam Duration: 2 Hours Exam Time: Exam Date: Final Exam 1'st Semester Student no. in the list: Exam pages: Student's Name: Student
More informationTopic 2: Introduction to Programming
Topic 2: Introduction to Programming 1 Textbook Strongly Recommended Exercises The Python Workbook: 12, 13, 23, and 28 Recommended Exercises The Python Workbook: 5, 7, 15, 21, 22 and 31 Recommended Reading
More informationObjectives. In this chapter, you will:
Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates arithmetic expressions Learn about
More informationComputer Science 217
Computer Science 217 Midterm Exam Fall 2012 November 1, 2012 Name: ID: Class Time (Circle One): 1:00pm 3:00pm Instructions: Neatly print your name and ID number in the spaces provided above. Pick the best
More informationKadi Sarva Vishwavidyalaya, Gandhinagar
Kadi Sarva Vishwavidyalaya, Gandhinagar MASTERS OF COMPUTER APPLICATION (MCA) Semester I (First Year) Subject: MCA-101 Programming for Logic Building (LDPL) SUB Teaching scheme Examination scheme Total
More informationObjectives. Chapter 2: Basic Elements of C++ Introduction. Objectives (cont d.) A C++ Program (cont d.) A C++ Program
Objectives Chapter 2: Basic Elements of C++ In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates
More informationChapter 2: Basic Elements of C++
Chapter 2: Basic Elements of C++ Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates
More informationObjectives. Connecting with Computer Science 2
Objectives Learn why numbering systems are important to understand Refresh your knowledge of powers of numbers Learn how numbering systems are used to count Understand the significance of positional value
More informationUnit-II Programming and Problem Solving (BE1/4 CSE-2)
Unit-II Programming and Problem Solving (BE1/4 CSE-2) Problem Solving: Algorithm: It is a part of the plan for the computer program. An algorithm is an effective procedure for solving a problem in a finite
More informationCS 1301 Exam 1 Answers Fall 2009
Page 1/6 CS 1301 Fall 2009 Exam 1 Your Name: I commit to uphold the ideals of honor and integrity by refusing to betray the trust bestowed upon me as a member of the Georgia Tech community. CS 1301 Exam
More informationENGR 101 Engineering Design Workshop
ENGR 101 Engineering Design Workshop Lecture 2: Variables, Statements/Expressions, if-else Edgardo Molina City College of New York Literals, Variables, Data Types, Statements and Expressions Python as
More informationChapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction
Chapter 2: Basic Elements of C++ C++ Programming: From Problem Analysis to Program Design, Fifth Edition 1 Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers
More information\n is used in a string to indicate the newline character. An expression produces data. The simplest expression
Chapter 1 Summary Comments are indicated by a hash sign # (also known as the pound or number sign). Text to the right of the hash sign is ignored. (But, hash loses its special meaning if it is part of
More informationGE PROBLEM SOVING AND PYTHON PROGRAMMING. Question Bank UNIT 1 - ALGORITHMIC PROBLEM SOLVING
GE8151 - PROBLEM SOVING AND PYTHON PROGRAMMING Question Bank UNIT 1 - ALGORITHMIC PROBLEM SOLVING 1) Define Computer 2) Define algorithm 3) What are the two phases in algorithmic problem solving? 4) Why
More informationBASIC ELEMENTS OF A COMPUTER PROGRAM
BASIC ELEMENTS OF A COMPUTER PROGRAM CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING LOGO Contents 1 Identifier 2 3 Rules for naming and declaring data variables Basic data types 4 Arithmetic operators
More informationCS159. Nathan Sprague. November 9, 2015
CS159 Nathan Sprague November 9, 2015 Recursive Definitions Merriam Websters definition of Ancestor: Ancestor One from whom a person is descended [...] Here is a recursive version: Ancestor One s parent.
More informationComputer Science 217
Computer Science 217 Midterm Exam October 29, 2014 First Name: Last Name: ID: Class Time (Circle One): 1:00pm 3:00pm Instructions: Neatly print your names and ID number in the spaces provided above. Pick
More informationComputer Science 217
Computer Science 17 Midterm Exam March 5, 014 Exam Number 1 First Name: Last Name: ID: Class Time (Circle One): 1:00pm :00pm Instructions: Neatly print your names and ID number in the spaces provided above.
More informationCS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.
CS 265 Computer Architecture Wei Lu, Ph.D., P.Eng. CS 265 Midterm #1 Monday, Oct 18, 12:00pm-1:45pm, SCI 163 Questions on essential terms and concepts of Computer Architecture Mathematical questions on
More informationChapter 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 informationAlgorithm Discovery and Design. Why are Algorithms Important? Representing Algorithms. Chapter 2 Topics: What language to use?
Algorithm Discovery and Design Chapter 2 Topics: Representing Algorithms Algorithmic Problem Solving CMPUT101 Introduction to Computing (c) Yngvi Bjornsson & Jia You 1 Why are Algorithms Important? If
More informationLe L c e t c ur u e e 2 To T p o i p c i s c t o o b e b e co c v o e v r e ed e Variables Operators
Course Name: Advanced Java Lecture 2 Topics to be covered Variables Operators Variables -Introduction A variables can be considered as a name given to the location in memory where values are stored. One
More informationChapter 5 Conditional and Iterative Statements (Part-II) To carry out repetitive task, python provides following iterative/looping statements:
Chapter 5 Conditional and Iterative Statements (Part-II) Iterative Statements To carry out repetitive task, python provides following iterative/looping statements: 1. Conditional loop while (condition
More informationADARSH VIDYA KENDRA NAGERCOIL COMPUTER SCIENCE. Grade: IX C++ PROGRAMMING. Department of Computer Science 1
NAGERCOIL COMPUTER SCIENCE Grade: IX C++ PROGRAMMING 1 C++ 1. Object Oriented Programming OOP is Object Oriented Programming. It was developed to overcome the flaws of the procedural approach to programming.
More informationProgram Development. Java Program Statements. Design. Requirements. Testing. Implementation
Program Development Java Program Statements Selim Aksoy Bilkent University Department of Computer Engineering saksoy@cs.bilkent.edu.tr The creation of software involves four basic activities: establishing
More informationOWEN COMPUTER SCIENCE LESSONS L2RVW4 Pg 1. Lesson 2 Review #4. Matching. Match each description to the correct data type.
OWEN COMPUTER SCIENCE LESSONS 2014-2015 L2RVW4 Pg 1 Lesson 2 Review #4 Name Matching Match each description to the correct data type. a. int e. short b. float f. long c. double g. char d. byte 1. up to
More informationComputer Programming : C++
The Islamic University of Gaza Engineering Faculty Department of Computer Engineering Fall 2017 ECOM 2003 Muath i.alnabris Computer Programming : C++ Experiment #1 Basics Contents Structure of a program
More informationStatistics Case Study 2000 M. J. Clancy and M. C. Linn
Statistics Case Study 2000 M. J. Clancy and M. C. Linn Problem Write and test functions to compute the following statistics for a nonempty list of numeric values: The mean, or average value, is computed
More informationProgramming. We will be introducing various new elements of Python and using them to solve increasingly interesting and complex problems.
Plan for the rest of the semester: Programming We will be introducing various new elements of Python and using them to solve increasingly interesting and complex problems. We saw earlier that computers
More information2 Number Systems 2.1. Foundations of Computer Science Cengage Learning
2 Number Systems 2.1 Foundations of Computer Science Cengage Learning 2.2 Objectives After studying this chapter, the student should be able to: Understand the concept of number systems. Distinguish between
More informationMobile Computing Professor Pushpendra Singh Indraprastha Institute of Information Technology Delhi Java Basics Lecture 02
Mobile Computing Professor Pushpendra Singh Indraprastha Institute of Information Technology Delhi Java Basics Lecture 02 Hello, in this lecture we will learn about some fundamentals concepts of java.
More information1 Truth. 2 Conditional Statements. Expressions That Can Evaluate to Boolean Values. Williams College Lecture 4 Brent Heeringa, Bill Jannen
1 Truth Last lecture we learned about the int, float, and string types. Another very important object type in Python is the boolean type. The two reserved keywords True and False are values with type boolean.
More information19 Much that I bound, I could not free; Much that I freed returned to me. Lee Wilson Dodd
19 Much that I bound, I could not free; Much that I freed returned to me. Lee Wilson Dodd Will you walk a little faster? said a whiting to a snail, There s a porpoise close behind us, and he s treading
More informationDatatypes, Variables, and Operations
Datatypes, Variables, and Operations 1 Primitive Type Classification 2 Numerical Data Types Name Range Storage Size byte 2 7 to 2 7 1 (-128 to 127) 8-bit signed short 2 15 to 2 15 1 (-32768 to 32767) 16-bit
More informationReal Numbers finite subset real numbers floating point numbers Scientific Notation fixed point numbers
Real Numbers We have been studying integer arithmetic up to this point. We have discovered that a standard computer can represent a finite subset of the infinite set of integers. The range is determined
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.
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 informationDigital Logic. The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer.
Digital Logic 1 Data Representations 1.1 The Binary System The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer. The system we
More informationUnit 3. Operators. School of Science and Technology INTRODUCTION
INTRODUCTION Operators Unit 3 In the previous units (unit 1 and 2) you have learned about the basics of computer programming, different data types, constants, keywords and basic structure of a C program.
More informationAn Introduction to Python (TEJ3M & TEJ4M)
An Introduction to Python (TEJ3M & TEJ4M) What is a Programming Language? A high-level language is a programming language that enables a programmer to write programs that are more or less independent of
More informationLecture 3 Tao Wang 1
Lecture 3 Tao Wang 1 Objectives In this chapter, you will learn about: Arithmetic operations Variables and declaration statements Program input using the cin object Common programming errors C++ for Engineers
More informationUniversity of Technology. Laser & Optoelectronics Engineering Department. C++ Lab.
University of Technology Laser & Optoelectronics Engineering Department C++ Lab. Second week Variables Data Types. The usefulness of the "Hello World" programs shown in the previous section is quite questionable.
More informationNumber Systems MA1S1. Tristan McLoughlin. November 27, 2013
Number Systems MA1S1 Tristan McLoughlin November 27, 2013 http://en.wikipedia.org/wiki/binary numeral system http://accu.org/index.php/articles/1558 http://www.binaryconvert.com http://en.wikipedia.org/wiki/ascii
More information1/11/2010 Topic 2: Introduction to Programming 1 1
Topic 2: Introduction to Programming g 1 1 Recommended Readings Chapter 2 2 2 Computer Programming Gain necessary knowledge of the problem domain Analyze the problem, breaking it into pieces Repeat as
More informationC++ Basic Elements of COMPUTER PROGRAMMING. Special symbols include: Word symbols. Objectives. Programming. Symbols. Symbols.
EEE-117 COMPUTER PROGRAMMING Basic Elements of C++ Objectives General Questions Become familiar with the basic components of a C++ program functions, special symbols, and identifiers Data types Arithmetic
More informationVariable and Data Type I
Islamic University Of Gaza Faculty of Engineering Computer Engineering Department Lab 2 Variable and Data Type I Eng. Ibraheem Lubbad September 24, 2016 Variable is reserved a location in memory to store
More informationSpecial Section: Building Your Own Compiler
cshtp6_19_datastructures_compiler.fm Page 1 Tuesday, February 14, 2017 10:31 AM 1 Chapter 19 Special Section: Building Your Own Compiler In Exercises8.31 8.33, we introduced Simpletron Machine Language
More information[Page 177 (continued)] a. if ( age >= 65 ); cout << "Age is greater than or equal to 65" << endl; else cout << "Age is less than 65 << endl";
Page 1 of 10 [Page 177 (continued)] Exercises 4.11 Identify and correct the error(s) in each of the following: a. if ( age >= 65 ); cout
More informationCS 1301 Exam 1 Fall 2010
CS 1301 Exam 1 Fall 2010 Name : Grading TA: Integrity: By taking this exam, you pledge that this is your work and you have neither given nor received inappropriate help during the taking of this exam in
More informationBCS THE CHARTERED INSTITUTE FOR IT. BCS HIGHER EDUCATION QUALIFICATIONS BCS Level 4 Certificate in IT SOFTWARE DEVELOPMENT
BCS THE CHARTERED INSTITUTE FOR IT BCS HIGHER EDUCATION QUALIFICATIONS BCS Level 4 Certificate in IT SOFTWARE DEVELOPMENT Wednesday 25th March 2015 - Afternoon Time: TWO hours Section A and Section B each
More informationModule 1: Types and Expressions
Module 1: Types and Expressions Ron K. Cytron * Department of Computer Science and Engineering * Washington University in Saint Louis Thanks to Alan Waldman for comments that improved these slides Prepared
More information1 Short Answer (5 Points Each)
COSC 117 Exam #1 Solutions Fall 015 1 Short Answer (5 Points Each) 1. What is the difference between a compiler and an interpreter? Also, discuss Java s method. A compiler will take a program written in
More informationLecture 3. More About C
Copyright 1996 David R. Hanson Computer Science 126, Fall 1996 3-1 Lecture 3. More About C Programming languages have their lingo Programming language Types are categories of values int, float, char Constants
More informationCS 105 Lab As a review of what we did last week a. What are two ways in which the Python shell is useful to us?
1 CS 105 Lab 3 The purpose of this lab is to practice the techniques of making choices and looping. Before you begin, please be sure that you understand the following concepts that we went over in class:
More informationChapter 2 Exercises and Answers
Chapter 2 Exercises and nswers nswers are in blue. For Exercises -5, match the following numbers with their definition.. Number. Natural number C. Integer number D. Negative number E. Rational number unit
More informationSNS COLLEGE OF ENGINEERING,
SNS COLLEGE OF ENGINEERING, COIMBATORE Department of Computer Science and Engineering QUESTION BANK(PART A) GE8151 - PROBLEM SOLVING AND PYTHON PROGRAMMING TWO MARKS UNIT-I 1. What is computer? Computers
More informationBinary, Hexadecimal and Octal number system
Binary, Hexadecimal and Octal number system Binary, hexadecimal, and octal refer to different number systems. The one that we typically use is called decimal. These number systems refer to the number of
More informationCS16 Exam #1 7/17/ Minutes 100 Points total
CS16 Exam #1 7/17/2012 75 Minutes 100 Points total Name: 1. (10 pts) Write the definition of a C function that takes two integers `a` and `b` as input parameters. The function returns an integer holding
More informationCS 2316 Individual Homework 1 Python Practice Due: Wednesday, August 28th, before 11:55 PM Out of 100 points
CS 2316 Individual Homework 1 Python Practice Due: Wednesday, August 28th, before 11:55 PM Out of 100 points Files to submit: 1. HW1.py For Help: - TA Helpdesk Schedule posted on class website. - Email
More informationCaribbean Secondary Education Examination
FORM TP22230 Test Code 012299020 Mock Exam (March) 2013 CARIBBEAN EXAMINATIONS COUNCIL Caribbean Secondary Education Examination INFORMATION TECHNOLOGY PAPER 2 2 Hours March 2013 (a.m.) I N S T R U C T
More informationChapter 3 : Informatics Practices. Class XI ( As per CBSE Board) Python Fundamentals. Visit : python.mykvs.in for regular updates
Chapter 3 : Informatics Practices Class XI ( As per CBSE Board) Python Fundamentals Introduction Python 3.0 was released in 2008. Although this version is supposed to be backward incompatibles, later on
More information