GATE CS question library
Practise GATE CS Computer Science previous year questions free. Browse by subject, syllabus topic, year and question type, with answers and available solutions.
Subject, topic, year and type filter the full library. Match any choice within a filter, and all selected filter categories. Search, source and sort apply to this page.
20 on this page
The following program fragment is written in a programming language that allows global variables and does not allow nested declarations of functions. global int i=100, j=5; void P(x) { int i=10; print(x+10); i=200; j=20; print (x); } main() {P(i+j);} If the programming language uses static scoping and call by need parameter passing mechanism, the values …
The following resolution rule is used in logic programming. Derive clause from clauses Which of the following statements related to this rule is FALSE?
Let be a directed graph with vertices. A path from to in is a sequence of vertices () such that for all in through . A simple path is a path in which no vertex appears more than once. Let be an array initialized as follows: …
The following are the starting and ending times of activities and respectively in chronological order: . Here, denotes the starting time and denotes the ending time of activity X. We need to schedule …
What is the weight of a minimum spanning tree of the following graph?
Let be an undirected graph with a subgraph . Weights are assigned to edges of as follows. A single-source shortest path algorithm is executed on the weighted graph with an arbitrary vertex of as the source. …
Consider the following tree (i.e., B-tree with a minimum degree of two) in which each data item is a letter. The usual alphabetical ordering of letters is used in constructing the tree. What is the result of inserting in the above tree?
Let S be a stack of size . Starting with the empty stack, suppose we push the first n natural numbers in sequence, and then perform pop operations. Assume that Push and Pop operations take seconds each, and seconds elapse between the end of one such stack operation and the start of the next operation. For , define the …
A data structure is required for storing a set of integers such that each of the following operations can be done in time, where is the number of elements in the set. Deletion of the smallest element Insertion of an element if it is not already present in the set Which of the following data structures can be used for this purpose?
In a permutation , of n distinct integers, an inversion is a pair such that and . If all permutations are equally likely, what is the expected number of inversions in a randomly chosen permutation of ?
A program consists of two modules executed sequentially. Let and respectively denote the probability density functions of time taken to execute the two modules. The probability density function of the overall time taken to execute the program is given by
Consider the syntax directed definition shown below. …
Consider the translation scheme shown below. num (num.val) Here num is a token that represents an integer and num.val represents the corresponding integer value. For an input string ‘’, this translation scheme will …
Consider the grammar shown below. This grammar is
Consider the NFA shown below. Let the language accepted by be . Let be the language accepted by the NFA obtained by changing the accepting state of to a non-accepting state and by changing the non-accepting states of to accepting states. Which of the following statements is true?
A single tape Turing Machine has two states and , of which is the starting state. The tape alphabet of is and its input alphabet is . The symbol is the blank symbol used to indicate end of an input string. The transition function of is described in the following table. …
Let be a context free grammar where the rule set R is Which of the following statements is true?
Consider the following deterministic finite state automaton . Let denote the set of seven bit binary strings in which the first, the fourth, and the last bits are . The number of strings in that are accepted by is
Consider the following assembly language program for a hypothetical processor and are bit registers. The meanings of various instructions are shown as comments. …
Consider the ALU shown below. If the operands are in complement representation, which of the following operations can be performed by suitably setting the control lines and only (+ and – denote addition and subtraction respectively)?
