Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Study Guide for Computer Science II Final Exam (Spring 2007) - Prof. Thomas A. Bailey, Exams of Computer Science

This is a study guide for the final exam of computer science ii course at the university, held in spring 2007. The guide contains potential exam questions, code examples, and concepts related to c++ class methods, numerical error problems, time complexity, standard template library, linked lists, binary trees, hash tables, and various sorting algorithms.

Typology: Exams

Pre 2010

Uploaded on 08/19/2009

koofers-user-egp
koofers-user-egp ๐Ÿ‡บ๐Ÿ‡ธ

10 documents

1 / 5

Toggle sidebar

Related documents


Partial preview of the text

Download Study Guide for Computer Science II Final Exam (Spring 2007) - Prof. Thomas A. Bailey and more Exams Computer Science in PDF only on Docsity! CoSc 2030 printed 1 December 2020 Computer Science II Spring 2007 page 1 of 5 Study Guide for the Final Exam to be given Wednesday, 8 December 2008, from 10:15 am to 12:15 pm in EN 4059 The exam will have about 16 questions. Each exam question will be similar to one of these questions or ask about the listed topic. Q. Identify and discuss a numerical error problem. Q. Which four class methods are automatically provided by the C++ compiler. Describe the code provided by the compiler for each of these methods. Q. Suppose I have a Summer class that accepts sequence entries through calls to .append( x ) and returns the sum of the entries whenever its .operator()() method is called. What is the output of this code segment? Sumner one, two; for( int i=2; i<5; i++) { one.append(i); two.append(one()); cout << i << โ€œ โ€œ; cout << one () << โ€œ โ€œ; cout << two () << โ€œ โ€œโ€™ cout << endl; } Q. class Second { public: // Post: This Second has no entries. Second(); // Post: x has been added to the entries in this // Second. void enter( double x ); // Pre: This Second has at least two entries. // Post: The second entry entered in this Second has CoSc 2030 printed 1 December 2020 Computer Science II Spring 2007 page 2 of 5 // been returned. double operator()() const; protected: long count; double second; }; Write code for the no-parameters constructor, the .enter( double x ) method, and the .operator()() method of Second. Q. Suppose we time the following code for n = 2000 and find it requires 4.73 seconds to execute. How much time would you expect to be required for this code segment for n = 4000? for i = 1 to n for j = 1 to n ConstantTimeTask() Q. What is the time complexity of each of these loop algorithms? Assume Task() requires a constant time. Choose your answers from ๏‘( 1 ), ๏‘( log n ), ๏‘( n ), ๏‘( n log n ), ๏‘( n2 ), and ๏‘( n3 ). a) for i = 1 to n { for j = 1 to n { for k = 1 to n { Task() } } } b) for i = 1 to n { for j = 1 to i { Task() } } for k = 1 to n { Task() } c) k = 1
Docsity logo



Copyright ยฉ 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved