MCQ Part 1 PDF
Document Details
Uploaded by HealthfulChrysoprase7209
University of Mindanao
Tags
Related
Summary
This document contains a set of multiple-choice questions related to computer science.
Full Transcript
Q1. Which of the following is the correct decimal fraction equal to hexadecimal fraction 0.248? 31 31 31 73 a) 32 b) 125 c) 512 d) 512 Q2. Which of the following is the correc...
Q1. Which of the following is the correct decimal fraction equal to hexadecimal fraction 0.248? 31 31 31 73 a) 32 b) 125 c) 512 d) 512 Q2. Which of the following is the correct value of the quadruple of hexadecimal fraction 0.FEDC? a) 1.FDB8 b) 2.FB78 c) 3.FB70 d) F.EDC0 Q3. In a floating-point number format, which of the following is the correct operation for adjusting the radix point and the exponent so that the most significant digit of the mantissa can be a non-zero value? Here, an absolute value is used for the mantissa. a) Carry b) Normalize c) Round down d) Round up Q4. The decimal value “-72” is stored in an 8-bit register using 2’s complement. If the data in the register is logically shifted two bits to the right, which of the following is the correct result that is represented in decimal? a) -19 b) -18 c) 45 d) 46 -1- Q5. By definition of the IEEE754 standard, 32-bit floating point numbers are represented as follows: S (1 bit) E (8 bits) M (23 bits) S: Sign bit E: Exponent M: Mantissa Which of the following is the correct “mask bits” in hexadecimal to be used for extracting only the exponent part of the above format? Here, “mask bits” means a bit pattern which is logically ANDed with the 32-bit floating point value. a) 107FFFFF b) 7F800000 c) FF100000 d) FF800000 Q6. In the Venn Diagrams labeled 1 to 3, which of the following is the result of Boolean “OR” operations for all three to be combined? Here, “ ” is used for “logical AND,” “+” for “logical OR,” and “ A ” for the “logical NOT” of A. Each set corresponding to x, y, or z is depicted by a circle x y x y x y z z z 1 2 3 a) x y z + x + y b) x y z + x + y c) x y z + x + y d) x y z + x + y -2- Q7. When you flip a coin four times, what is the probability that it will come up heads exactly twice? a) 0.2 b) 0.375 c) 0.5 d) 0.625 Q8. There are two important operations on a stack: PUSH and POP. PUSH adds the new data to the top of the stack leaving previous data below, and POP removes and returns the current top data of the stack. When the operations shown below are sequentially executed, which of the following is the correct combination of the values x and y? Here, the size of the stack is big enough to hold the entire data. “PUSH(a)” inserts the data a into the stack, and “POP(b)” removes the data b from the stack. [Operations] PUSH (5); PUSH (3); PUSH (6); PUSH (1); x = POP ( ); PUSH (7); y = POP ( ); x y a) 1 6 b) 1 7 c) 5 3 d) 5 7 Q9. Reverse Polish Notation (RPN) is used to represent arithmetic expressions without using brackets to define priorities for evaluation of operators. For example, 3(a+b) becomes 3ab+ in RPN. Which of the following is the best data structure that should be used for implementation of RPN in a computer? a) List b) Queue c) Stack d) Tree -3- Q10. Which of the following is an appropriate description concerning the list and/or array structures? a) The list structure allows any data to be inserted or deleted simply by modifying pointers. But, after the data was deleted, the cells that contained the data remain as garbage in memory. b) The list structure is similar to the array structure in that all data elements of the same type are sequentially lined up. In the list structure, the logical arrangement is the same as the physical arrangement. c) The number of operations is fixed in inserting or deleting an element in an array; it does not depend on the position of the element in the array. d) Using a subscript for each element in an array, quick access to any element can be achieved. The array structure allows any data to be inserted or deleted simply by modifying pointers. Q11. The table below shows a state transition table that checks the input character string. This check starts from the initial state A, and it fails if the state changes to E during the input of the character string. Which of the character strings in the answer group fails this check? Here, the symbol in the answer group represents a space. Input character Space Numeric Sign Radix point Other A A B C D E Current state B A B E D E C E B E D E D A E E E E a) +0010 b) -1 c) 12.2 d) 9. -4- Q12. There are two jugs; one is a 4-liter (4L) jug and the other is a 3-liter (3L) jug. Which of the following is the correct sequence to obtain exactly 2 liters of water in the 4L jug under the conditions shown below? Here, (x, y) indicates that the 4L jug contains x liters of water and the 3L jug has y liters of water. [Conditions] You can use only the 3L and 4L jugs. You are allowed to fill up or empty either jug. You are allowed to pour water from one jug to the other. The jugs have no scale marks. There is an ample supply of water. a) (0,0) → (0,3) → (3,0) → (0,3) → (4,2) → (0,2) → (2,0) b) (0,0) → (0,3) → (3,0) → (3,3) → (4,2) → (0,2) → (2,0) c) (0,0) → (0,3) → (3,3) → (3,0) → (4,2) → (0,2) → (2,0) d) (0,0) → (3,0) → (0,3) → (3,3) → (0,2) → (4,2) → (2,0) Q13. Which of the following is the correct result produced by executing the program shown below? Here, the parameter “x” is called by value, and the parameter “y” is called by reference. Main Program Subprogram sub(x, y) a = 2; x = x + y; b = 3; y = x + y; sub(b, a); return; a) a = 2, b = 3 b) a = 2, b = 5 c) a = 7, b = 3 d) a = 7, b = 5 -5- Q14. The “prime number division remainder” method is a well-known hashing algorithm. In this method, a key value is divided by a number N, and the remainder which is also called a hash value is used directly as an index into the hash table. N is the largest prime number less than or equal to the size of the available addressable spaces. When the 20 addressable spaces are available, which of the following is the correct hash value calculated from the key value 136? Here, a prime number is one that cannot be divided evenly by any other number except one (1). 2, 3, 5, 7, 11, and 13 are the first few prime numbers. a) 0 b) 1 c) 3 d) 16 Q15. In a certain computer, a bubble sort of an array of 200 data elements takes the same time as a quick sort of the array. In case of an array of 40,000 data elements, how many times faster is a quick sort than a bubble sort? Here, a bubble sort and a quick sort take time proportional to n2 and nlog2n respectively, and “n” is the number of data elements. a) 10 b) 50 c) 100 d) 200 -6- Q16. Integers are stored in the 1st to N-th elements of an array A (N >1). The flowchart below shows the process to check which element of the array contains the same value as X. Which of the following correctly describes the execution result of this process? k+1 k a) If the same value as X exists in two places of the array, the 1st and N-th elements, k is set to 1. b) If the same value as X exists in two places of the array, the 1st and N-th elements, k is set to N. c) If the same value as X is not in the array, k is set to 1. d) If the same value as X is not in the array, k is set to N. Q17. Which of the following is a re-writable, erasable memory, using electrical signals, which is widely used for various devices such as digital cameras and digital music players and can maintain the data even after the power is turned off? a) DRAM b) Flash memory c) Mask ROM d) SRAM -7- Q18. The figure shows an RS flip-flop using two NOR gates. Which of the following is the correct truth table for the flip-flop? Here, “unchanged” shown in the table means the outputs maintain a previous state, and “unstable” means the outputs are in an unstable state. a) b) Inputs Outputs Inputs Outputs S R Q Q S R Q Q 0 0 unchanged 0 0 unchanged 0 1 0 1 0 1 1 0 1 0 1 0 1 0 0 1 1 1 unstable 1 1 unstable c) d) Inputs Outputs Inputs Outputs S R Q Q S R Q Q 0 0 unstable 0 0 unstable 0 1 0 1 0 1 1 0 1 0 1 0 1 0 0 1 1 1 unchanged 1 1 unchanged -8- Q19. Which of the following is the correct combination of various addressing modes? Here, X1 is an address which is stored in a program counter. X2 is an address part of an instruction which is addressed by X1. X3 is an address in which an operand needed to execute an instruction is stored. X4 is a value in an index register. (X2) means the contents of location X2. Addressing PC (Program Direct Indirect Indexed mode Counter)-relative a) X3 = X2 X3 = X2+X4 X3 = (X2) X3 = X1+X2 b) X3 = X2 X3 = (X2) X3 = X1+X2 X3 = X2+X4 c) X3 = X2 X3 = (X2) X3 = X2+X4 X3 = X1+X2 d) X3 = (X2) X3 = X2 X3 = X1+X2 X3 = X2+X4 Q20. A computer is designed to enable pipeline control so that each instruction can be completed in five cycles. How many cycles are needed to execute 20 instructions? Here, all instructions can be executed without being stopped halfway. a) 20 b) 21 c) 24 d) 25 Q21. Which of the following is an appropriate statement in regard to interrupts? a) Applications must constantly detect the occurrence of interrupts. b) A priority is individually assigned to the cause of an interrupt in preparation for the occurrence of multiple interrupts. c) The operation completion notice from an I/O device is classified as an internal interrupt. d) When the CPU accepts an interrupt, it stops the program currently being executed and stores the information needed to restart the program in the designated area of the hard disk. -9- Questions 1 through 5 are all compulsory. Answer every question. Q1. Read the following description of the state machine, and then answer Subquestions 1 through 4. Figure 1 depicts the state machine which takes two inputs J and K and the current state inputs Y and Z to determine its next state. The state transition is synchronized by the clock input, Ck. The four output states of the state machine are A, B, C and D, and the possible combination of the output is shown in Table 1. These output states are encoded by a 4- to-2 encoder before they are fed back to the input of the state machine. Table 2 shows the truth table of the 4-to-2 encoder. Y A Y Z B State 4-to-2 Machine encoder J C Z K D Ck Fig. 1 State machine Table 1 The possible combination of the output state of the State Machine Output A B C D 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 Table 2 4-to-2 encoder truth table Input Output A B C D Y Z 1 0 0 0 0 0 0 1 0 0 0 1 0 0 1 0 1 0 0 0 0 1 1 1 - 10 - Figure 2 depicts the state transition diagram of the state machine. The two logic inputs at the arc of each state transition represent the J and K inputs, and the ‘X’ represents both logic 0 and 1, i.e. 01 stands for J=0 and K=1, whilst 1X stands for J=1 and K=0 or 1. 10 00 01 0X X0 10 01 01 11 11 11 1X 00 Fig. 2 State transition diagram Subquestion 1 Suppose the initial state is C. What is the final state if the JK inputs at the next four clocks are 01, 01, 00, 11? Answer group: a) A b) B c) C d) D - 11 - Subquestion 2 Based on the truth table in Table 2, which of the Boolean equation given in the answer selection can represent the output Z ? Answer group: a) A+ B b) A B c) A B + A B d) B C + B C e) B D f) B C +C D Subquestion 3 Suppose the initial state is C, Which of the following JK input sequences produce the state transition of CABDD ? (Two answers) Answer group: a) 00, 01, 00, 11 b) 10, 00, 00, 10 c) 10, 00, 01, 11 d) 11, 00, 01, 00 e) 11, 00, 10, 00 f) 11, 00, 10, 01 Subquestion 4 What is the Boolean equation that can represent the following output of the state machine? i. output C ii. output D Answer group: a) Y Z J K +Y Z J b) Y Z J K +Y Z J c) Y Z J K +Y Z J K d) Y Z J K +Y Z J +Y Z K e) Y Z J K +Y Z J K +Y Z J K f) Y Z J K +Y Z J K +Y Z J K +Y Z J K g) Y Z J K +Y Z J K +Y Z J K +Y Z J K - 12 - Q1. What range of decimal numbers can be represented with an 11-bit two's-complement number? a) -2048 to 2047 b) -2048 to 2048 c) -1024 to 1023 d) -1024 to 1024 Q2. Which of the following decimal fractions becomes a finite fraction in an octal representation? a) 0.3 b) 0.4 c) 0.5 d) 0.8 Q3. When a certain natural number x is expressed as a 2n-digit binary number “1010...10” consisting of 1 and 0 arranged alternately, which of the following equations can be formulated in terms of the number x? x a) x + 2 = 22n b) x + = 22n -1 x c) x + 2 = 22n+1 x d) x + 2 = 22n+1-1 Q4. An integer m is stored in a register as a binary value. If this value is shifted to the left by three bits and m is added to the shifted value, how many times as large as m is the resulting number? Here, no overflow occurs. a) 4 b) 7 c) 8 d) 9 - 13 - Q5. Which of the following is the reason why a large number of computers use “complement representation” to simplify arithmetic circuits? a) Addition can be processed by subtraction. b) Division can be processed by a combination of subtractions. c) Multiplication can be processed by a combination of additions. d) Subtraction can be processed by addition. Q6. Which of the following is the appropriate statement concerning Newton’s method that is known as an algorithm for obtaining the approximate value of the solution to the formula ƒ(x) = 0? a) An approximate value of the solution can be obtained even if the function ƒ(x) is indifferentiable. b) An approximate value of the solution is obtained geometrically using the tangent lines of y = ƒ(x). c) No matter what initial values are provided, an approximate value of the solution can always be obtained. d) Two different initial values must be provided. Q7. There is a four-digit number N1N2N3C that is used for Customer Account Number (CAN). The right most digit “C” can be calculated as follows: C = (N1*3 + N2*5 + N3*7) mod 10 Which of the following is a correct CAN? Here, x mod y returns the remainder when x is divided by y. a) 7714 b) 7715 c) 9690 d) 9695 Q8. Two players, X and Y play a dice game. A pair of dice is tossed. If the sum of the dice is 2, 4, or 6, X wins the game. Otherwise, Y wins. What is the probability that Y wins the game? a) 1/4 b) 1/3 c) 1/2 d) 3/4 - 14 - Q9. There are a total of 1,900 students in a school, 553 of whom are taking a course in computer science, 667 of whom are in mathematics, and 290 of whom are in both computer science and mathematics. How many students are not taking a course in either computer science or in mathematics? a) 680 b) 930 c) 970 d) 1260 Q10. Which of the following is equivalent to the logical expression A B + B C (B + C) ? Here, “ ” is the logical product, and “ + ” is the logical sum. a) A B + A C b) A C + B c) B ( A + C) d) B + A C Q11. There are three 7-bit character codes: 30, 3F, and 7A. When an even parity bit is added to the front of each character code, which of the following shows the correct result? Here, the character codes are expressed in hexadecimal. a) 30, 3F, 7A b) 30, 3F, FA c) B0, 3F, FA d) B0, BF, 7A Q12. Which of the following data structures uses the LIFO (Last In First Out) method in order to manage data? a) Array b) Linked list c) Queue d) Stack - 15 - Q1. Which of the following is equal to the hexadecimal fraction 2A.4C? 5 3 1 -2 -5 -6 5 3 1 -1 -4 -5 a) 2 + 2 + 2 + 2 + 2 + 2 b) 2 + 2 + 2 + 2 + 2 + 2 6 4 2 -2 -5 -6 6 4 2 -1 -4 -5 c) 2 + 2 + 2 + 2 + 2 + 2 d) 2 + 2 + 2 + 2 + 2 + 2 Q2. In what radix does the following equation hold? 131 − 45 = 53 a) 6 b) 7 c) 8 d) 9 Q3. In fixed-point representation that expresses negative numbers by two’s complement, which range of integers can be expressed with n bits? Here, the position of the binary point is to the right of the least significant bit. a) −2n through 2n –1 b) −2n –1 − 1 through 2n –1 c) −2n – 1 through 2n –1 - 1 d) −2n –1 through 2n –1 Q4. In a certain program, in order to stay in a loop, variable X must be in the range from 1 through 10 (X >= 1 AND X 10 b) X >= 1 OR X 10 - 16 - Q5. When the results of the logical operation “x # y” are shown in the table below, which of the following expressions is equivalent to the operation “x # y”? Here, “AND” is used for the logical product, “OR” is for the logical sum, and “NOT” is for the logical negation. x y x#y True True False True False False False True False False False True a) x AND (NOT y) b) x OR (NOT y) c) (NOT x) AND (NOT y) d) (NOT x) OR (NOT y) Q6. Which of the following numbers is a valid ISBN? Here, ISBN means the International Standard Book Number which is used to identify books, publishers, and bookstores. It consists of exactly 10 digits, and the rightmost digit is used for a check digit. The check digit is validated by using modulo 11 as follows: Multiply each digit from the first (leftmost) to the ninth by a weight from 10 to 2 respectively; the first digit is multiplied by 10, the second by 9, and so on. Calculate the sum of each product, and then add the check digit. Divide the resulting value by 11. If the resulting remainder is zero (0), the check digit is valid. Otherwise, it is invalid. For example, in case of ISBN 0003194876, the check digit is validated as follows: First 9 digits: 0 0 0 3 1 9 4 8 7 Weight from 10 to 2: 10 9 8 7 6 5 4 3 2 Each product and sum: 0 0 0 21 6 45 16 24 14 = 126 Add check digit: 6 Total: 132 The remainder of the division of 132 by 11 is 0, so this ISBN is valid. a) 0071361283 b) 0071361284 c) 0071361285 d) 0071361286 - 17 - Q7. The state diagram shown below is a simple Mealy machine. Which of the following transitions is NOT possible in the diagram? Here, S0, S1, and S2 are states. Each edge is labeled with “j / k ” where j is the input and k is the output. a) S0 → S1 → S2 → S1 → S1 → S2 b) S0 → S1 → S2 → S1 → S2 → S0 c) S0 → S2 → S1 → S2 → S1 → S2 d) S0 → S2 → S2 → S1 → S2 → S2 Q8. The formula shown below is represented in postfix (or reverse Polish) notation. Which of following is the resulting value of this formula? 51–3*31–2*/ a) 1 b) 3 c) 5 d) 7 Q9. There are five different sizes of white balls and five different sizes of green balls. When these ten balls are laid out in a line so that adjacent balls can have different colors, how many arrangements of the balls can be made? a) 7,200 b) 14,400 c) 28,800 d) 57,600 - 18 - Q10. A coin is tossed three times. What is the probability that it lands on heads exactly one time? a) 0.125 b) 0.25 c) 0.333 d) 0.375 Q11. In a certain computer system, a simple hash function called the division method is used for page-based address translation. By using this method, a pair of new logical page number “101000” and its corresponding physical page number “0010” is stored into the page table shown below. Which of the following indexes is used to place them in the table? Here, the given logical page number is divided by 7, and its remainder is used as the index of the page table. If the slot specified by the index value is already taken, the table is searched forward from that slot to find the next empty slot. Page table Index Logical page number Physical page number 000 Empty Empty 001 001111 1110 010 Empty Empty 011 000011 0001 100 001011 0011 101 000101 1010 110 Empty Empty 111 Empty Empty a) 000 b) 010 c) 110 d) 111 - 19 - Q12. In the binary tree shown below, which of the following trees is created after conversion into a (max) heap? 4 1 3 2 16 9 10 14 8 7 a) b) 16 1 8 14 14 10 3 7 9 10 8 7 9 3 2 1 4 2 4 1 c) d) 16 16 14 10 14 10 9 8 7 4 8 7 3 9 3 2 1 4 2 1 - 20 - Q13. A singly linked list is implemented using two arrays VALUE and LINK, in which LINK(I) points to the successor of VALUE(I). When a new element that does not exist initially in the list is assigned to VALUE(J), the program fragment shown below is executed. Which of the following appropriately describes the function of this program? LINK(J)