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

Similar documents
2015 Academic Challenge

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

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

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

WYSE Academic Challenge Regional Computer Science 2008 Solution Set

WYSE Academic Challenge State Finals Computer Science 2007 Solution Set

2009 Academic Challenge

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

Computer Organization and Programming

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

1) What is the primary purpose of template functions? 2) Suppose bag is a template class, what is the syntax for declaring a bag b of integers?

UNIT-II. Part-2: CENTRAL PROCESSING UNIT

A. Year / Module Semester Subject Topic 2016 / V 2 PCD Pointers, Preprocessors, DS

WYSE Academic Challenge 2002 Computer Science Test (Sectional) SOLUTION

1. Stack overflow & underflow 2. Implementation: partially filled array & linked list 3. Applications: reverse string, backtracking

Practical Malware Analysis

Largest Online Community of VU Students

Data Structure (CS301)

Cpt S 122 Data Structures. Course Review Midterm Exam # 1

Abstract Data Structures IB Computer Science. Content developed by Dartford Grammar School Computer Science Department

1. Which of the following circuits can be used to store one bit of data? A) Encoder B) OR gate C) Flip Flop D) Decoder

Course Review for Finals. Cpt S 223 Fall 2008

MULTIMEDIA COLLEGE JALAN GURNEY KIRI KUALA LUMPUR

12 Abstract Data Types

BRONX COMMUNITY COLLEGE of the City University of New York DEPARTMENT OF MATHEMATICS AND COMPUTER SCIENCE. Sample Final Exam

DEEPIKA KAMBOJ UNIT 2. What is Stack?

Pace University. Fundamental Concepts of CS121 1

9/29/2016. Chapter 4 Trees. Introduction. Terminology. Terminology. Terminology. Terminology

2008 Academic Challenge

Operating Systems CMPSCI 377, Lec 2 Intro to C/C++ Prashant Shenoy University of Massachusetts Amherst

Introduction. for large input, even access time may be prohibitive we need data structures that exhibit times closer to O(log N) binary search tree

Signature: 1. (10 points) Basic Microcontroller Concepts

Computer Architecture

Chapter 20: Binary Trees

FINALTERM EXAMINATION Fall 2009 CS301- Data Structures Question No: 1 ( Marks: 1 ) - Please choose one The data of the problem is of 2GB and the hard

Introduction to Programming Using Java (98-388)

MIDTERM EXAMINATION Spring 2010 CS301- Data Structures

M.C.A. DEGREE EXAMINATION, DEC First Year. Time : 03 Hours Maximum Marks : 75

CS301 - Data Structures Glossary By

Computer Science E-22 Practice Final Exam

Introduction to Computer Science. Homework 1

DATA STRUCTURE : A MCQ QUESTION SET Code : RBMCQ0305

Final exam. Final exam will be 12 problems, drop any 2. Cumulative up to and including week 14 (emphasis on weeks 9-14: classes & pointers)

Index COPYRIGHTED MATERIAL

CIS 1.5 Course Objectives. a. Understand the concept of a program (i.e., a computer following a series of instructions)

Analysis of Algorithms

CNIT 127: Exploit Development. Ch 1: Before you begin. Updated

1 Epic Test Review 2 Epic Test Review 3 Epic Test Review 4. Epic Test Review 5 Epic Test Review 6 Epic Test Review 7 Epic Test Review 8

Number Systems for Computers. Outline of Introduction. Binary, Octal and Hexadecimal numbers. Issues for Binary Representation of Numbers

Recitation 9. Prelim Review

PESIT Bangalore South Campus

2015 Academic Challenge

ISC 2011 COMPUTER SCIENCE PAPER 1 THEORY

ASSEMBLY LANGUAGE MACHINE ORGANIZATION

Stanford University Computer Science Department CS 140 Midterm Exam Dawson Engler Winter 1999

User. Application program. Interfaces. Operating system. Hardware

Course Review for. Cpt S 223 Fall Cpt S 223. School of EECS, WSU

The CPU and Memory. How does a computer work? How does a computer interact with data? How are instructions performed? Recall schematic diagram:

CS 231 Data Structures and Algorithms, Fall 2016

Highlights. - Making threads. - Waiting for threads. - Review (classes, pointers, inheritance)

MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Midterm #2 Examination 12:30 noon, Thursday, March 15, 2012

low and not larger than high. 18 points

Programming and Data Structure Solved. MCQs- Part 2

PLD Semester Exam Study Guide Dec. 2018

Code No: R Set No. 1

CHAPTER 8: Central Processing Unit (CPU)

FORTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLIGY- OCTOBER, 2012 DATA STRUCTURE

COMP375 Practice Final Exam

MCA SEM-II Data Structure

Why Study Assembly Language?

Problems and Solutions to the January 1994 Core Examination

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

Main Points of the Computer Organization and System Software Module

CS DATA STRUCTURES AND ALGORITHMS

Department of Computer Science Admission Test for PhD Program. Part I Time : 30 min Max Marks: 15

1. Two main measures for the efficiency of an algorithm are a. Processor and memory b. Complexity and capacity c. Time and space d.

19 Much that I bound, I could not free; Much that I freed returned to me. Lee Wilson Dodd

Description of the Simulator

CPT1. Unit 1 Computer Systems, Programming and Networking Concepts. General Certificate of Education January 2004 Advanced Subsidiary Examination

CS201 Latest Solved MCQs

PROGRAMMING IN C AND C++:

For Teacher's Use Only Q No Total Q No Q No

2012 Academic Challenge

Chapter 4 Introduction to Control Statements

Final Exam. 11 May 2018, 120 minutes, 26 questions, 100 points

More Programming Constructs -- Introduction

CSE 332 Spring 2013: Midterm Exam (closed book, closed notes, no calculators)

Since ESE GATE PSUs ELECTRICAL ENGINEERING COMPUTER FUNDAMENTALS. Volume - 1 : Study Material with Classroom Practice Questions

Subprograms, Subroutines, and Functions

DATA STRUCTURE AND ALGORITHM USING PYTHON

ENGINEERING PROBLEM SOLVING WITH C++

ST. MARY S COLLEGE FORM 4

CS 31: Introduction to Computer Systems : Threads & Synchronization April 16-18, 2019

4. BOOLEAN ALGEBRA 8 5. NETWORKING AND OPEN SOURCE SOFTWARE 10

CS 237 Meeting 19 10/24/12

Revision Statement while return growth rate asymptotic notation complexity Compare algorithms Linear search Binary search Preconditions: sorted,

COMPUTER APPLICATION

Introduction to Programming using C++

1992 Illinois JETS TEAMS Regional Computer Fundamentals Test

C PROGRAMMING LANGUAGE. POINTERS, ARRAYS, OPERATORS AND LOOP. CAAM 519, CHAPTER5

Transcription:

WYSE Academic Challenge Computer Science Test (State) 2015 Solution Set 1. Correct Answer: E The following shows the contents of the stack (a lifo last in first out structure) after each operation. Instruction Stack # items on Stack PUSH A; A 1 PUSH B; AB 2 MUL; A*B 1 PUSH A; A(A*B) 2 PUSH C; CA(A*B) 3 PUSH D; DCA(A*B) 4 MUL; (D*C)A(A*B) 3 SUB; (A-(D*C)(A*B) 2 ADD; (A-(D*C)+(A*B) 1 POP X 0 Item placed in memory location for X 2. Correct Answer: B When traversing a tree in postorder, a node is visited after its left and right subtrees have been visited. Given that definition, it can be seen that 10 would be the first node visited, then 8. As both of its left and right subtrees would have been visited, then node 12 is visited. That would complete the left subtree of 14 and now the right subtree of 14 would need to be visited. Node 6 would be visited, then 7. This would complete the right subtree of 14, and finally 14 would be visited. 3. Correct Answer: A Given a 3-dimensional array A [μ 1 ] [μ 2 ] [μ 3 ], dimension μ 1 has μ 1 2-dimensional arrays of size μ 2 μ 3 and dimension μ 2 has μ 2 1-dimensional arrays of size μ 3. Therefore, to compute the location of a[6][4][4] in an array declared as int a[10][5][5], use the following: 6 * 5 * 5 = 150 + 4 * 5 = 20 + 4 + 840 1,014 4. Correct Answer: D A max heap is defined as a max tree in which the key value in each node is no smaller than the key values in its children, if any. A max heap is also a complete binary tree, however it does not need to be full. 5. Correct Answer: D The maximum number of nodes in a binary tree of depth k is 2 k 1, k 1. Therefore, for a tree with a depth of 8, the maximum number of nodes is: 2 8 1 256 1 255 6. Correct Answer: C The bias of an 8 bit number would be 2 (8-1) -1 or 127. The original number is in decimal is given below.

