2009 Academic Challenge

Size: px
Start display at page:

Download "2009 Academic Challenge"

Transcription

1 2009 Academic Challenge COMPUTER SCIENCE TEST - REGIONAL This Test Consists of 30 Questions Computer Science Test Production Team Jim Feher, McKendree University Author/Team Leader Barry Bookout, East Central College Author Scott Elliott, John A. Logan College Reviewer Mary Weaver, WYSE Coordinator of Test Production GENERAL DIRECTIONS Please read the following instructions carefully. This is a timed test; any instructions from the test supervisor should be followed promptly. The test supervisor will give instructions for filling in any necessary information on the answer sheet. Most Academic Challenge sites will ask you to indicate your answer to each question by marking an oval that corresponds to the correct answer for that question. Only one oval should be marked to answer each question. Multiple ovals will automatically be graded an incorrect answers. If you wish to change an answer, erase your first mark completely before marking your new choice. You are advised to use your time effectively and to work as rapidly as you can without losing accuracy. Do not waste your time on questions that seem too difficult for you. Go on to the other questions, and then come back to the difficult ones later if time remains. *** TIME: 40 MINUTES *** DO NOT OPEN TEST BOOKLET UNTIL YOU ARE TOLD TO DO SO! 2009 Worldwide Youth in Science and Engineering WYSE, Worldwide Youth in Science and Engineering and the WYSE Design are service marks of and this work is the Copyright 2009 of the Board of Trustees of the University of Illinois at Urbana - Champaign. All rights reserved.

2 WYSE Academic Challenge Computer Science Test (Regional) A computer system uses 10 bits to address memory. Each memory address points to a word that is one byte or eight bits long. What is the maximum number of words of memory that can be addressed? a) 10 2 b) 2*10 c) 8*10 d) 2 10 e) 8* A file of size 1Gigabyte is to be transferred over a connection of 100Megabits per second. Assuming that the connection is not being shared, what is the best estimate for the amount of time required to transfer the file? a) 10 sec b) 80 sec c) 8 minutes d) 1 hour e) 8 hours 3. Which of the following is used to allow a system to obtain an Internet Protocol (IP) address from a server within the local area network when the client system boots? a) DHCP Dynamic Host Control Protocol b) HTTP Hypertext Transfer Protocol c) DNS Domain Name Service d) ARP Address Resolution Protocol e) SMTP Simple Mail Transfer Protocol 4. Which of the following is true for Linux, Windows and Apple Mac based operating systems? a) They provide software drivers used to communicate with peripheral devices. b) All of them, not just Windows, must worry about external viruses/attacks. c) They generally provide a user interface. d) They manage memory (including RAM and secondary storage) for the user. e) All of the statements are true. 5. Convert the hexadecimal number 37 into a binary number. a) 25 b) 37 c) d) e) What is the equivalent Boolean expression for the following digital circuit? a) (A or B) and A b) FALSE c) TRUE d) A nor B e) none of the above

3 Computer Science 2 7. What is the Boolean expression that matches the given truth table? A B C OUTPUT F F F F F F T T F T F T F T T T T F F F T F T T T T F T T T T T a) C b) A or C c) not C or B d) B or C e) none of the above 8. The following Boolean expression: (A and not B) or (C and A and not B) is equivalent to which of the following when A is TRUE? a) C and not B b) TRUE c) FALSE d) C and A e) not B 9. A CPU uses an arithmetic left shift of an integer stored as a binary number. This shift will move all bits to the left and place a zero in the least significant bit position. This operation is equivalent to which of the following? a) adding 2 b) subtracting 2 c) division by 2 d) multiplying by 2 e) none of the above 10. A floating point number uses 10 bits for the significant, one bit for the sign, and 5 bits for the exponent. Which of the following represents the most accurate estimate of the number of significant digits for the equivalent decimal (base 10) number? a) 3 b) 5 c) 10 d) 2 10 e) none of the above 11. Which of the following properties apply to the queue data structure? a) Queues can be constructed using arrays. b) Queues can be constructed using linked lists. c) Queues are a first-in, first-out (FIFO) structure. d) All of the above are true. e) None of the above are true.

4 Computer Science List the order that the nodes of the tree would be visited in with a post-order traversal. a) A B C E F G b) C B A F G E c) C B F E G A d) C B A G F E e) A B C G F E 13. Which of the following will place numbers 4 and 11 into a linked list with 4 at the front of the list and 11 being the second item in the list. The pointer, head, will point to the front of the list. Use the structure provided along with the declared items. struct list { int data; list *next; ; list a, *b, *head; a) a.data = 4; b) b = new list; a.next = 11; b.data = 4; head = a; b.next = new list; b.next.data = 11; b.next.next = NULL; head = b; c) head = new list; d) b = new list; head->data = 4; b->data = 4; head->next = new list; b->next = new list; (head->next)->data = 11; b = b->next; (head->next)->next = NULL; b->data = 11; b->next = NULL; head = b; e) none of the above

