GATE 2021 (Session 2)
64 questions
MCQ 33 · MSQ 13 · NAT 181-mark 29 · 2-mark 35
Questions 21–25 of 64
Let be a regular language and be a context-free language. Which of the following languages is/are context-free?
One or more options are correct.
Answer: (B), (C), (D)
Facts used: CFLs are closed under union and under intersection with a regular language. They are not closed under complement.
- (A) : not always a CFL. Take (regular); the expression becomes , and a CFL's complement need not be a CFL. For example, is a CFL but its complement is not.
- (B) (De Morgan). This is a regular language intersected with a CFL, so it is a CFL. True.
- (C) , so , which is regular and so a CFL. True.
- (D) , a CFL. True.
Answer: (B), (C), (D)
- (A) : not always a CFL. Take (regular); the expression becomes , and a CFL's complement need not be a CFL. For example, is a CFL but its complement is not.
- (B) (De Morgan). This is a regular language intersected with a CFL, so it is a CFL. True.
- (C) , so , which is regular and so a CFL. True.
- (D) , a CFL. True.
Answer: (B), (C), (D)
In the context of compilers, which of the following is/are NOT an intermediate representation of the source program?
One or more options are correct.
Answer: (D)
Three address code, AST and CFG are all forms of the program that are used between the front end and the back end. The symbol table only keeps information about names. It does not represent the program.
Answer: Symbol table
Answer: Symbol table
Which of the following statement(s) is/are correct in the context of CPU scheduling?
One or more options are correct.
Answer: (A), (C), (D)
- (A) Turnaround time is completion time arrival time. This includes the time spent waiting in the ready queue, the CPU burst and any I/O. TRUE.
- (B) The aim is to maximize CPU utilization and throughput, not to minimize throughput. FALSE.
- (C) Round-robin needs only a time quantum, not the burst lengths. TRUE.
- (D) Preemption needs a hardware timer interrupt to take the CPU back from a running process. TRUE.
Answer: (A), (C), (D)
- (B) The aim is to maximize CPU utilization and throughput, not to minimize throughput. FALSE.
- (C) Round-robin needs only a time quantum, not the burst lengths. TRUE.
- (D) Preemption needs a hardware timer interrupt to take the CPU back from a running process. TRUE.
Answer: (A), (C), (D)
Choose the correct choice(s) regarding the following proportional logic assertion S:
One or more options are correct.
Answer: (B), (D)
Make the consequent simpler: . This is the same as the antecedent.
So S takes the form , and this is true for every case.
Answer: S is a tautology; its antecedent is equivalent to its consequent
So S takes the form , and this is true for every case.
Answer: S is a tautology; its antecedent is equivalent to its consequent
Consider a complete binary tree with 7 nodes. Let A denote the set of first 3 elements obtained by performing Breadth-First Search (BFS) starting from the root. Let B denote the set of first 3 elements obtained by performing Depth-First Search (DFS) starting from the root.
The value of |A-B| is _____________
The value of |A-B| is _____________
Answer: 1
The tree is a complete binary tree with 7 nodes. It has a root, two children L and R, and four grandchildren.
- BFS, first 3 nodes: root, L, R A = {root, L, R}
- DFS, first 3 nodes: root, L, then the left child of L B = {root, L, LL}
Now take the difference: A B = {R} |A B| = 1
Answer: 1
- BFS, first 3 nodes: root, L, R A = {root, L, R}
- DFS, first 3 nodes: root, L, then the left child of L B = {root, L, LL}
Now take the difference: A B = {R} |A B| = 1
Answer: 1