10110110 = 1*2 7 + 0*2 6 + 1*2 5 + 1*2 4 + 0*2 3 + 1*2 2 +1*2 1 +0*2 0 = 128 + 32 + 16 + 4 + 2 = 182 Then subtracting the bias yields the final answer. 182-127 = 55. 7. Correct Answer: E Two answers actually work for this Karnaugh map. First the four corners must be used, which are given by the bolded and italicized values as B'D'. Then the middle portion must be included given by the underlined values as BD. Lastly, the two remaining true values can be included with the column C'D or the square B'C', either works. To obtain a minimum expression however, a group of four must be used for these two values. So, while including the group B'C'D would yield an accurate function, it would not result in the minimal expression. So, while answers A and D result in correct functions, they do not provide minimal expressions. C'D' 00 C'D 01 CD 11 CD' 10 A'B' 00 1 1 0 1 A'B 01 AB 11 0 1 1 0 0 1 1 0 AB' 10 1 1 0 1 8. Correct Answer: E The largest 8 bit two's complement numbers is 127. The top bit carries with it a negative value. So the 8 bits would carry the values below. (-1)*2 7 1*2 6 1*2 5 1*2 4 1*2 3 1*2 2 1*2 1 1*2 0 So if the result of adding two positive numbers has a 1 in the largest bit, this causes a negative result, which must be the result of overflow, meaning the resulting numbers is too large to fit into the number of bits specified. In this case adding 90 to 71 results in 161 which is greater than 127. Two's complement numbers are easy to invert, add and subtract in the Arithmetic Logic Unit (ALU) and result in a more simplified set of hardware for the CPU. 9. Correct Answer: A This circuit implements the truth table from the regional exam. Upon first inspection, it is clear that the output is (ABC)' and C. However, that is not one of the options, so the other functions must be checked. A B C a. b. c. d. OUT F F F F T F F F F F T T T F F T F T F F T F F F F T T T T F T T T F F F T F F F T F T T T F T T T T F F T F F F T T T F T F F F 10. Correct Answer: A A system bus that is 2 bytes wide can transfer 16 bits at one time. If the bus operates at 2KHz and it takes 4 cycles per transfer, it can perform 500 transfers to per second. 500transfers/second * 16 bits/transfer = 8000 bits/second. 11. Correct Answer: C *list actually will access the item in list[0] and since pptr expects a reference, this will cause an error. Since c is actually a point and a circle pointing the point pointer to a circle does work. The other lines of code use valid references to points that are passed to the pointer.

12. Correct Answer: E Point is the base class for the derived class Point. This is an example of inheritance. In cases such as this, it is said that the derived class, Circle, is also a member of the base class, Point. So, Circle Is-A Point. 13. Correct Answer: C radius may not be accessed outside of the class, as it is private. The array arr must use the [] before the dot operator to access each item in the array. For these reasons, only the third option will work correctly. 14. Correct Answer: A Encapsulation of the data of the object involves only allowing users access through these get and set accessor methods. 15. Correct Answer: B The pre-increment should increment the radius of the item first and then return that object that has just been modified. The first example copies this item, increments the copy not the original item and then returns the incremented copy. The third example is the post-increment, which makes a copy, increments the original and then returns the copy for use. The fourth does update the radius with a pre-increment, but it returns the this pointer, not the item itself. The second uses a post-increment, but it does not matter, since the item does not get used until after the function completes. So for the calling reference, the second will update the radius prior to the use of the circle in question. 16. Correct Answer: B If the hard drive spins at 6000 RPM this is equivalent to 6000 RPM* 1Min/60 seconds = 100 Rotations per second. If the data location just passed the read/write head of the drive, it would need to make a full revolution to reach the data again, which would take 1/100th of a second. 17. Correct Answer: D Modern operating systems handle providing a user interface, abstracting functionality to the hardware with device drivers, scheduling processes, memory management and disk scheduling. Operating systems provide a means of allowing users to install and run programs, however the programs installed are usually customized for the needs of the system. Not all systems will need an email interface, a router for example. Such specific software packages are left out of the operating system as a result. 18. Correct Answer: D A denial of service attack (DoS) is an attempt to slow down or stop a computer system or network by flooding it with requests for information and data. A rogue Wi-Fi hotspot will imitate free Wi-Fi hotspots. These rogue networks operate close to the legitimate free hotspots and typically provide stronger signals that many users unsuspectingly connect to. Once connected, the rogue networks capture any and all information sent by the users to legitimate sites including user names and passwords. A Trojan horse is a program that comes into a computer system disguised as something else. Trojan horses are not viruses, but they can be carriers of viruses. Viruses are programs that migrate through networks and operating systems, and most attach themselves to different programs and databases. While some viruses are relatively harmless, many can be quite destructive. Once activated, these destructive viruses usually alter and/ or delete files. 19. Correct Answer: A