5 Computer Science 4 //*** Code used for questions 14 and 15. ***// int fun(int a[ ], int b) { int i = 0, j = 0, sum = 0; do { a[i] = i; while (i++ < b); do { sum += a[j]; while (++j < b); return sum; // code declaration and function call int a[10]; fun(a, 5); 14. What is returned by fun(a, 5)? a) 15 b) 10 c) 6 d) 0 e) none of the above 15. What is the maximum acceptable value for b in the function call for the array a above? a) 5 b) 9 c) 10 d) 11 e) There is no maximum value. //*** Code segment used for questions 16 and 17. ***// void fun2(int a, int b) { if (a % b >= b % a) { cout << 1 ; else if (a % b <= 3) { cout << 2 ; else if (b % a >= 3) { cout << 3 ; else if (a % b == b % a) { cout << 4 ; else { cout << 5 ; 16. What is printed by the function call, fun2(11, 7)? a) 1 b) 2 c) 3 d) 4 e) Which of the following is true regarding the function fun2? a) The function passes data by value. b) The function passes data by reference. c) The function returns the integers 1, 2, 3, 4 or 5. d) The function can enter an infinite loop. e) None of the above are true.

6 Computer Science 5 //*** Code segment used for questions 18, 19 and 20. ***// int fun3 (int a, int b, int c) { for (int i = a, int j = 0; j <= b; i++) { if (i < j && j > c) { return a + b + c; else if (b > a && c > b) { return i; j = i + j; return j; 18. What is returned by the function call, fun3(3,3,3)? a) 3 b) 5 c) 7 d) 9 e) none of the above 19. What is returned by the function call, fun3(1,2,3)? a) 3 b) 1 c) 6 d) 5 e) none of the above 20. How many times does the code block controlled by the for loop execute for the function call, fun3(1,5,5)? a) infinite b) never c) 1 d) 2 e) Which of the following sets of values for c, d and e are correct after the code has completed? int a = 3, b = 4; float c, d, e; c = a / b; d = b / a; e = c / d; a) c = 0.75, d = , e = b) c = 0.00, d = , e = 0.00 c) c = 0.00, d = 1.0, e = 0.00 d) c = 0.75, d = 1.0, e = 0.75 e) c = 0.75, d = , e = Which of the following assigns the largest value to d, given values for a, b and c below? int a = 3, b = 2, c = 5; float d; a) d = a / b / c; b) d = a * b / c; c) d = a / b * c; d) d = c / b / a; e) d = c / b * a;

7 Computer Science What is the final set of values stored in the array w? int a,b,c[3]; int u,v,w[3]; for (int i = 0; i < 3; i++) { a = i; b = i * i; c[i] = a + b; for (int j = 0; j <= 2; j++) { u = a; v = b; w[j] = u + v + c[j]; a) {0, 2, 6 b) {2, 4, 8 c) {4, 6, 10 d) {6, 8, 12 e) {7, 9, 13 // *** Code segment used for questions 24, 25, 26 and 27. ***// int fun4 (int a, int b) { if (a <= b) { return a; else { return fun4(a-b, b) * a; 24. What is returned by fun4(9,3)? a) 162 b) 54 c) 27 d) 0 e) none of the above 25. What is the base case for the function, fun4? a) a < b b) a <= b c) a = b d) a > b e) a == b 26. Which of the following sets of arguments cause the function to return the smallest value? a) fun4(5,3) b) fun4(6,4) c) fun4(7,5) d) fun4(8,6) e) fun4(9, 8) 27. What is the approximate runtime of the function call fun4(n,m) for n>m? a) O(n*m) b) O(n/m) c) O(m) d) O(n) e) O(1)

8 Computer Science 7 //*** Code segment used for questions 28, 29 and 30. ***// class Rectangle { private: float w, h; public: Rectangle(float w=1, float h=1); // COMMENT FOR QUESTION 28 void SetWidth(float); float GetWidth() const {return w; void SetHeight(float); float GetHeight() const {return h; float GetArea() const {return h*w; float GetPerimeter()const {return 2*h+2*w; ; Rectangle::Rectangle(float w, float l) { SetWidth(w); SetHeight(l); void Rectangle::SetWidth(float w) { w = (w>0)? w : 1; void Rectangle::SetHeight(float h) { h = (h>0)? h : 1; 28. Which of the following best applies to the line denoted by COMMENT FOR QUESTION 28? a) Constructor b) Destructor c) Polymorphism d) Inheritance e) Template 29. What does the following block of code display? Rectangle r(0,5); cout << r.getwidth() <<, << r.getheight() <<, << r.getarea() <<, << r.getperimeter() << endl; a) 5,0,0,10 b) 0,5,0,10 c) 1,1,1,4 d) 1,5,5,12 e) none of the above 30. Which of the following blocks of code will declare an instance of Rectangle named rec, make sure that the width is 3 and the height is 4 and then display the area of the rectangle? a) Rectangle rec(4,4); b) Rectangle rec; rec.setwidth(3); rec.setwidth() = 3; cout<< rec.width*rec.height; rec.setheight() = 4; cout<< rec.getarea(); c) Rectangle rec; d) Rectangle rec(3); rec.setwidth(3); rec.setheight(4); rec.setheight(4); cout<< rec.getarea(); cout<< rec.width*rec.height; e) none of the above

2009 Academic Challenge

2009 Academic Challenge 2009 Academic Challenge COMPUTER SCIENCE TEST - STATE FINALS This Test Consists of 30 Questions Computer Science Test Production Team Jim Feher, McKendree College Author/Team Leader Barry Bookout, East

More information

2008 Academic Challenge

2008 Academic Challenge 2008 Academic Challenge COMPUTER SCIENCE TEST - REGIONAL - - This Test Consists of 30 Questions - - Computer Science Test Production Team Jim Feher, McKendree College Author/Team Leader Kian Pokorny, McKendree

More information

2012 Academic Challenge

2012 Academic Challenge 2012 Academic Challenge COMPUTER SCIENCE TEST - REGIONAL This Test Consists of 30 Questions Computer Science Test Production Team Jim Feher, McKendree University Author/Team Leader Nathan White, McKendree

More information

2015 Academic Challenge

2015 Academic Challenge 2015 Academic Challenge COMPUTER SCIENCE TEST - SECTIONAL This Test Consists of 30 Questions Computer Science Test Production Team James D. Feher, McKendree University Author/Team Leader Nathan White,

More information

2015 Academic Challenge

2015 Academic Challenge 2015 Academic Challenge COMPUTER SCIENCE TEST - REGIONAL This Test Consists of 30 Questions Computer Science Test Production Team James D. Feher, McKendree University Author/Team Leader Nathan White, Central

More information

2012 Academic Challenge

2012 Academic Challenge 2012 Academic Challenge COMPUTER SCIENCE TEST - SECTIONAL This Test Consists of 30 Questions Computer Science Test Production Team Jim Feher, McKendree University Author/Team Leader Nathan White, McKendree

More information

2015 Academic Challenge

2015 Academic Challenge 2015 Academic Challenge COMPUTER SCIENCE TEST - STATE This Test Consists of 30 Questions Computer Science Test Production Team James D. Feher, McKendree University Author/Team Leader Nathan White, McKendree

More information

2013 Academic Challenge

2013 Academic Challenge Academic Challenge COMPUTER SCIENCE TEST - SECTIONAL This Test Consists of Questions Computer Science Test Production Team Jim Feher, McKendree University Author/Team Leader Nathan White, McKendree University

More information

2001 Academic Challenge

2001 Academic Challenge Worldwide Youth in Science and Engineering 2001 cademic Challenge COMPUTER SCIENCE TEST - SECTIONL GENERL DIRECTIONS Computer Science Test Production Team Fred Hanzelin (retired), South Suburban College

More information

2003 Academic Challenge

2003 Academic Challenge Worldwide Youth in Science and Engineering 2003 Academic Challenge COMPUTER SCIENCE TEST - STATE FINALS Computer Science Test Production Team S. R. Subramanya, University of Missouri - Rolla Author/Team

More information

2005 Academic Challenge

2005 Academic Challenge 2005 Academic Challenge COMPUTER SCIENCE TEST - SECTIONAL Computer Science Test Production Team Sanjay Madria, University of Missouri at Rolla Author/Team Coordinator S. R. Subramanya, University of Missouri

More information

2001 Academic Challenge

2001 Academic Challenge Worldwide Youth in Science and Engineering 2001 Academic Challenge COMPUTER SCIENCE TEST - STATE FINALS Computer Science Test Production Team Fred Hanzelin (retired), South Suburban College Coordinator/Co-author

More information

WYSE Academic Challenge Computer Science Test (State) 2013 Solution Set

WYSE Academic Challenge Computer Science Test (State) 2013 Solution Set WYSE Academic Challenge Computer Science Test (State) 2013 Solution Set 1. Correct Answer: E 2's complement systems are often used in computing because negating a number involves simple operations in the

More information

CS 162, Lecture 25: Exam II Review. 30 May 2018

CS 162, Lecture 25: Exam II Review. 30 May 2018 CS 162, Lecture 25: Exam II Review 30 May 2018 True or False Pointers to a base class may be assigned the address of a derived class object. In C++ polymorphism is very difficult to achieve unless you

More information

EINDHOVEN UNIVERSITY OF TECHNOLOGY Department of Mathematics and Computer Science

EINDHOVEN UNIVERSITY OF TECHNOLOGY Department of Mathematics and Computer Science EINDHOVEN UNIVERSITY OF TECHNOLOGY Department of Mathematics and Computer Science Written examination Homologation C++ and Computer Organization (2DMW00) Part I: C++ - on Tuesday, November 1st 2016, 9:00h-12:00h.

More information

Short Notes of CS201

Short Notes of CS201 #includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system

More information

CS201 - Introduction to Programming Glossary By

CS201 - Introduction to Programming Glossary By CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with

More information

l Determine if a number is odd or even l Determine if a number/character is in a range - 1 to 10 (inclusive) - between a and z (inclusive)

l Determine if a number is odd or even l Determine if a number/character is in a range - 1 to 10 (inclusive) - between a and z (inclusive) Final Exam Exercises Chapters 1-7 + 11 Write C++ code to: l Determine if a number is odd or even CS 2308 Fall 2016 Jill Seaman l Determine if a number/character is in a range - 1 to 10 (inclusive) - between

More information

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

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

WYSE Academic Challenge 2002 Computer Science Test (Sectional) SOLUTION

WYSE Academic Challenge 2002 Computer Science Test (Sectional) SOLUTION Computer Science - 1 WYSE Academic Challenge 2002 Computer Science Test (Sectional) SOLUTION 1. Access to moving head disks requires three periods of delay before information is brought into memory. The

More information

WYSE Academic Challenge Computer Science Test (State) 2012 Solution Set

WYSE Academic Challenge Computer Science Test (State) 2012 Solution Set WYSE Academic Challenge Computer Science Test (State) 2012 Solution Set 1. Correct Answer: B. The aspect ratio is the fractional relation of the width of the display area compared to its height. 2. Correct

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

CS 216 Exam 1 Fall SOLUTION

CS 216 Exam 1 Fall SOLUTION CS 216 Exam 1 Fall 2004 - SOLUTION Name: Lab Section: Email Address: Student ID # This exam is closed note, closed book. You will have an hour and fifty minutes total to complete the exam. You may NOT

More information

WYSE Academic Challenge Computer Science Test (Regional) 2015 Solution Set

WYSE Academic Challenge Computer Science Test (Regional) 2015 Solution Set WYSE Academic Challenge Computer Science Test (Regional) 2015 Solution Set 1. Correct Answer: B Encapsulation refers to hiding the data behind get and set methods to insure that those using the class cannot

More information

CSE 12 Week Eight, Lecture One

CSE 12 Week Eight, Lecture One CSE 12 Week Eight, Lecture One Heap: (The data structure, not the memory area) - A binary tree with properties: - 1. Parent s are greater than s. o the heap order - 2. Nodes are inserted so that tree is

More information

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

Exam 1 Practice CSE 232 Summer 2018 (1) DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN. Name: Section: INSTRUCTIONS: (1) DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN. (2) The total for the exam is 100 points (3) There are 8 pages with 32 problem; 15 multiple-choice, 15

More information

Course Text. Course Description. Course Objectives. StraighterLine Introduction to Programming in C++

Course Text. Course Description. Course Objectives. StraighterLine Introduction to Programming in C++ Introduction to Programming in C++ Course Text Programming in C++, Zyante, Fall 2013 edition. Course book provided along with the course. Course Description This course introduces programming in C++ and

More information

CSL 201 Data Structures Mid-Semester Exam minutes

CSL 201 Data Structures Mid-Semester Exam minutes CL 201 Data tructures Mid-emester Exam - 120 minutes Name: Roll Number: Please read the following instructions carefully This is a closed book, closed notes exam. Calculators are allowed. However laptops

More information

REVIEW. The C++ Programming Language. CS 151 Review #2

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

! Determine if a number is odd or even. ! Determine if a number/character is in a range. - 1 to 10 (inclusive) - between a and z (inclusive)

! Determine if a number is odd or even. ! Determine if a number/character is in a range. - 1 to 10 (inclusive) - between a and z (inclusive) Final Exam Exercises CS 2308 Spring 2014 Jill Seaman Chapters 1-7 + 11 Write C++ code to: Determine if a number is odd or even Determine if a number/character is in a range - 1 to 10 (inclusive) - between

More information

CS250 Final Review Questions

CS250 Final Review Questions CS250 Final Review Questions The following is a list of review questions that you can use to study for the final. I would first make sure you review all previous exams and make sure you fully understand

More information

C++ (Non for C Programmer) (BT307) 40 Hours

C++ (Non for C Programmer) (BT307) 40 Hours C++ (Non for C Programmer) (BT307) 40 Hours Overview C++ is undoubtedly one of the most widely used programming language for implementing object-oriented systems. The C++ language is based on the popular

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

The type of all data used in a C++ program must be specified

The type of all data used in a C++ program must be specified The type of all data used in a C++ program must be specified A data type is a description of the data being represented That is, a set of possible values and a set of operations on those values There are

More information

Introduction to Classes

Introduction to Classes Introduction to Classes Procedural and Object-Oriented Programming Procedural and Object-Oriented Programming Procedural programming focuses on the process/actions that occur in a program Object-Oriented

More information

University of Illinois at Urbana-Champaign Department of Computer Science. First Examination

University of Illinois at Urbana-Champaign Department of Computer Science. First Examination University of Illinois at Urbana-Champaign Department of Computer Science First Examination CS 225 Data Structures and Software Principles Summer 2005 3:00pm 4:15pm Tuesday, July 5 Name: NetID: Lab Section

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

WYSE Academic Challenge Regional Computer Science 2008 Solution Set

WYSE Academic Challenge Regional Computer Science 2008 Solution Set 1. Correct answer: C. WYSE Academic Challenge Regional 2008 Solution Set 8 bits are sent at each clock cycle and there are 1,000,000 cycles per second, so 8,000,000 bits per second or 1,000,000 bytes per

More information

CS250 Final Review Questions

CS250 Final Review Questions CS250 Final Review Questions The following is a list of review questions that you can use to study for the final. I would first make sure that you review all previous exams and make sure you fully understand

More information

University of Illinois at Urbana-Champaign Department of Computer Science. First Examination

University of Illinois at Urbana-Champaign Department of Computer Science. First Examination University of Illinois at Urbana-Champaign Department of Computer Science First Examination CS 225 Data Structures and Software Principles Spring 2014 Tuesday, February 25, 7-10p Name: NetID: Lab Section

More information

Intro. Classes Beginning Objected Oriented Programming. CIS 15 : Spring 2007

Intro. Classes Beginning Objected Oriented Programming. CIS 15 : Spring 2007 Intro. Classes Beginning Objected Oriented Programming CIS 15 : Spring 2007 Functionalia HW 4 Review. HW Out this week. Today: Linked Lists Overview Unions Introduction to Classes // Create a New Node

More information

Second Examination Solution

Second Examination Solution University of Illinois at Urbana-Champaign Department of Computer Science Second Examination Solution CS 225 Data Structures and Software Principles Fall 2007 7p-9p, Thursday, November 8 Name: NetID: Lab

More information

First Examination. CS 225 Data Structures and Software Principles Spring p-9p, Tuesday, February 19

First Examination. CS 225 Data Structures and Software Principles Spring p-9p, Tuesday, February 19 Department of Computer Science First Examination CS 225 Data Structures and Software Principles Spring 2008 7p-9p, Tuesday, February 19 Name: NetID: Lab Section (Day/Time): This is a closed book and closed

More information

Number Systems. Binary Numbers. Appendix. Decimal notation represents numbers as powers of 10, for example

Number Systems. Binary Numbers. Appendix. Decimal notation represents numbers as powers of 10, for example Appendix F Number Systems Binary Numbers Decimal notation represents numbers as powers of 10, for example 1729 1 103 7 102 2 101 9 100 decimal = + + + There is no particular reason for the choice of 10,

More information

Biostatistics 615/815 - Lecture 2 Introduction to C++ Programming

Biostatistics 615/815 - Lecture 2 Introduction to C++ Programming Biostatistics 615/815 - Lecture 2 Introduction to C++ Programming Hyun Min Kang September 6th, 2012 Hyun Min Kang Biostatistics 615/815 - Lecture 2 September 6th, 2012 1 / 31 Last Lecture Algorithms are

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

Topic 7: Algebraic Data Types

Topic 7: Algebraic Data Types Topic 7: Algebraic Data Types 1 Recommended Exercises and Readings From Haskell: The craft of functional programming (3 rd Ed.) Exercises: 5.5, 5.7, 5.8, 5.10, 5.11, 5.12, 5.14 14.4, 14.5, 14.6 14.9, 14.11,

More information

CMSC 341 Lecture 10 Binary Search Trees

CMSC 341 Lecture 10 Binary Search Trees CMSC 341 Lecture 10 Binary Search Trees John Park Based on slides from previous iterations of this course Review: Tree Traversals 2 Traversal Preorder, Inorder, Postorder H X M A K B E N Y L G W UMBC CMSC

More information

A First Program - Greeting.cpp

A First Program - Greeting.cpp C++ Basics A First Program - Greeting.cpp Preprocessor directives Function named main() indicates start of program // Program: Display greetings #include using namespace std; int main() { cout

More information

Section - Computer Science

Section - Computer Science Section - Computer Science 1. With respect to the C++ programming language, which is the parameter that is added to every non-static member function when it is called? (i) this pointer (ii) that pointer

More information

Introduction to Programming

Introduction to Programming Introduction to Programming session 6 Instructor: Reza Entezari-Maleki Email: entezari@ce.sharif.edu 1 Spring 2011 These slides are created using Deitel s slides Sharif University of Technology Outlines

More information

CS2141 Software Development using C/C++ C++ Basics

CS2141 Software Development using C/C++ C++ Basics CS2141 Software Development using C/C++ C++ Basics Integers Basic Types Can be short, long, or just plain int C++ does not define the size of them other than short

More information

MID TERM MEGA FILE SOLVED BY VU HELPER Which one of the following statement is NOT correct.

MID TERM MEGA FILE SOLVED BY VU HELPER Which one of the following statement is NOT correct. MID TERM MEGA FILE SOLVED BY VU HELPER Which one of the following statement is NOT correct. In linked list the elements are necessarily to be contiguous In linked list the elements may locate at far positions

More information

Introduction to Programming using C++

Introduction to Programming using C++ Introduction to Programming using C++ Lecture One: Getting Started Carl Gwilliam gwilliam@hep.ph.liv.ac.uk http://hep.ph.liv.ac.uk/~gwilliam/cppcourse Course Prerequisites What you should already know

More information

Chapter 03: Computer Arithmetic. Lesson 09: Arithmetic using floating point numbers

Chapter 03: Computer Arithmetic. Lesson 09: Arithmetic using floating point numbers Chapter 03: Computer Arithmetic Lesson 09: Arithmetic using floating point numbers Objective To understand arithmetic operations in case of floating point numbers 2 Multiplication of Floating Point Numbers

More information

CS201- Introduction to Programming Latest Solved Mcqs from Midterm Papers May 07,2011. MIDTERM EXAMINATION Spring 2010

CS201- Introduction to Programming Latest Solved Mcqs from Midterm Papers May 07,2011. MIDTERM EXAMINATION Spring 2010 CS201- Introduction to Programming Latest Solved Mcqs from Midterm Papers May 07,2011 Lectures 1-22 Moaaz Siddiq Asad Ali Latest Mcqs MIDTERM EXAMINATION Spring 2010 Question No: 1 ( Marks: 1 ) - Please

More information

COMP322 - Introduction to C++ Lecture 01 - Introduction

COMP322 - Introduction to C++ Lecture 01 - Introduction COMP322 - Introduction to C++ Lecture 01 - Introduction Robert D. Vincent School of Computer Science 6 January 2010 What this course is Crash course in C++ Only 14 lectures Single-credit course What this

More information

Tokens, Expressions and Control Structures

Tokens, Expressions and Control Structures 3 Tokens, Expressions and Control Structures Tokens Keywords Identifiers Data types User-defined types Derived types Symbolic constants Declaration of variables Initialization Reference variables Type

More information

University of Illinois at Urbana-Champaign Department of Computer Science. First Examination

University of Illinois at Urbana-Champaign Department of Computer Science. First Examination University of Illinois at Urbana-Champaign Department of Computer Science First Examination CS 225 Data Structures and Software Principles Sample Exam 2 75 minutes permitted Print your name, netid, and

More information

Come and join us at WebLyceum

Come and join us at WebLyceum Come and join us at WebLyceum For Past Papers, Quiz, Assignments, GDBs, Video Lectures etc Go to http://www.weblyceum.com and click Register In Case of any Problem Contact Administrators Rana Muhammad

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

Indian Institute of Technology Kharagpur Programming and Data Structures (CS10001) Autumn : End-Semester Examination

Indian Institute of Technology Kharagpur Programming and Data Structures (CS10001) Autumn : End-Semester Examination Indian Institute of Technology Kharagpur Programming and Data Structures (CS10001) Autumn 2017-18: End-Semester Examination Time: 3 Hours Full Marks: 100 INSTRUCTIONS 1. Answer ALL questions. 2. Please

More information

University of Illinois at Urbana-Champaign Department of Computer Science. Second Examination

University of Illinois at Urbana-Champaign Department of Computer Science. Second Examination University of Illinois at Urbana-Champaign Department of Computer Science Second Examination CS 225 Data Structures and Software Principles Spring 2012 7p-9p, Tuesday, April 3 Name: NetID: Lab Section

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 2: Basic Elements of C++ Objectives (continued) Become familiar with the use of increment and decrement operators Examine

More information

DEPARTMENT OF MATHS, MJ COLLEGE

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

MULTIMEDIA COLLEGE JALAN GURNEY KIRI KUALA LUMPUR

MULTIMEDIA COLLEGE JALAN GURNEY KIRI KUALA LUMPUR STUDENT IDENTIFICATION NO MULTIMEDIA COLLEGE JALAN GURNEY KIRI 54100 KUALA LUMPUR FIFTH SEMESTER FINAL EXAMINATION, 2014/2015 SESSION PSD2023 ALGORITHM & DATA STRUCTURE DSEW-E-F-2/13 25 MAY 2015 9.00 AM

More information

Solutions are slightly different for V1 Question 1 (6 points):

Solutions are slightly different for V1 Question 1 (6 points): &6F),1$/Ã(;$0ÃÃÃ9Ã62/87,216 Solutions are slightly different for V1 Question 1 (6 points): a. Circle the hexadecimal representation for this binary number (including a binary point): 110100010100011100011.0111110

More information

Arithmetic and Bitwise Operations on Binary Data

Arithmetic and Bitwise Operations on Binary Data Arithmetic and Bitwise Operations on Binary Data CSCI 2400: Computer Architecture ECE 3217: Computer Architecture and Organization Instructor: David Ferry Slides adapted from Bryant & O Hallaron s slides

More information

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

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 Instructor: Final Exam Fall 2010 Last Name :... ID:... First Name:... Section No.: EXAMINATION INSTRUCTIONS * Do not

More information

University of Illinois at Urbana-Champaign Department of Computer Science. First Examination

University of Illinois at Urbana-Champaign Department of Computer Science. First Examination University of Illinois at Urbana-Champaign Department of Computer Science First Examination CS 225 Data Structures and Software Principles Spring 2007 7p-9p, Thursday, March 1 Name: NetID: Lab Section

More information

Absolute C++ Walter Savitch

Absolute C++ Walter Savitch Absolute C++ sixth edition Walter Savitch Global edition This page intentionally left blank Absolute C++, Global Edition Cover Title Page Copyright Page Preface Acknowledgments Brief Contents Contents

More information

POINTERS - Pointer is a variable that holds a memory address of another variable of same type. - It supports dynamic allocation routines. - It can improve the efficiency of certain routines. C++ Memory

More information

Introduction to C++ Systems Programming

Introduction to C++ Systems Programming Introduction to C++ Systems Programming Introduction to C++ Syntax differences between C and C++ A Simple C++ Example C++ Input/Output C++ Libraries C++ Header Files Another Simple C++ Example Inline Functions

More information

The type of all data used in a C (or C++) program must be specified

The type of all data used in a C (or C++) program must be specified The type of all data used in a C (or C++) program must be specified A data type is a description of the data being represented That is, a set of possible values and a set of operations on those values

More information

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

Engineering Problem Solving with C++, 3e Chapter 2 Test Bank 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. integer B 1.427E3 B. double D "Oct" C. character B -63.29 D. string F #Hashtag

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

Object Oriented Programming. Solved MCQs - Part 2

Object Oriented Programming. Solved MCQs - Part 2 Object Oriented Programming Solved MCQs - Part 2 Object Oriented Programming Solved MCQs - Part 2 It is possible to declare as a friend A member function A global function A class All of the above What

More information

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

Review of Important Topics in CS1600. Functions Arrays C-strings Review of Important Topics in CS1600 Functions Arrays C-strings Array Basics Arrays An array is used to process a collection of data of the same type Examples: A list of names A list of temperatures Why

More information

WYSE Academic Challenge State Finals Computer Science 2007 Solution Set

WYSE Academic Challenge State Finals Computer Science 2007 Solution Set WYSE Academic Challenge State Finals Computer Science 2007 Solution Set 1. Correct answer: C. a) PGP is for encrypting documents, traditionally used for email. b) SSH is used to gain secure access to a

More information

Objectives. Introduce the core C# language features class Main types variables basic input and output operators arrays control constructs comments

Objectives. Introduce the core C# language features class Main types variables basic input and output operators arrays control constructs comments Basics Objectives Introduce the core C# language features class Main types variables basic input and output operators arrays control constructs comments 2 Class Keyword class used to define new type specify

More information

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved. Assoc. Prof. Dr. Marenglen Biba Before writing a program to solve a problem, have a thorough understanding of the problem and a carefully planned approach to solving it. Understand the types of building

More information

CSCE 110 PROGRAMMING FUNDAMENTALS

CSCE 110 PROGRAMMING FUNDAMENTALS CSCE 110 PROGRAMMING FUNDAMENTALS WITH C++ Prof. Amr Goneid AUC Part 2. Overview of C++ Prof. Amr Goneid, AUC 1 Overview of C++ Prof. Amr Goneid, AUC 2 Overview of C++ Historical C++ Basics Some Library

More information

Introduction to C++ Introduction to C++ Dr Alex Martin 2013 Slide 1

Introduction to C++ Introduction to C++ Dr Alex Martin 2013 Slide 1 Introduction to C++ Introduction to C++ Dr Alex Martin 2013 Slide 1 Inheritance Consider a new type Square. Following how we declarations for the Rectangle and Circle classes we could declare it as follows:

