[PDF] [PDF] Quiz 4 Solutions

b Previous function calls are still open when the function calls itself and the Q13: Which of the following is not a dynamic data structure? a Linked list b Stack



Previous PDF Next PDF





[PDF] RELATIONS AND FUNCTIONS - NCERT

(v) Let f : A→ B and g : B → C be the given functions such that gof is onto Then Solution R is reflexive and symmetric, but not transitive since for (1, 0) ∈ R and



[PDF] Cartesian product - UVic

Cartesian Product is not commutative For the sets A and B one paragraph above, Functions Definition (function) A function from a set A to a set B is a relation f then we denote the assignment of b to a by writing b = f(a) and calling b the 



[PDF] Chapter 10 Functions

Finally, we call range the subset of Y with preimages Example 96 then f-1(b) will have more than one value, and thus is not properly defined Note that given 



[PDF] Sets and Functions - UCSD Math

about the ordered set (a, b, c, a) it would not make sense because it would say We write f : A → B to indicate that f is a function from A to B We call the set A



[PDF] Chapter 2 Relations, Functions, Partial Functions

In summary, partial functions need not be defined for all of their input values and we need to (A × B) × C and we call its elements (ordered) triples (or triplets)



[PDF] Homework 10 Solutions - UBC Math

Using induction on the size of A, prove that if A and B are finite sets such that B < A and f : A → B is a function, then f is not injective Proof: Base case: We see 



[PDF] Determine whether each relation is a function Explain 1 ANSWER

8 ANSWER: No; the graph does not pass the vertical line test 9 19 g(−b) ANSWER: b 2 − 4 Determine whether each relation is a function Explain 20



[PDF] Final Exam Solution Guide - Stony Brook Mathematics

(b) What is the contrapositive of (⋆)? Is it a true statement? If n is not divisible For example, 4 is divisible by 2, but not divisible by 10 Remark Consider where IY is the identity function on Y Prove that f is a surjection Proof Let y be any 



[PDF] Group 1 Question 1 What is the correct value to return to the

B 1 C 0 D Programs do not return a value Question 2 What is the only function all In case of arguments passed by values when calling a function such as 



[PDF] Quiz 4 Solutions

b Previous function calls are still open when the function calls itself and the Q13: Which of the following is not a dynamic data structure? a Linked list b Stack

[PDF] b cell activation and differentiation ppt

[PDF] b cell activation requires

[PDF] b cell activation steps quizlet

[PDF] b cell antibodies

[PDF] b cell antibody production review

[PDF] b cell development review nature

[PDF] b cell development stages

[PDF] b cell review nature

[PDF] b cell types and functions

[PDF] b ed 2020 exam date

[PDF] b ed cet

[PDF] b ed cet form filling

[PDF] b ed cet hall ticket 2020

[PDF] b ed cet online form 2020

[PDF] b ed cet question papers karnataka

EECS 211: FUNDAMENTALS OF COMPUTER PROGRAMMING II

1 | Q u i z 4 S o l u t i o n s

Quiz 4 Solutions

Q1: What value does function mystery return when called with a value of 4? int mystery ( int number ) if ( number <= 1 ) return 1; else return number * mystery( number ² 1 ); a. 0. b. 1. c. 4. d. 24.

ANS: d. 24.

Q2: Recursion is memory-intensive because:

a. Recursive functions tend to declare many local variables.

b. Previous function calls are still open when the function calls itself and the activation records of these

previous calls still occupy space on the call stack. c. Many copies of the function code are created. d. It requires large data values.

ANS: b. Previous function calls are still open when the function calls itself and the activation records of these

previous calls still occupy space on the call stack. Q3: Linear search is highly inefficient compared to binary search when dealing with: a. Small, unsorted arrays. b. Small, sorted arrays. c. Large, unsorted arrays. d. Large, sorted arrays.

ANS: d. Large, sorted arrays.

Q4: A double subscripted array declared as int a[ 3 ][ 5 ]; has how many elements? a. 15 b. 13 c. 10 d. 8

ANS: a. 15

EECS 211: FUNDAMENTALS OF COMPUTER PROGRAMMING II

2 | Q u i z 4 S o l u t i o n s

Q5: Using square brackets ([]) to retrieve vector elements __________ perform bounds checking; using member function at to retrieve vector elements __________ perform bounds checking. a. Does not, does not. b. Does not, does. c. Does, does not. d. Does, does.

ANS: b. Does not, does.

Q6: Which file open mode would be used to write data only to the end of an existing file? a. ios::app b. ios::in c. ios::out d. ios::trunc