a%b will return 3, which will be interpreted as true. The?: operator will then move on to the section of code immediately following the? and return 1 which will be displayed. 20. Correct Answer: E This is an example of function overloading. It allows the compiler to choose the correct function based on the parameter list. The parameter list for each overloaded function must be unique. This unique list is called the signature and is what the compiler uses to determine which function to use. 21. Correct Answer: E The recursive function computes the nth Fibonacci in the sequence of Fibonacci numbers. The sequence is as follows: 1, 1, 2, 3, 5, 8, 13, 21, And values returned by the function calls are given. n return value 0 1 1 1 2 2 3 3 4 5 5 8 6 13 7 21 The base case is when n<2 which returns 1. The recursion is two calls to the function itself with arguments of n-1 and n-2. As the function calls itself twice on the recursion, the number of function calls grows exponentially as argument n grows. func(6) calls func(5) and func(4) this repeats until hitting the base cases of func(1) and func(0). A tree that traces all of the calls for func(6) follows. Including func(6) there are a total of 25 function calls.

22. Correct Answer: C See solution for previous problem. 23. Correct Answer: A See solution for previous problem. 24. Correct Answer: B Answers a and c are nonsensical. The address-of operator is the ampersand (&) and is often used in conjunction with pointers. 25. Correct Answer: A Answers b and d are nonsensical. get is used to retrieve unformatted data from a stream. new dynamically allocates memory from the heap for a variable of a given type. Assuming that newvalue has previously been declared, an example of the use of new is: newvalue = new double; 26. Correct Answer: B A race condition occurs when several processes access and manipulate the same data concurrently and the outcome of the execution depends on the particular order in which the access takes place. A deadlock occurs when two processes both try to gain access to two different memory locations. Process A would lock memory location 1, and then try to access memory location 2. In the meantime, Process B locked memory location 2, and then tried to access memory location 1. Both processes are now in a deadlock condition. An infinite loop occurs when the loop condition will never be false. A classic example is: for (;;); That for loop will never terminate. An abnormal termination occurs when an unhandled exception is thrown. Accessing an array out of bounds or dividing by zero are common ways that an abnormal termination can occur. To prevent a race condition from occurring, some sort of locking needs to occur on the memory location where the race condition could occur. Before a process can access the memory location, it must obtain a lock on it. If the memory location is already locked, the process will need to wait until the lock is released. 27. Correct Answer: D The function func is a template function that will find the maximum element within an array that is passed to it. The first parameter is the array and the second parameter is the number of elements within the array. The array can be of any type, as long as the < operator has been defined for that type. For all of the native C++ types, the < operator is already ready defined. Any user-defined types will need to overload the < operator. The purpose of a template function is to allow for easier function overloading. Instead of writing multiple functions with the same logic to handle different types, a template function will allow the program to write the logic once and allow the compiler generate the version needed based on the types used in the call. 28. Correct Answer: B See previous explanation. 29. Correct Answer: C See previous explanation.

30. Correct Answer: C x is a pointer to a pointer to an int. This definition allows for two levels of indirection, which can be useful when accessing a two-dimensional array.