More information

3.Constructors and Destructors. Develop cpp program to implement constructor and destructor.

3.Constructors and Destructors. Develop cpp program to implement constructor and destructor. 3.Constructors and Destructors Develop cpp program to implement constructor and destructor. Constructors A constructor is a special member function whose task is to initialize the objects of its class.

More information

WYSE Academic Challenge Computer Fundamentals Test (State Finals)

WYSE Academic Challenge Computer Fundamentals Test (State Finals) WYSE Academic Challenge Computer Fundamentals Test (State Finals) - 1998 1. What is the decimal value for the result of the addition of the binary values: 1111 + 0101? (Assume a 4 bit, 2's complement representation.)

More information

CS250 Final Review Questions

CS250 Final Review Questions CS250 Final Review Questions The following is a list of review questions that you can use to study for the final. I would first make sure you review all previous exams and make sure you fully understand

More information

Lab 1. largest = num1; // assume first number is largest

Lab 1. largest = num1; // assume first number is largest Lab 1 Experiment 1 Complete and execute the following program #include using std::cout; using std::cin; using std::endl; int main() { int number1; int number2; int number3; int smallest; int

More information

! Determine if a number is odd or even. ! Determine if a number/character is in a range. - 1 to 10 (inclusive) - between a and z (inclusive)

! Determine if a number is odd or even. ! Determine if a number/character is in a range. - 1 to 10 (inclusive) - between a and z (inclusive) Final Exam Exercises Chapters 1-7 + 11 Write C++ code to:! Determine if a number is odd or even CS 2308 Fall 2018 Jill Seaman! Determine if a number/character is in a range - 1 to 10 (inclusive) - between

More information

Passing arguments to functions by. const member functions const arguments to a function. Function overloading and overriding Templates

Passing arguments to functions by. const member functions const arguments to a function. Function overloading and overriding Templates Lecture-4 Inheritance review. Polymorphism Virtual functions Abstract classes Passing arguments to functions by Value, pointers, refrence const member functions const arguments to a function Function overloading

More information

CS 115 Exam 3, Spring 2010

CS 115 Exam 3, Spring 2010 Your name: Rules You must briefly explain your answers to receive partial credit. When a snippet of code is given to you, you can assume o that the code is enclosed within some function, even if no function

More information

Fast Introduction to Object Oriented Programming and C++

Fast Introduction to Object Oriented Programming and C++ Fast Introduction to Object Oriented Programming and C++ Daniel G. Aliaga Note: a compilation of slides from Jacques de Wet, Ohio State University, Chad Willwerth, and Daniel Aliaga. Outline Programming

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

CSC 210, Exam Two Section February 1999

CSC 210, Exam Two Section February 1999 Problem Possible Score 1 12 2 16 3 18 4 14 5 20 6 20 Total 100 CSC 210, Exam Two Section 004 7 February 1999 Name Unity/Eos ID (a) The exam contains 5 pages and 6 problems. Make sure your exam is complete.

More information

Outline. A C++ Linked Structure Class A C++ Linked List C++ Linked Dynamic Memory Errors In-class work. 1 Chapter 11: C++ Linked Structures

Outline. A C++ Linked Structure Class A C++ Linked List C++ Linked Dynamic Memory Errors In-class work. 1 Chapter 11: C++ Linked Structures Outline 1 Chapter 11: C++ Linked Structures A ListNode Class To support a Linked List container class LList, a ListNode class is used for the individual nodes. A ListNode object has two attributes: item

More information

Few reminders and demos

Few reminders and demos 15-123 Effective Programming in C and Unix Learning Objectives At the end of this lecture, you should be able to Understand how data is represented Understand how integers are represented Understand how

More information

A506 / C201 Computer Programming II Placement Exam Sample Questions. For each of the following, choose the most appropriate answer (2pts each).

A506 / C201 Computer Programming II Placement Exam Sample Questions. For each of the following, choose the most appropriate answer (2pts each). A506 / C201 Computer Programming II Placement Exam Sample Questions For each of the following, choose the most appropriate answer (2pts each). 1. Which of the following functions is causing a temporary

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

Non-numeric types, boolean types, arithmetic. operators. Comp Sci 1570 Introduction to C++ Non-numeric types. const. Reserved words.

Non-numeric types, boolean types, arithmetic. operators. Comp Sci 1570 Introduction to C++ Non-numeric types. const. Reserved words. , ean, arithmetic s s on acters Comp Sci 1570 Introduction to C++ Outline s s on acters 1 2 3 4 s s on acters Outline s s on acters 1 2 3 4 s s on acters ASCII s s on acters ASCII s s on acters Type: acter

More information

PROGRAMMING IN C AND C++:

PROGRAMMING IN C AND C++: PROGRAMMING IN C AND C++: Week 1 1. Introductions 2. Using Dos commands, make a directory: C:\users\YearOfJoining\Sectionx\USERNAME\CS101 3. Getting started with Visual C++. 4. Write a program to print

More information