ANS a. ios::app

Q7: A random access file is organized most like a(n): a. Array. b. Object. c. Class. d. Pointer.

ANS: a. Array.

Q8: To write fixed-length records, use file open mode: a. ios::app b. ios::ate c. ios::trunc d. ios::binary

ANS: d. ios::binary

Q9: The total number of elements that can be stored in a string without increasing its current amount of allocated

memory is called its: a. Size. b. Length. c. Capacity. d. Maximum size.

ANS: c. Capacity.

Q10: An algorithm that requires __________ operations to complete its task on n data elements is said to have a

linear runtime. a. n3 + 9 b. 3 n2 + 3 n + 2 c. 2 n + 1 d. 6

ANS c. 2 n + 1

EECS 211: FUNDAMENTALS OF COMPUTER PROGRAMMING II

3 | Q u i z 4 S o l u t i o n s

Q11: At most, how many comparisons are required to search a sorted vector of 1023 elements using the binary

search algorithm? a. 10 b. 15 c. 20 d. 30

ANS a. 10

Q12: Which of the following represents the efficiency of the insertion sort? a. O(1) b. O(log n) c. O(n) d. O(n2)

ANS: d. O(n2)

Q13: Which of the following is not a dynamic data structure? a. Linked list. b. Stack. c. Array. d. Binary tree.

ANS c. Array.

Q14: In general, linked lists allow:

a. Insertions and removals anywhere. b. Insertions and removals only at one end. c. Insertions at the back and removals from the front. d. None of the above.

ANS a. Insertions and removals anywhere.

Q15: Which data structure represents a waiting line and limits insertions to be made at the back of the data structure

and limits removals to be made from the front? a. Stack. b. Queue. c. Binary tree. d. Linked list.

ANS b. Queue.

Q16: Given that the line

delete newPtr; just executed, what can you conclude? a. The memory referenced by newPtr is released only if it is needed by the system. b. The pointer newPtr is of type void *. c. The pointer newPtr only exists if there was an error freeing the memory. d. The pointer newPtr still exists.

ANS d. The pointer newPtr still exists.

EECS 211: FUNDAMENTALS OF COMPUTER PROGRAMMING II

4 | Q u i z 4 S o l u t i o n s

Q17: What kind of linked list begins with a pointer to the first node, and each node contains a pointer to the next

node, and the pointer in the last node points back to the first node? a. Circular, singly-linked list. b. Circular, doubly-linked list. c. Singly-linked list. d. Doubly-linked list.

ANS a. Circular, singly-linked list.

Q18: How many pointers are contained as data members in the nodes of a circular, doubly linked list of integers

with five nodes? a. 5 b. 8 c. 10 d. 15

ANS c. 10

Q19: Which of the following statements about stacks is incorrect? a. Stacks can be implemented using linked lists. b. Stacks are first-in, first-out (FIFO) data structures. c. New nodes can only be added to the top of the stack. d. The last node (at the bottom) of a stack has a null (0) link. ANS b. Stacks are first-in, first-out (FIFO) data structures.

Q20: Select the incorrect statement. Binary search trees (regardless of the order in which the values are inserted into

the tree): a. Always have multiple links per node. b. Can be sorted efficiently. c. Always have the same shape for a particular set of data. d. Are nonlinear data structures. ANS: c. Always have the same shape for a particular set of data. Q21: Which of the following is not a sequence container provided by the STL? a. vector b. array c. list d. deque

ANS: b. array

Q22: Which of the following is a difference between vectors and arrays? a. Access to any element using the [] operator. b. Stored in contiguous blocks of memory. c. The ability to change size dynamically. d. Efficient direct access to any element.

ANS: c. The ability to change size dynamically.

EECS 211: FUNDAMENTALS OF COMPUTER PROGRAMMING II

5 | Q u i z 4 S o l u t i o n s

The next 3 questions are about the speaker and talk from May 10th which you were asked to attend.

Q23: What was the name of the speaker?

a. Peter Dinda b. Ian Foster c. Alok Choudhary d. Bob Grossman

ANS: b. Ian Foster

Q24: (2 points) What is the one word that describes Grid? a. Distributed b. Federation c. Computing d. Cloud

ANS: b. Federation

Q25: (2 points) What relationship does the speaker have with the instructor? a. He is his professor. b. He doesn't know him personally. c. He is his PhD advisor. d. He is a relative. ANS: c. He is his PhD advisor or a. He is his professor.quotesdbs_dbs21.pdfusesText_27