GATE 2000
54 questions
MCQ 541-mark 54
Questions 41–45 of 54
Let L denote the languages generated by the grammar . Which of the following is TRUE?
Answer: (B)
Start from , which gives 00. Each use of puts one 0 on each side, so it adds two 0s. So the strings are 00, 0000, 000000, and so on:
. This has a regular expression, so it is regular. It is not because the string 0 is in but not in (all lengths in are even).
Answer: (B)
. This has a regular expression, so it is regular. It is not because the string 0 is in but not in (all lengths in are even).
Answer: (B)
The number of tokens in the following C statement is
printf("i=%d, &i=%x", i, &i); Answer: (C)
The tokens are: printf, (, "i=%d, &i=%x", ",", i, ",", &, i, ), ;
The full string literal counts as one token. So the total is 10.
Answer: 10
The full string literal counts as one token. So the total is 10.
Answer: 10
Given the following expression grammar:
Which of the following is true?
Which of the following is true?
Answer: (B)
A operator that sits lower in the grammar binds more tightly. The operator "" comes from F, which is the lowest level, while * and + come from E.
So has higher precedence than * (and +).
Answer: has higher precedence than *
So has higher precedence than * (and +).
Answer: has higher precedence than *
Which of the following derivations does a top-down parser use while parsing an input string? The input is scanned from left to right.
Answer: (A)
A top-down parser uses the leftmost derivation.
A bottom-up parser uses the reverse of the rightmost derivation.
Correct Answer :
A bottom-up parser uses the reverse of the rightmost derivation.
Correct Answer :
Which of the following need not necessarily be saved on a context switch between processes?
Answer: (B)
To resume a process correctly, the OS must save its program counter, general purpose registers and stack pointer, because the process cannot continue without them. The TLB is only a cache of address translations that makes memory access faster. It is not needed for correctness, so it need not be saved (it is flushed, or tagged by process, so that the next process does not use the old translations). So only (B) is the item that need not be saved, and (D) is wrong.
Answer: (B)
Answer: (B)