GoConqr has a new look! Let us know what you think.

Flashcards

INF 675 - Final Exam Study Guide

Kylie H INF 650 12th grade English 184 cards

INF 675 - Final Exam Study Guide

Cards in this deck (184)

  1. 1In AVL tree insert, suppose node w has been inserted by performing standard Binary Search Tree insertion. Starting from w, travel up and find the first unbalanced node. Let z be the first unbalanced node, y be the child of z that comes on the path from w to z and x be the grandchild of z that comes on the path from w to z. Assume the subtree rooted at z as following (here T1, T2, T3, and T4) are subtrees. What shall you do to pre-balance the AVL tree? - Right Rotate z - Left Rotate y then Right Rotate z - Left Rotate z - Right Rotate y then Left Rotate zRight Rotate zIn AVL tree insert, suppose node w has been inserted by performing standard Binary Search Tree insertion. Starting from w, travel up and ...
  2. 2We use (Root, LeftSubTree, RightSubtree) notation to represent a tree. Assume that we have AVL tree (7, 5, (8, NULL, 9)), after insert new node 10, what will be the new AVL tree? Here NULL represent empty subtree. In this case, 8 has no left child. - (7, 5, (9, 8 10)) - (7, 5, (8, NULL, (9, NULL, 10)) - (8, (7, 5, NULL), (9, NULL, 10)) - None of these(7, 5, (9, 8 10)) (The height difference in an AVL tree must be <= 1. Otherwise, it is unbalanced. So, adding 10 makes it unbalanced. When trying to balance, we want to move the least amount of leaves as possible. So moving 8, 9, 10 around can do that)
  3. 3Which of the following is True about AVL tree? - The worst time for insert is O(n) - The worst time for delete is O(n) - The worst time for insert and delete are both O(log n) - The worst time for insert and delete are both O(n)The worst time for insert and delete are both O(log n)
  4. 4A Binary Search Tree (BST) stores values in the range 37 to 573. Consider the following sequence of keys. I. 81, 537, 102, 439, 285, 376, 305 II. 52, 97, 121, 195, 242, 381, 472 III. 142, 248, 520, 386, 345, 270, 307 IV. 550, 149, 507, 395, 463, 402, 270 Suppose the BST has been unsuccessfully searched for key 273. Which all of the above sequences list nodes in the order in which we could have encountered them in the search? - II and III - I and III - III and V - III onlyIII only
  5. 5Consider the following C++ code struct node { int data; structnode *left, *right; }; void print(node *root, int k, int &count) { if (root != NULL && count <= k) { print(root->right, k, count); count++; if (count == k) cout << root->data; print(root->left, k, count); } } what is output of print(root, 3, count); where int count = 0; and root represent the following tree? - 10 - 16 - 20 - 10 2016Consider the following C++ code struct node { int data; structnode *left, *right; }; void print(node *root, int k, int &amp;count) { if (...
  6. 6Suppose the numbers 7, 5, 1, 8, 3, 6, 0, 9, 4, 2 are inserted in that order into an initially empty binary search tree. The binary search tree uses the usual ordering on natural numbers. What is the in-order traversal sequence of the resultant tree? - 7 4 1 0 3 2 4 6 8 9 - 0 2 4 3 1 6 5 9 8 7 - 0 1 2 3 4 5 6 7 8 9 - 9 8 6 4 2 3 0 1 5 70 1 2 3 4 5 6 7 8 9
  7. 7The preorder traversal sequence of a binary search tree is 30, 20, 10, 15, 25, 23, 39, 35, 42. Which one of the following is the postorder traversal sequence of the same tree? - 10, 20 , 15, 23, 25, 35, 42, 39, 30 - 15, 10, 25, 23, 20, 42, 35, 39, 30 - 15, 20, 10, 23, 25, 42, 35, 39, 30 - 15, 10, 23, 25, 20, 35, 42, 39, 3015, 10, 23, 25, 20, 35, 42, 39, 30
    (Preorder: Root, Left, Right. Postorder: Left, Right, Root. Inorder: Left, Root, Right)
  8. 8What is the worst case time complexity for search, insert and delete operations in a general Binary Search Tree? - O(n) for all - O(log n) for all - O(log n) for search and insert; O(n) for delete - O(log n) for search ; O(n) for delete and insertO(n) for all
  9. 9Which of the following traversals is sufficient to construct BST from given traversals 1) Inorder 2) Preorder 3) Postorder - all of three - 1 and 2 - 1 and 3 - 2 and 32 and 3
  10. 10Which of the following statement(s)is / are correct regarding Bellman-Ford shortest path algorithm? P: Always finds a negative weighted cycle, if one exists. Q: Finds whether any negative weighted cycle is reachable from the source. - P only - Q only - Both P and Q - Neither P and QQ only
  11. 11A binary tree T has 20 leaves. The number of nodes in T having two children is - 17 - 18 - 19 - Could be any number between 11 and 19, inclusive19
  12. 12Breadth First Search (BFS) is started on a binary tree beginning from the root vertex. There is a vertex t at a distance four from the root. If t is the n-th vertex in this BFS traversal, then the maximum possible value of n is ___________ - 15 - 16 - 31 - 3231
  13. 13Which of the following is a true about Binary Trees - Every binary tree is either complete or full. - Every full binary tree is also a complete binary tree. - Every complete binary tree is also a full binary tree. - No binary tree is both complete and full - None of the aboveNone of the above
  14. 14Suppose we run Dijkstra’s single source shortest-path algorithm on the following edge weighted directed graph with vertex P as the source. In what order do the nodes get included into the set of vertices for which the shortest path distances are finalized? - P, Q, R, S, T, U - P, Q, R, U, S, T - P, Q, R, U, T, S - P, Q, T, R, U, SP, Q, R, U, S, T
  15. 15You are given pointers to first and last nodes of a double linked list, which of the following operations are dependent on the length of the linked list? - remove the first element of the list - insert in front of the list - remove the last element of the list - add new element at the end of the list - None of theseNone of these
  16. 16Consider the Node structure as following /* Node of a doubly linked list */ struct Node { int data; Node *next; // Pointer to next node in DLL Node *prev; // Pointer to previous node in DLL }; What will be the code for missing step in C++? // may need two lines of code /* Given a reference (pointer to pointer) to the head of a list and an int, inserts a new node on the front of the list. */ void push(struct Node** head_ref, int new_data) { /* 1. allocate new node */ /* 2. put in the data into new node */ /* 3. Make next of new node as head and previous as NULL */ /* 4. ____________________________ */ /* 5. move the head to point to the new node */ } - head_ref->prev = new_node; - (*head_ref)->prev = new_node; - if(head_ref != NULL) head_ref->prev = new_node; - if(*head_ref != NULL) (*head_ref)->prev = new_node;if(*head_ref != NULL) (*head_ref)->prev = new_node;
  17. 17Consider the Node structure as following /* Node of a doubly linked list */ struct Node { int data; Node *next; // Pointer to next node in DLL Node *prev; // Pointer to previous node in DLL }; What will be the code for step 2 in C++? /* Given a node as prev_node, insert a new node after the given node */ void insertAfter(struct Node* prev_node, int new_data) { /*1. check if the given prev_node is NULL */ /* 2. allocate new node */ /* 3. put in the data to the new node */ /* 4. Make next of new node as next of prev_node */ /* 5. Make the next of prev_node as new_node */ /* 6. Make prev_node as previous of new_node */ /* 7. Change previous of new_node's next node */ } - Node new_node; - Node new_node = new Node; - Node *new_node = new Node; - Node *new_node;Node *new_node = new Node;
  18. 18Consider an undirected random graph of eight vertices. The probability that there is an edge between a pair of vertices is 1/2. What is the expected number of unordered cycles of length three? - 1/8 - 1 - 7 - 87
  19. 19Let G be a graph with n vertices and m edges. What is the tightest upper bound on the running time on Depth First Search of G? Assume that the graph is represented using adjacency matrix. - O(n) - O(m + n) - O(mn) - O(n^2)O(n^2)
  20. 20Which of the following statements is/are TRUE for an undirected graph? P: Number of odd degree vertices is even Q: Sum of degrees of all vertices is even - P only - Q only - Both P and Q - Neither P or QBoth P and Q (https://homepage.cs.uri.edu/faculty/hamel/courses/2012/fall2012/csc447/lecture-notes/csc447-ln022.pdf)
  21. 21In a depth-first traversal of a graph G with n vertices, k edges are marked as tree edges. The number of connected components in G is - k - k + 1 - n - k + 1 - n - kn - k
  22. 22Which of the following algorithms can be used to most efficiently determine the presence of a cycle in a given graph ? - Depth First Search - Breadth First Search - Prim's Minimum Spanning Tree Algorithm - Kruskal' Minimum Spanning Tree AlgorithmDepth First Search
  23. 23A hash table of length 10 uses open addressing with hash function h(k)=k mod 10, and linear probing. After inserting 6 values into an empty hash table, the table is as shown below. How many different insertion sequences of the key values will result in the hash table shown above? - 10 - 20 - 30 - 4030A hash table of length 10 uses open addressing with hash function h(k)=k mod 10, and linear probing. After inserting 6 values into an emp...
  24. 24Which of the following statement(s) is TRUE? 1. A hash function takes a message of arbitrary length and generates a fixed length code. 2. A hash function takes a message of fixed length and generates a code of variable length. 3. A hash function may give the same hash value for distinct messages. - 1 only - 2 only - 1 and 3 only - 2 and 3 only1 and 3 only
  25. 25Which one of the following hash functions on integers will distribute keys most uniformly over 10 buckets numbered 0 to 9 for i ranging from 0 to 2020?Which one of the following hash functions on integers will distribute keys most uniformly over 10 buckets numbered 0 to 9 for i ranging f...Which one of the following hash functions on integers will distribute keys most uniformly over 10 buckets numbered 0 to 9 for i ranging f...
  26. 26A 3-ary max heap is like a binary max heap, but instead of 2 children, nodes have 3 children. A 3-ary heap can be represented by an array as follows: The root is stored in the first location, a[0], nodes in the next level, from left to right, is stored from a[1] to a[3]. The nodes from the second level of the tree from left to right are stored from a[4] location onward. An item x can be inserted into a 3-ary heap containing n items by placing x in the location a[n] and pushing it up the tree to satisfy the heap property. Which one of the following is a valid sequence of elements in an array representing 3-ary max heap? - 1, 3, 5, 6, 8, 9 - 9, 6, 3, 1, 8, 5 - 9, 3, 6, 8, 5, 1 - 9, 5, 6, 8, 3, 19, 5, 6, 8, 3, 1
  27. 27Consider a max heap, represented by the array: 40, 30, 20, 10, 15, 16, 17, 8, 4. Now consider that a value 35 is inserted into this heap. After insertion, the new heap is - 40, 30, 20, 10, 15, 16, 17, 8, 4, 35 - 40, 35, 20, 10, 30, 16, 17, 8, 4, 15 - 40, 30, 20, 10, 35, 16, 17, 8, 4, 15 - 40, 35, 20, 10, 15, 16, 17, 8, 4, 3040, 35, 20, 10, 30, 16, 17, 8, 4, 15
  28. 28What is the time complexity of Build Heap operation. Build Heap is used to build a max(or min) binary heap from a given array. Build Heap is used in Heap Sort as a first step for sorting. - O(n log n) - O(n^2) - O(log n) - O(n)O(n)
  29. 29Apply the following insertion sort to array 4 1 2 5 3. Right after i is increased to 2, before the next iteration of loop body, what is the array? - 4 1 2 5 3 - 1 4 2 5 3 - 1 2 4 5 3 - None of these1 4 2 5 3Apply the following insertion sort to array 4 1 2 5 3. Right after i is increased to 2, before the next iteration of loop body, what is t...
  30. 30You are given pointers to first and last nodes of a singly linked list, which of the following operations are dependent on the length of the linked list? - remove the first element of the list - insert in front of the list - remove the last element of the list - add new element at the end of the listremove the last element of the list
  31. 31- prev_node->next = new_node; - prev_node = new_node; - prev_node = new_node -> next; - prev_node->next = NULL;prev_node->next = new_node;- prev_node-&gt;next = new_node; - prev_node = new_node; - prev_node = new_node -&gt; next; - prev_node-&gt;next = NULL;
  32. 32What is the output of following function for start pointing to second node of following linked list? 1->2->3->4->5->6 - 2 4 6 6 4 2 - 1 3 5 5 3 1 - 2 4 6 2 4 6 - 1 3 5 1 3 52 4 6 6 4 2What is the output of following function for start pointing to second node of following linked list? 1-&gt;2-&gt;3-&gt;4-&gt;5-&gt;6 - 2 ...
  33. 33Suppose that we use merge sort algorithm to sort the following array: {3, 6, 1, 7, 2, 8, 5, 4}. What will be the array right before the last call of merge? - {1, 2, 3, 4, 5, 6, 7, 8} - {1, 3, 6, 7, 2, 4, 5, 8} - {3, 6, 1, 7, 2, 8, 4, 5} - {2, 4, 5, 8, 1, 3, 6, 7}{1, 3, 6, 7, 2, 4, 5, 8}
  34. 34Given array {3, 7, 6, 5, 2, 1, 8, 4}, use quick sort algorithm to sort the array. what will be the return value from the first call of partition? Assume the last element is used as pivot for partition and array index starts from 0. - 4 - 5 - 6 - 33
  35. 35Which of the following is not a stable sort? - Insertion sort - selection sort - merge sort - quick sortquick sort
  36. 36If we use binary search algorithm to search 1 4 8 9 11 15 19 20 25 28 32 35 36 48 52 for key 17, list the elements that will be compared with key in order of when the comparison happens - 20 9 15 19 - 20 9 15 17 - 20 35 28 17 - none of these20 9 15 19
  37. 37If we use binary search algorithm to search 5 4 8 9 21 15 19 20 25 28 32 35 36 48 52 for key 17, list the elements that will be compared with key in order of when the comparison happens - 20 9 15 19 - 1 8 15 - none of these answers - cannot use binary search algorithm because the key is not in the arraynone of these answers
    (The Binary Search algorithm requires that the array is sorted)
  38. 38What is the run time of binary search? - O(n) - O(n^2) - O(ln n) - O(1)O(ln n)
  39. 39Use the following selection sort to sort int array {2, 5, 3, 6, 4, 1}, Right after i is increased to 3, before the next outer loop, what is the array? - {2, 5, 3, 6, 4, 1} - {1, 5, 3, 6, 4, 1} - {1, 2, 3, 6, 4, 5} - {1, 2, 3, 4, 6, 5}{1, 2, 3, 6, 4, 5}Use the following selection sort to sort int array {2, 5, 3, 6, 4, 1}, Right after i is increased to 3, before the next outer loop, what ...
  40. 40Is the following statement valid about shortest paths? Given a graph, suppose we have calculated shortest path from a source to all other vertices. If we modify the graph such that weights of all edges is becomes double of the original weight, then the shortest path remains same only the total weight of path changes. - True - False- True
  41. 41What is miss from the outer loop head in following insertion sort algorithm? - i = 1; i < n; i++ - i = 0; i < n; i++ - i = 1; i < n - 1; i++ - i = 0; i < n - 1; i++i = 1; i < n; i++What is miss from the outer loop head in following insertion sort algorithm? - i = 1; i &lt; n; i++ - i = 0; i &lt; n; i++ - i = 1; i &lt...
  42. 42What does the following function do? - print out first n Fibonacci numbers - print out first n Fibonacci numbers reversely - print numbers 0 to n-1 - print out numbers 0 to n-1 reverselyprint out first n Fibonacci numbersWhat does the following function do? - print out first n Fibonacci numbers - print out first n Fibonacci numbers reversely - print number...
  43. 43Consider the following C++ function: what dose this function do in general? - print the binary representation of n in reverse order - print the binary representation of n - print the value of square root of n print the value of square root of n in reverse orderprint the binary representation of nConsider the following C++ function: what dose this function do in general? - print the binary representation of n in reverse order - pri...
  44. 44The following postfix expression with single digit operands is evaluated using a stack: 8 1 3 + / 2 3 * + 5 1 * - The top two elements of the stack after the first * is evaluated are: - 6, 2 - 5, 7 - 6, 3 - 1, 56, 2
  45. 45What is the worse case run time for following algorithm? CountDuplicatePairs This algorithm counts the number of duplicate pairs in a sequence. Input: a1, a2,...,an, where n is the length of the sequence. Output: count = the number of duplicate pairs. - O(n) - O(1) - O(n^2) -O(n^3)O(n^2)What is the worse case run time for following algorithm? CountDuplicatePairs This algorithm counts the number of duplicate pairs in a seq...
  46. 46What is the worse case run time for following algorithm? MaximumSubsequenceSum Input: a1, a2,...,an n, the length of the sequence. Output: The value of the maximum subsequence sum. - O(n) - O(1) - O(n^2) - O(n logn)O(n^2)What is the worse case run time for following algorithm? MaximumSubsequenceSum Input: a1, a2,...,an n, the length of the sequence. Output...
  47. 47Consider the following brute force factoring algorithm. How many numbers the algorithm will check if N = 123457 which happen to be a prime number? Input: Integer N greater than 1. Output: "Prime" if N is prime. If N is composite, return two integers greater than 1 whose product is N. - 123455 - 351 - 123457 - 1123455Consider the following brute force factoring algorithm. How many numbers the algorithm will check if N = 123457 which happen to be a prim...
  48. 48What is the Big O notation for following run time function? - O(n^2) - O(2^n) - O(1) - O(n logn)O(2^n)What is the Big O notation for following run time function? - O(n^2) - O(2^n) - O(1) - O(n logn)
  49. 49By the law of Boolean Algebra, - x - y - xyxBy the law of Boolean Algebra, - x - y - xy
  50. 50Which boolean function derived from following table?Which boolean function derived from following table?Which boolean function derived from following table?
  51. 51Which of the following Boolean function represents the following circuit?Which of the following Boolean function represents the following circuit?Which of the following Boolean function represents the following circuit?
  52. 52A Boolean expression that is a sum of products of literals is said to be in disjunctive normal form (DNF) . A Boolean expression that is a product of sums of literals is said to be in conjunctive normal form (CNF). Indicate whether the following Boolean expressions are in conjunctive normal form or disjunctive normal form or both or neither. yxzw - DNF - CNF - Both - NeitherBoth
  53. 53Design a circuit from a description of the circuit in English. The output is 1 if all three inputs are 1 - f(x, y, z) = x + y + z - f(x, y, z) = xy + yz + zx - f(x, y, z) = xyzf(x, y, z) = xyz
  54. 54Use Euclid's Algorithm to calculate gcd (72, 27). The result is: - 1 - 3 - 9 - 279
  55. 55The two linear equations above can be used to express gcd(225, 60) as a linear combination of 225 and 60: 15 = C · 225 + D · 60 What is the correct value for C? - 1 - 4 - -1 - -4-1
  56. 56Count the number of binary strings of length 8 subject to each of the following restrictions: There is at least one 0 and one 1. - 2^8 - 2^7 - 2^8 - 1 - 2^8 - 22^8 - 2
  57. 57Given characteristic equation for a recurrence relation. Express the solution to recurrence relation as a linear combination of terms. (x-1)(x+2) = 0Given characteristic equation for a recurrence relation. Express the solution to recurrence relation as a linear combination of terms. (x...
  58. 58Solve each of the following recurrence equation with the given initial values.Solve each of the following recurrence equation with the given initial values.Solve each of the following recurrence equation with the given initial values.
  59. 59Solve each of the following recurrence equation with the given initial values.Solve each of the following recurrence equation with the given initial values.Solve each of the following recurrence equation with the given initial values.
  60. 60In a room there are only two types of people, namely Type 1 and Type 2. Type 1 people always tell the truth and Type 2 people always lie. You give a fair coin to a person in that room, without knowing which type he is from and tell him to toss it and hide the result from you till you ask for it. Upon asking, the person replies the following: “The result of the toss is head if and only if I am telling the truth.” Which of the following options is correct? - The result is head - The result is tail - If the person is of Type 2, then the result is tail - If the person is of Type 1, then the result is tailThe result is head
  61. 61Which of the following is the negation of [∀ x, α → (∃y, β → (∀ u, ∃v, y))]? - [∃ x, α → (∀y, β → (∃u, ∀ v, y))] - [∃ x, α → (∀y, β → (∃u, ∀ v, ¬y))] - [∀ x, ¬α → (∃y, ¬β → (∀u, ∃ v, ¬y))] - [∃ x, α ʌ (∀y, β ʌ (∃u, ∀ v, ¬y))][∃ x, α ʌ (∀y, β ʌ (∃u, ∀ v, ¬y))]
  62. 62—
  63. 63—
  64. 64—
  65. 65What is the multiplicative inverse of 6 Mod 7? - 1 - 3 - 6 -56
  66. 666 people line up for a wedding picture, how many different ways to do this? - 6 - 6! - 6! / 2 - 5!6!
  67. 67—
  68. 68—(The LCM will be combining both prime factorizations, but only keeping the ones with the highest exponent between the two numbers)(The LCM will be combining both prime factorizations, but only keeping the ones with the highest exponent between the two numbers)(The LCM will be combining both prime factorizations, but only keeping the ones with the highest exponent between the two numbers)
  69. 69For every integer n, if n^2 is an odd, then n is odd. What is the best way to proof the above statement? - Direct proof - proof by mathematical induction - proof by cases - proof by contrapositiveproof by contrapositive
  70. 70If x and y are both even, then x + y is even. Proof: Assume that x = 2m, y = 2n, then x + y = 2 (m + n) which is even. The above proof method is: - direct proof - proof by contradiction - proof by contrapositive - proof by mathematical inductiondirect proof
  71. 71—
  72. 72Which of the following are propositions? - Give me a cup of tea, please - He likes to drink tea. - Would you like to have a cup of tea? - This tea tastes good.- He likes to drink tea.
    - This tea tastes good.
  73. 73Identify the correct translation into logical notation of the following assertion. "Some boys in the class are taller than all the girls" Note : taller(x,y) is true if x is taller than y. - (∃x) (boy(x) → (∀y) (girl(y) ∧ taller(x,y))) - (∃x) (boy(x) ∧ (∀y) (girl(y) ∧ taller(x,y))) - (∃x) (boy(x) → (∀y) (girl(y) → taller(x,y))) - (∃x) (boy(x) ∧ (∀y) (girl(y) → taller(x,y)))(∃x) (boy(x) ∧ (∀y) (girl(y) → taller(x,y)))
  74. 74The following propositional statement (P → (Q v R)) → ((P ^ Q) → R) is: - satisfiable but not valid - valid - a contradictionsatisfiable but not valid
  75. 75Which one of these first-order logic formula is valid? - ∀x(P(x) => Q(x)) => (∀xP(x) => ∀xQ(x)) - ∃x(P(x) ∨ Q(x)) => (∃xP(x) => ∃xQ(x)) - ∃x(P(x) ∧ Q(x)) <=> (∃xP(x) ∧ ∃xQ(x)) - ∀x∃y P(x, y) => ∃y∀x P(x, y)∀x(P(x) => Q(x)) => (∀xP(x) => ∀xQ(x))
  76. 76—
  77. 77—AA
  78. 78Suppose that A = {1, 2, 3, 4, 5, 6}, B = {3, 4, 5}, C = {1, 2, 4}, what is A - (B - C)? - {1, 2, 4, 6} - {6} - {4, 5}{1, 2, 4, 6}
  79. 79Simplify the following Boolean Expression: (x+y)xy + xz - x(y+z) - y(x+z) - z(x+y) - xyzx(y+z)
  80. 80A bit string consists of 0s and 1s. For example, 0101 is a bit string with four bits. How many bits strings with length 6 or 5 that begins with 0? - 64 - 48 - 24 - 3248
  81. 81Which one of the following hash functions on integers will distribute keys most uniformly over 10 buckets numbered 0 to 9 for i ranging from 0 to 2020?Which one of the following hash functions on integers will distribute keys most uniformly over 10 buckets numbered 0 to 9 for i ranging f...
  82. 82What is the output of the following Java code segment? int arr[2]; System.out.println(arr[0]); System.out.println(arr[1]); - Compile error -0 0 -garbage value garbage value -Running time ExceptionCompile error
  83. 83What is the output of the following Java progam? - 99 - 2 - Run time except at line 8 - Compile error in line 8 Compile error in line 92What is the output of the following Java progam? - 99 - 2 - Run time except at line 8 - Compile error in line 8 Compile error in line 9
  84. 84What is the output of the following Java program? - -1 - 4 - There is compile error - There is run time error since the array to be searched is not sorted4What is the output of the following Java program? - -1 - 4 - There is compile error - There is run time error since the array to be searc...
  85. 85What is the output of the following code? BigDecimal d1 = new BigDecimal("1.11"); BigDecimal d2 = new BigDecimal("2.22"); System.out.println(d1 + d2); - 3.33 - 1.112.22 - There is a syntax error - 1.11+2.22There is a syntax error
  86. 86What is true about the following Java code segment? - There is no compile error - Compile error in line 6 - Compile error in line 10 - Compile error in line 11Compile error in line 11What is true about the following Java code segment? - There is no compile error - Compile error in line 6 - Compile error in line 10 - Co...
  87. 87What will be the output of following piece of code? System.out.println("/"Hello World/""); - Syntax error - Run time error - "Hello World" - Hello WorldSyntax error
  88. 88What is the outcome of the following code? - Compile error - 0 - 10 - No compile error but will throw ArithmeticException exceptionNo compile error but will throw ArithmeticException exceptionWhat is the outcome of the following code? - Compile error - 0 - 10 - No compile error but will throw ArithmeticException exception
  89. 89What is the output of the following Java program? - Divide by zero error - inside the finally block - Divide by zero error inside the finally block - 0, Divide by zero error inside the finally blockDivide by zero error
    inside the finally block
    What is the output of the following Java program? - Divide by zero error - inside the finally block - Divide by zero error inside the fin...
  90. 90What is true about the following Java program - There is a compile warning message indicates that one catch clause can never be reached. However, the program still can run and the output will be:Caught derived class exception - There is no compile warning or error. The output will be: Caught derived class exception - Compile error in line 9 - Compile error in line 12Compile error in line 12What is true about the following Java program - There is a compile warning message indicates that one catch clause can never be reached. ...
  91. 91Suppose I have the following Scanner object: File file = new File("data.txt") Scanner input = new Scanner(file); After I read data from file, which of the following close the file? - file.close() - input.close(file); - input.close(); - file.close(input);input.close();
  92. 92What is the output of the following code? - 0 - 9 - 21 - There is a syntax error9What is the output of the following code? - 0 - 9 - 21 - There is a syntax error
  93. 93What is the output of the following Java program? - Compile error in line 15 - Compile error in line 23 - Grandparent Parent Child - Gradparent ChildCompile error in line 15
    (Cannot du super.super.fun())
    What is the output of the following Java program? - Compile error in line 15 - Compile error in line 23 - Grandparent Parent Child - Grad...
  94. 94What is the value of x after the execution of the following line of code? int x = (int) (Math.random()*100); - Syntax error - 1 - A random integer between 1 and 100, inclusive - A random integer between 0 and 99, inclusiveA random integer between 0 and 99, inclusive
  95. 95What is the output of the following Java code? - x = 10 y = 20 - x = 20 y = 10 - Compile error in mySwap method - Compile error in main methodx = 10 y = 20What is the output of the following Java code? - x = 10 y = 20 - x = 20 y = 10 - Compile error in mySwap method - Compile error in main m...
  96. 96What is the output of the following Java code? - 1 - compile error at line 3 - compile error at line 6 - compile error at line 71What is the output of the following Java code? - 1 - compile error at line 3 - compile error at line 6 - compile error at line 7
  97. 97What is the output of the following code? - x = 10 y = 20 - x = 20 y = 10 - Compile error(s) in mySwap method - Compile error(s) in main methodCompile error(s) in main method
    (the mySwap method is not a static method)
    What is the output of the following code? - x = 10 y = 20 - x = 20 y = 10 - Compile error(s) in mySwap method - Compile error(s) in main ...
  98. 98Suppose in.txt contains one line of data: "Hello World". What will be the content of out.txt after execute the following Java program. Suppose open file to read and open file to write both successfully. - Hello World - HELLO WORLD - Compile error - NothingHELLO WORLDSuppose in.txt contains one line of data: "Hello World". What will be the content of out.txt after execute the following Java program. Su...
  99. 99What will the output in file data.txt after we execute the following Java program? - nothing in file - HelloWorld - Hello World - Compile error in line 5nothing in file (PrintWriter MUST use .flush() to push everything into the file. Then the file must .close())What will the output in file data.txt after we execute the following Java program? - nothing in file - HelloWorld - Hello World - Compile...
  100. 100What will the output in file data.txt after we execute the following Java program? - nothing in file - HelloWorld - Hello World - Compile error in line 3 - Compile error in line 5Compile error in line 5What will the output in file data.txt after we execute the following Java program? - nothing in file - HelloWorld - Hello World - Compile...
  101. 101BigInteger class belongs to which of the following package? - java.lang - java.util - java.math - java.iojava.math
  102. 102What is the output of the following code? - Base::fun() called - Derived::fun() called - Compile error in line 15 - Compile error in line 16Derived::fun() called (without the keyword static in both fun(), the child is calling the fun() that is declared in the child's class)What is the output of the following code? - Base::fun() called - Derived::fun() called - Compile error in line 15 - Compile error in line 16
  103. 103What is the output of the following code? - Base::fun() called - Derived::fun() called - Compile error in line 16 - Compile error in line 8Base::fun() called (the keyword static in both fun(), means that the child is calling the fun() that is most superior to it)What is the output of the following code? - Base::fun() called - Derived::fun() called - Compile error in line 16 - Compile error in line 8
  104. 104Suppose we have Random rand = new Random(); Which of the following expression generates a random integer between 20 and 100, inclusive? - Math.abs(rand.nextInt()) % 80 + 20 - rand.nextInt() % 80 + 20 - Math.abs(rand.nextInt()) % 81 + 20 - rand.nextInt() % 81 + 20Math.abs(rand.nextInt()) % 81 + 20
  105. 105What is the output of the following code if user typed: 1 2 3 then hit Enter Key? (there are spaces between numbers) Scanner input = new Scanner(System.in); int x = input.next(); System.out.println(x); - There is a syntax error - There is a run time error - 1 - 123There is a syntax error (next() is a string and compiler will not allow it to be converted to int)
  106. 106What is the output of the following code if user typed: Hello World then hit Enter Key? Scanner input = new Scanner(System.in); String greeting = input.nextLine(); System.out.println(greeting); - There is a syntax error - There is run time error - Hello - Hello WorldHello World
  107. 107What is the output of the following Java code segment? String s = "Hello"; // 1 System.out.println(s.size()); // 2 - 5 - 6 - Compile error in line //1 - Compile error in line //2Compile error in line //2
  108. 108What is the output of the following Java program? - Good Morning! - Compile error in line 4 - Compile error in line 5 - Compile error in line 6Good Morning!What is the output of the following Java program? - Good Morning! - Compile error in line 4 - Compile error in line 5 - Compile error in ...
  109. 109What is the output of the following Java code segment? StringBuilder s = new StringBuilder("Hello"); s.replace(1, 7, "World"); //1 System.out.println(s); - HWorldo - Compile error in line //1 - HWorld - StringIndexOutOfBoundsException at line //1HWorld
  110. 110What is the output of the following code segment? char c = 'A'; System.out.println(c+32); - c32 - 97 - There is a compile error - a97
  111. 111What is the output of the following code segment? int x = (int) 5.6789; System.out.println(x); - 5 - 6 - There is a compile error - There is a run time error5
  112. 112What is the output of the following code? - 0 - garbage value - Compile error at line //1 - Compile error at line //20What is the output of the following code? - 0 - garbage value - Compile error at line //1 - Compile error at line //2
  113. 113What is the output of the following code? - 15 - 20 - There is a syntax error in line 12 - There is a syntax error in line 1020What is the output of the following code? - 15 - 20 - There is a syntax error in line 12 - There is a syntax error in line 10
  114. 114Assume char c = 'A'; Which of the following change value of c to 'a'? - Character.toLowerCase(c); - c = Character.toLowerCase(c); - c.toLowerCase(); - c = c.toLowerCase();c = Character.toLowerCase(c);
  115. 115Which of the following method is NOT a method in Double class? - static Double valueOf(double) - static Double valueOf(String) - String toString() - double valueOf(String)double valueOf(String)
  116. 116Which of the following return true if char c is an English letter.Assume that c has been initialized. - Character.isLetter(c) - Character.isAlpha(c) - Character.isDigit(c) - Character.isLetterOrDigit(c)Character.isLetter(c)
    Character.isLetterOrDigit(c)
  117. 117What is the output of the following Java program? - 1,2 - 2, 3 - There is a compile error - There is a run time exception2, 3What is the output of the following Java program? - 1,2 - 2, 3 - There is a compile error - There is a run time exception
  118. 118What is the output of the following Java progam? - true - false - Compile error in line 4 - Compile error in line 10falseWhat is the output of the following Java progam? - true - false - Compile error in line 4 - Compile error in line 10
  119. 119What is the output of the following Java progam? - true - false - Compile error in line 7 - Compile error in main functintrueWhat is the output of the following Java progam? - true - false - Compile error in line 7 - Compile error in main functin
  120. 120What is the output of the following code if the value of score is 100? Assume variables score and grade has been declared as int and char, respectively. - A - U - There is a compile error in line 19 - There is a compile error in line 21AWhat is the output of the following code if the value of score is 100? Assume variables score and grade has been declared as int and char...
  121. 121What is the output of the following code if user's input is 8? - 1 - 2 - 0 - There is a compile error in code2What is the output of the following code if user's input is 8? - 1 - 2 - 0 - There is a compile error in code
  122. 122Which of the following is the correct head of main function in java? - public static void main(String [] args) - public void main(String [] args) - public static void main(String args) - public static int main(String [] args)public static void main(String [] args)
  123. 123Consider the following implementation, what is the correct? - This implementation is correct. It will compare two strings as built-in strcmp function does - This implementation is incorrect. The two arguments shall not be const char * - This implementation is incorrect since there will be infinite loop - This implementation is incorrect since there are some syntax errorThis implementation is correct. It will compare two strings as built-in strcmp function doesConsider the following implementation, what is the correct? - This implementation is correct. It will compare two strings as built-in str...
  124. 124What is the output of the following Java code? - 100 - 0 - Compile error in line 6 - Compile error in lin 10100What is the output of the following Java code? - 100 - 0 - Compile error in line 6 - Compile error in lin 10
  125. 125What is the output of the following Java program? - a = 10 - a = 20 - Compile error in line 17 - Compile error in line 23a = 20What is the output of the following Java program? - a = 10 - a = 20 - Compile error in line 17 - Compile error in line 23
  126. 126What is the output of the following Java program? - MyClass@xxxxxxxx where xxxxxxxx is some hexadecimal number - 0 - Compile error in line 6 - Run time exceptionMyClass@xxxxxxxx where xxxxxxxx is some hexadecimal numberWhat is the output of the following Java program? - MyClass@xxxxxxxx where xxxxxxxx is some hexadecimal number - 0 - Compile error in lin...
  127. 127Which of the following access a variable named next in structure *student ? - student - student->next - student-next - student'nextstudent->next
  128. 128Which of the following code calculate the sum of all elements in given array int a[SIZE}; where SIZE is an int constant that has been initialized. Assume a has been initialized. - int result; for(int i = 0; i < SIZE; i++) result += a[I]; - int result = 0; for(int i = 0; i < SIZE; i++) result += a[I]; - int result = 1; for(int i = 0; i < SIZE; i++) result *= a[I]; - int result = 0; for(int i = 0; i < SIZE; i++) result *= a[i];int result = 0;
    for(int i = 0; i < SIZE; i++)
    result += a[i];
  129. 129Assume int x = 15; int y = 10; What will be the y value after the execution of following C++ code segment? if(x > y) if(x > 20) y = 6; else y = 7; - 6 - 7 - 10 - There is a syntax error7
  130. 130Assume int x = 5; int y = 10; What will be the y value after the execution of following C++ code segment? if(x > y){ y = 8; } else{ if(x > 20); y = 5; } - 5 - 8 - 10 - There is a syntax error5
  131. 131True or false? Regarding the following two rules of when to write Big Three: Copy Constructor, Assignment Operator, and Destructor? 1. Only write the one you will explicitly use in your program. For instance, you may write Copy Constructor but not destructor. 2. Prefer to write these methods even if the implicit ones are correct. - True, True - True, False - False, True - False, FalseFalse, False
  132. 132Assume that char name[80] = "John Doe"; char nameCopy[80]; Whihc of the following assign "John Doe" to nameCopy? - nameCopy = name; - strcpy(nameCopy, name); - strcpy(name, nameCopy); - name = nameCopy;strcpy(nameCopy, name);
  133. 133Which of the following is needed in order to execute the following statement: time_t timer; - #include - #include - #include - There is a syntax error#include
  134. 134Which of the following is the head of copy constructor of Employee class? - Employee() - Employee(const Employee& other) - void Employee() - Employee(Employee& other) - void Employee(Employee& other) - void Employee(const Employee& other)Employee(const Employee& other)
  135. 135Which of the following is the head of destructor of Employee class? - ~Employee() - ~Employee(const Employee& other) - void ~Employee() - ~Employee(Employee& other) - void ~Employee(Employee& other) - void ~Employee(const Employee& other)~Employee()
  136. 136What is the output of the following piece of code? int i = 0; do{ cout << i << ", "; }while (++i <= 5) - 5, - 1, 2, 3, 4, 5, - This is an infinity loop, nothing output - There is a syntax error - 6,There is a syntax error
  137. 137What is the output of the following code? - 0 - 1 - 6 - There is a syntax error6What is the output of the following code? - 0 - 1 - 6 - There is a syntax error
  138. 138What is the output? - Constructing 1 Constructing 2 Constructing 3 Destructing 2 Destructing 1 Caught 3 - Constructing 1 Constructing 2 Constructing 3 Destructing 3 Destructing 2 Destructing 1 Caught 2 - Constructing 1 Constructing 2 Constructing 3 Destructing 1 Destructing 2 Caught 3 - There is a syntax errorConstructing 1
    Constructing 2
    Constructing 3
    Destructing 2
    Destructing 1
    Caught 3
    What is the output? - Constructing 1 Constructing 2 Constructing 3 Destructing 2 Destructing 1 Caught 3 - Constructing 1 Constructing 2 C...
  139. 139What is the output? - Inside Catch Outside Catch -Inside Catch -Outside Catch -There is a syntax errorInside Catch
    Outside Catch (When throw; occurs, it rethrows 10.)
    What is the output? - Inside Catch Outside Catch -Inside Catch -Outside Catch -There is a syntax error
  140. 140Which statement can never be reach in following code? - cout << "Before throw \n"; - cout << "After throw \n"; - cout << "Caught Exception \n"; - cout << "After catch \n";cout << "After throw \n";Which statement can never be reach in following code? - cout &lt;&lt; "Before throw \n"; - cout &lt;&lt; "After throw \n"; - cout &lt;&lt...
  141. 141Which of the following are best code to continue if the file open fails - cout << "Cannot open file. Exit the progam"; exit(1); - cout << "Cannot open file. Exit the progam"; exit(0); - exit(1); - exit(0);cout << "Cannot open file. Exit the progam";
    exit(1);
  142. 142Suppose that outFile is an ofstream connected to file named "output.txt". What will be output to output.txt file due to following code? int x = 5; outFile.setf(ios::showpos); outFile << x; - 5 - +5 - 5.0 - -5+5
  143. 143What is the output of the following piece of code? for(int i = 0; i < 5; i++); cout << i << ", "; - 0, 1, 2, 3, 4, 5, - 0, 1, 2, 3, 4, 5, 6 - 4, - 6, - There is a syntax errorThere is a syntax error
  144. 144Given three functions: int fun(int x) { return x*x;} double funny(int x) { return x;}; double fun(double x) { return x;} What is the output of the following code: cout << setprecision(2) << funny(2.0); - 2 - 2.0 - 4.0 - There is a compile error2
  145. 145Suppose that the base class has a private attribute int id; then which of the following methods the child class will use to manipulate id? - int getId() const; - int setId(int _id); - void getId() const; - void setId(int _id);int getId() const;
    void setId(int _id);
  146. 146By using which operator does point to next element is represent in iterator? - ++ - -- - + - -++
  147. 147Suppose we have the following definition: vector vec, vec1; //use push_back to put 10 values into vec vector::iterator p = vec.begin(); vector::const_iterator q = vec.begin(); Which of the following expressions is NOT legal? Treat the effect of these as non-cumulative. - p = vec.end (); - *p = 1; - q = vec1.end(); - *q = 1;*q = 1;
  148. 148What is the output? - 30 - 40 - 50 - 6050What is the output? - 30 - 40 - 50 - 60
  149. 149If the name of the input file was in a variable named filename, which of the following is the correct way to open the input stream named inFile and associate it with this file? - inFile.open(filename); - inFile.open("filename"); - inFile = filename; - inFile = "filename";inFile.open(filename);
  150. 150Assume that I have a Student class, and I overloaded the operators >> and << for Student class. If I want to input a Student object from keyboard, which of the following code is correct? Assume the Student object variable name is s. - cin >> s; - cout << s; - s >> info; - Cannot do itcin >> s;
  151. 151To overload functions with symbolic names (like + - / <<), you must use the keyword ________ before the symbolic name. - operator - const - void - referenceoperator
  152. 152Suppose that I have function - 5, 10 - 10, 5 - There is a syntax error - There is a run time errorThere is a syntax error (when calling the function, &'s need to be used)Suppose that I have function - 5, 10 - 10, 5 - There is a syntax error - There is a run time error
  153. 153Suppose that I have function - 5, 10 - 10, 5 - There is a syntax error - There is a run time error5, 10Suppose that I have function - 5, 10 - 10, 5 - There is a syntax error - There is a run time error
  154. 154Suppose that I have function - 5, 10 - 10, 5 - There is a syntax error - There is a run time error10, 5 (when not using *, the ampersand & only needs to be in the declaration of the function, not the calling)Suppose that I have function - 5, 10 - 10, 5 - There is a syntax error - There is a run time error
  155. 155Consider the following implementation, what is the correct? - This implementation is correct. It will compare two strings as built-in strcmp function does - This implementation is incorrect. When the subtraction happens, str1 and str2 are not pointing to the first different chars. - This implementation is incorrect since there will be infinite loop - This implementation is incorrect since there are some syntax errorThis implementation is incorrect. When the subtraction happens, str1 and str2 are not pointing to the first different chars.Consider the following implementation, what is the correct? - This implementation is correct. It will compare two strings as built-in str...
  156. 156Which of the following mystrlen is the best implementation? - size_t mystrlen(const char * source){ size_t result = 0; while(*source != '\0') result++; return result; } - size_t mystrlen(constchar * source){ size_t result = 0; while(*source++ != '\0') result++; return result; } - size_t mystrlen(char * source){ size_t result = 0; while(*source != '\0'){ result++; source++; } return result; } - size_t mystrlen(const char * source){ size_t result = 0; while(*++source != '\0') result++; return result; }size_t mystrlen(const char * source){
    size_t result = 0;
    while(*source++ != '\0')
    result++;
    return result;
    }
  157. 157What will be the output of the code? Assume user types 5 on keyboard? int *p, x; p = new int; *p = 10; cin >> x; p = &x; cout << ++*p; - 5 - 6 - 10 - 11 - There is a syntax error6
  158. 158Give the following simplified classes and code, what is the output of the last statement? - My name is rover - My name is rover, My breed is Collie - , My breed is Collie - Nothing will be printed. The last statement has syntax errorNothing will be printed. The last statement has syntax errorGive the following simplified classes and code, what is the output of the last statement? - My name is rover - My name is rover, My breed...
  159. 159Give the following simplified classes and code, what is the output of the last statement? - My name is roverMy breed is Collie - My name is rover My breed is Collie - My breed is Collie - Nothing will be printedMy name is roverMy breed is CollieGive the following simplified classes and code, what is the output of the last statement? - My name is roverMy breed is Collie - My name ...
  160. 160In the following function template, what must be TRUE in order to use the function with a given data type? - The data type must be character based. - The data type must have a < operator defined for it. - The data type must be numeric. - The data type must be a pre-defined data type.The data type must have a < operator defined for it.In the following function template, what must be TRUE in order to use the function with a given data type? - The data type must be charac...
  161. 161Output of following program? Assume that the size of int is 4 bytes and size of double is 8 bytes, and there is no alignment done by the compiler. - 16 24 - 8 16 - 20 28 - There is a syntax error16
    24
    Output of following program? Assume that the size of int is 4 bytes and size of double is 8 bytes, and there is no alignment done by the ...
  162. 162What is the output? Assume that the size of char is 1 byte and size of int is 4 bytes, and there is no alignment done by the compiler. - 6 12 - 2 8 - 8 8 - There is a syntax error2
    8
    What is the output? Assume that the size of char is 1 byte and size of int is 4 bytes, and there is no alignment done by the compiler. - ...
  163. 163Which of the following declare and initialize a character type variable name grade with value 'A'? - char grade = A; - char grade = "A"; - char grade = 'A'; - char grade = "A"char grade = 'A';
  164. 164Suppose I have the following recursive function, what is the return value when call myop(4)? int myop(int n){ if(n <= 2) return 1; return 1 + myop(n-1) + myop(n-2); } - 5 - 6 - 7 - 85
  165. 165Suppose the input is 1234. What is the output of the following function? void display(int x){ if(x < 10){ cout << x; return; } display(x/10); cout << x%10 << ", "; } - 1, 2, 3, 4 - 1, 2, 3, 4, - 12, 3, 4, - 12, 3, 412, 3, 4,
    (When x is 1, the if statement will go through BUT there is not , to separate the numbers. Additionally, 4 has a comma after it)
  166. 166Assume that I have a structure: struct Student{ string name; int id; double gpa; Student* next; }; Student *student = new Student; How to I assign the student gpa as 3.85? - student.gpa = 3.95; - student->gpa = 3.95; - student-gpa = 3.95; - student'gpa = 3.95;student->gpa = 3.95;
  167. 167What is the value of numbers.capacity() after the following code? vector numbers; numbers.reserve(100) - 0 - 10 - 100 - Unknown100 (numbers.size() would say how many indexes in the vectora are currently being used. numbers.capacity() indicates the MAXIMUM load of integers that the vector can have at once)
  168. 168Predict output of the following program - I am base I am base - I am base I am derived - I am derived I am base - I am derived I am derivedI am derived
    I am derived
    Predict output of the following program - I am base I am base - I am base I am derived - I am derived I am base - I am derived I am derived
  169. 169Which of the following should be virtual if a base class uses dynamic memory allocation? - The constructor - The copy constructor - all public functions - The destructorThe destructor
  170. 170Which of the following is true about pure virtual functions? 1) Their implementation is not provided in a class where they are declared. 2) If a class has a pure virtual function, then the class becomes abstract class and an instance of this class cannot be created. - Both 1 and 2 are correct - Only 1 is correct - Only 2 is correct - Neither 1 nor 2 is correctOnly 2 is correct
  171. 171What will be the output after the execution of the following piece of code? - Excellent - Good - Average - Work harder - There is a syntax errprThere is a syntax errorWhat will be the output after the execution of the following piece of code? - Excellent - Good - Average - Work harder - There is a synta...
  172. 172Which of the following doesn't have 5 as output? - int x = 5; cout << x++; - int x = 5; cout << ++x; - cout << 40/7; - cout << 40%7;int x = 5;
    cout << ++x;
  173. 173What is the output of the following piece of code? int i = 0; while(++i <= 5) cout << i << ", "; - 0, 1, 2, 3, 4, 5, - 1, 2, 3, 4, 5, - This is an infinity loop, nothing output - There is a syntax error - 1, 2, 3, 4, 5, 6,1, 2, 3, 4, 5,
  174. 174- int result = 1; - return 0; - return 1; - return 2;return 1;- int result = 1; - return 0; - return 1; - return 2;
  175. 175Which of the following is correct definition for Student structure which is used in LinkedList that stores student's info: id, gpa, name? - struct Student{ int id; double gpa; string name; Student* next; }; - struct student{ int id; double gpa; string name; Student next; }; - struct Student{ int id; double gpa; string name; Student* next; } - structure Student{ int id; double gpa; string name; Student* next; };struct Student{
    int id;
    double gpa;
    string name;
    Student* next;
    };
  176. 176What is the output of the following code? vector names; names.push_back("Tom"); names.push_back("Jack"); cout << names.size() << ", " << names[1] << endl; - 2, Jack - 2, Tom - 10, Jack - There is a syntax error2, Jack
  177. 177Which assignment statements will copy the value " toaster" into a string variable (str1)? - strcpy(str1,"toaster"); - str1 = "toaster"; - str1 = toaster; - str1 += toaster;str1 = "toaster";
  178. 178What is the output of the following code? - 0 - 1 - 6 - There is a syntax error6What is the output of the following code? - 0 - 1 - 6 - There is a syntax error
  179. 179What is the output? - Constructing 1 Constructing 2 Constructing 3 Destructing 2 Destructing 1 Caught 3 - Constructing 1 Constructing 2 Constructing 3 Destructing 3 Destructing 2 Destructing 1 Caught 2 - Constructing 1 Constructing 2 Constructing 3 Destructing 1 Destructing 2 Caught 3 - There is a syntax errorConstructing 1
    Constructing 2
    Constructing 3
    Destructing 2
    Destructing 1
    Caught 3
    What is the output? - Constructing 1 Constructing 2 Constructing 3 Destructing 2 Destructing 1 Caught 3 - Constructing 1 Constructing 2 C...
  180. 180If we use binary search algorithm to search 5 4 8 9 21 15 19 20 25 28 32 35 36 48 52 for key 17, list the elements that will be compared with key in order of when the comparison happens - 20 9 15 19 - 1 8 15 - cannot use binary search algorithm since the array to be searched is not sorted - cannot use binary search algorithm because the key is not in the arraycannot use binary search algorithm since the array to be searched is not sorted
  181. 181Let G be a weighted undirected graph and e be an edge with maximum weight in G. Suppose there is a minimum weight spanning tree in G containing the edge e. Which of the following statements is always TRUE? - There exists a cutset in G having all edges of maximum weight. - There exists a cycle in G having all edges of maximum weight - Edge e cannot be contained in a cycle. - All edges in G have the same weightThere exists a cutset in G having all edges of maximum weight.
  182. 182Suppose we have Random rand = new Random(); Which of the following expression generates a random integer between 20 and 100, inclusive? - rand.nextInt() % 80 - rand.nextInt() % 80 + 20 - rand.nextInt() % 81 + 20 - rand.nextInt() % 81rand.nextInt() % 81 + 20
  183. 183What is the output of the following code if the value of score is 78? Assume variable score and grade has been declared as int and char, respectively. - C - U - There is a compile error in line 11 - There is a compile error in line 12UWhat is the output of the following code if the value of score is 78? Assume variable score and grade has been declared as int and char, ...
  184. 184What is the value of numbers.capacity() after the following code? - 0 - 10 - 100 - Unknown100What is the value of numbers.capacity() after the following code? - 0 - 10 - 100 - Unknown

Information

Description
12th grade INF 650 Flashcards on INF 675 - Final Exam Study Guide, created by Kylie H on 08/12/2023.
Created by
Kylie H
Views
5
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?