MCQs
Total Questions : 97
| Page 5 of 10 pages
Question 41. The procedure given below is required to find and replace certain characters inside an input character string
supplied in array A. The characters to be replaced are supplied in array oldc, while their respective
replacement characters are supplied in array newc. Array A has a fixed length of five characters, while
arrays oldc and newc contain three characters each. However, the procedure is flawed. void find_and_replace (char *A, char *oldc, char *newc) { for (int i=0; i
supplied in array A. The characters to be replaced are supplied in array oldc, while their respective
replacement characters are supplied in array newc. Array A has a fixed length of five characters, while
arrays oldc and newc contain three characters each. However, the procedure is flawed. void find_and_replace (char *A, char *oldc, char *newc) { for (int i=0; i
Answer: Option B. -> Only two
-NA-
Question 42. A computer uses 46-bit virtual address, 32-bit physical address, and a three-level paged page table organization. The page table base register stores the base address of the first-level table (T1), which occupies exactly one page. Each entry of T1 stores the base address of a page of the second-level table (T2). Each entry of T2 stores the base address of a page of the third-level table (T3). Each entry of T3 stores a page table entry (PTE). The PTE is 32 bits in size. The processor used in the computer has a 1 MB 16-way set associative virtually indexed physically tagged cache. The cache block size is 64 bytes.What is the minimum number of page colours needed to guarantee that no two synonyms map to different sets in the processor cache of this computer?
Answer: Option C. -> 8
-NA-
Question 43. A computer uses 46-bit virtual address, 32-bit physical address, and a three-level paged page table organization. The page table base register stores the base address of the first-level table (T1), which occupies exactly one page. Each entry of T1 stores the base address of a page of the second-level table (T2). Each entry of T2 stores the base address of a page of the third-level table (T3). Each entry of T3 stores a page table entry (PTE). The PTE is 32 bits in size. The processor used in the computer has a 1 MB 16-way set associative virtually indexed physically tagged cache. The cache block size is 64 bytes.What is the size of a page in KB in this computer?
Answer: Option C. -> 8
-NA-
Answer: Option C. -> Last fragment, 2400 and 2759
-NA-
Question 45. Consider the following two sets of LR(1) items of an LR(1) grammar.X → c.X, c/d X → c.X, $X → .cX, c/d X →.cX, $X → .d, c/d X →.d, $Which of the following statements related to merging of the two sets in the corresponding LALR parser is/are FALSE?1. Cannot be merged since look aheads are different.2. Can be merged but will result in S-R conflict.3. Can be merged but will result in R-R conflict.4. Cannot be merged since go to on c will lead to two different sets.
Answer: Option D. -> 1, 2, 3 and 4
-NA-
Answer: Option D. -> 2 and 3 only
-NA-
Answer: Option D. -> 15, 10, 23, 25, 20, 35, 42, 39, 30
-NA-
Answer: Option B. -> 5
-NA-
Question 49. The following code segment is executed on a processor which allows only register operands in its instructions. Each instruction can have atmost two source operands and one destination operand. Assume that all variables are dead after this code segment.c = a + b;d = c * a;e = c + a;x = c * c;if (x > a) { y = a * a;}else { d = d * d; e = e * e;}Suppose the instruction set architecture of the processor has only two registers. The only allowed compiler optimization is code motion, which moves statements from one place to another while preserving correctness. What is the minimum number of spills to memory in the compiled code?
Answer: Option B. -> 1
-NA-
Question 50. Consider an instruction pipeline with five stages without any branch prediction: Fetch Instruction (FI), Decode Instruction (DI), Fetch Operand (FO), Execute Instruction (EI) and Write Operand (WO). The stage delays for FI, DI, FO, EI and WO are 5 ns, 7 ns, 10 ns, 8 ns and 6 ns, respectively. There are intermediate storage buffers after each stage and the delay of each buffer is 1 ns. A program consisting of 12 instructions I1, I2, I3, ...., I12 is executed in this pipelined processor. Instruction I4 is the only branch instruction and its branch target is I9. If the branch is taken during the execution of this program, the time (in ns) needed to complete the program is
Answer: Option B. -> 165
-NA-