Question
stringlengths
39
1.33k
Tag
stringlengths
3
46
label
int64
0
206
Determine whether each of the following is a tautology a contradiction or neither quot lor quot is disjunction quot land quot is conjunction quot rightarrow quot is implication quot eg quot is negation and quot leftrightarrow quot is biconditional if and only if A leftrightarrow A lor A A lor B rightarrow B A land eg A lor B
Propositional Logic
144
Consider two well formed formulas in propositional logic F1 P Rightarrow eg P F2 P Rightarrow eg P lor eg P Rightarrow P Which one of the following statements is correct F1 is satisfiable F2 is valid F1 unsatisfiable F2 is satisfiable F1 is unsatisfiable F2 is valid F1 and F2 are both satisfiable
Propositional Logic
144
Choose the correct alternatives More than one may be correct Indicate which of the following well formed formulae are valid left P Rightarrow Q right wedge left Q Rightarrow R right Rightarrow left P Rightarrow R right left P Rightarrow Q right Rightarrow left eg P Rightarrow eg Q right left P wedge left eg P vee eg Q right right Rightarrow Q left P Rightarrow R right vee left Q Rightarrow R right Rightarrow left left P vee Q right Rightarrow R right
Propositional Logic
144
Choose the correct alternatives more than one may be correct and write the corresponding letters only Which of the following is are a tautology a vee b o b wedge c a wedge b o b vee c a vee b o left b o c right a o b o left b o c right
Propositional Logic
144
Choose the correct alternatives more than one may be correct and write the corresponding letters only If F_1 F_2 and F_3 are propositional formulae such that F_1 land F_2 rightarrow F_3 and F_1 land F_2 rightarrow sim F_3 are both tautologies then which of the following is true a Both F_1 and F_2 are tautologies b The conjunction F_1 land F_2 is not satisfiable c Neither is tautologous d Neither is satisfiable e None of the above
Propositional Logic
144
If X then Y unless Z is represented by which of the following formulas in prepositional logic eg is negation land is conjunction and rightarrow is implication X land eg Z rightarrow Y X land Y rightarrow eg Z X rightarrow Y land eg Z X rightarrow Y land eg Z
Propositional Logic
144
Choose the correct option to fill 1 and 2 so that the program below prints an input string in reverse order Assume that the input string is terminated by a new line character void reverse void int c if 1 reverse 2 main printf Enter text printf reverse printf 1 is getchar u2019 setminus n u2019 2 is getchar c 1 is c getchar u2019 setminus n u2019 2 is getchar c 1 is c u2019 setminus n u2019 2 is putchar c 1 is c getchar u2019 setminus n u2019 2 is putchar c
Pseudo Code
145
A language L satisfies the Pumping Lemma for regular languages and also the Pumping Lemma for context free languages Which of the following statements about L is TRUE L is necessarily a regular language L is necessarily a context free language but not necessarily a regular language L is necessarily a non regular language None of the above
Pumping Lemma
146
Let Q left left q_1 q_2 right left a b right left a b bot right delta bot phi right be a pushdown automaton accepting by empty stack for the language which is the set of all nonempty even palindromes over the set left a b right Below is an incomplete specification of the transitions delta Complete the specification The top of the stack is assumed to be at the right end of the string representing stack contents delta q_1 a bot left q_1 bot a right delta q_1 b bot left q_1 bot b right delta q_1 a a left q_1 aa right delta q_1 b a left q_1 ab right delta q_1 a b left q_1 ba right delta q_1 b b left q_1 bb right delta q_1 a a left dots dots right delta q_1 b b left dots dots right delta q_2 a a left q_2 epsilon right delta q_2 b b left q_2 epsilon right delta q_2 epsilon bot left q_2 epsilon right
Pushdown Automata
147
Let P be a non deterministic push down automaton NPDA with exactly one state q and exactly one symbol Z in its stack alphabet State q is both the starting as well as the accepting state of the PDA The stack is initialized with one Z before the start of the operation of the PDA Let the input alphabet of the PDA be u03a3 Let L P be the language accepted by the PDA by reading a string and reaching its accepting state Let N P be the language accepted by the PDA by reading a string and emptying its stack Which of the following statements is TRUE L P is necessarily u03a3 but N P is not necessarily u03a3 N P is necessarily u03a3 but L P is not necessarily u03a3 Both L P and N P are necessarily u03a3 Neither L P nor N P are necessarily u03a3
Pushdown Automata
147
Let M q_0 q_1 0 1 z_0 X delta q_0 z_0 phi be a Pushdown automation where delta is given by delta q_0 1 z_0 q_0 xz_0 delta q_0 epsilon z_0 q_0 epsilon delta q_0 1 X q_0 XX delta q_1 1 X q_1 epsilon delta q_0 0 X q_1 X delta q_0 0 z_0 q_0 z_0 z What is the language accepted by this PDA by empty stack Describe informally the working of the PDA
Pushdown Automata
147
Let M K u03a3 u0413 u0394 s F be a pushdown automaton where K s f F f Sigma a b u0413 a and u0394 s a epsilon s a s b epsilon s a s a epsilon f epsilon f a a f epsilon f b a f epsilon Which one of the following strings is not a member of L M aaa aabab baaba bab
Pushdown Automata
147
Let L_1 be the set of all languages accepted by a PDA by final state and L_2 the set of all languages accepted by empty stack Which of the following is true L_1 L_2 L_1 supset L_2 L_1 subset L_2 None
Pushdown Automata
147
Give a deterministic PDA for the language L a ncb 2n mid n geq 1 over the alphabet Sigma a b c Specify the acceptance state
Pushdown Automata
147
Consider the transition diagram of a PDA given below with input alphabet Sigma a b and stack alphabet Gamma X Z Z is the initial stack symbol Let L denote the language accepted by the PDA Which one of the following is TRUE L a nb n mid n geq0 and is not accepted by any finite automata L a n mid n geq0 cup a nb n mid n geq 0 and is not accepted by any deterministic PDA L is not accepted by any Turing machine that halts on every input L a n mid n geq0 cup a nb n mid n geq 0 and is deterministic context free
Pushdown Automata
147
Consider the pushdown automaton PDA below which runs over the input alphabet a b c It has the stack alphabet Z_0 X where Z_0 is the bottom of stack marker The set of states of the PDA is s t u f where s is the start state and f is the final state The PDA accepts by final state The transitions of the PDA given below are depicted in a standard manner For example the transition s b X rightarrow t XZ_0 means that if the PDA is in state s and the symbol on the top of the stack is X then it can read b from the input and move to state t after popping the top of stack and pushing the symbols Z_0 and X in that order on the stack s a Z_0 rightarrow s XXZ_0 s epsilon Z_0 rightarrow f epsilon s a X rightarrow s XXX s b X rightarrow t epsilon t b X rightarrow t epsilon t c X rightarrow u epsilon u c X rightarrow u epsilon u epsilon Z_0 rightarrow f epsilon The language accepted by the PDA is a lb mc n mid l m n a l b m c n mid l m a lb mc n mid 2l m n a lb mc n mid m n
Pushdown Automata
147
Consider the NPDA left langle Q left q_ 0 q_ 1 q_ 2 right Sigma left 0 1 right Gamma left 0 1 perp right delta q_ 0 perp F left q_ 2 right right rangle where as per usual convention Q is the set of states Sigma is the input alphabet Gamma is the stack alphabet delta is the state transition function q_ 0 is the initial state perp is the initial stack symbol and F is the set of accepting states The state transition is as follows Which one of the following sequences must follow the string 101100 so that the overall string is accepted by the automaton 10110 10010 01010 01001
Pushdown Automata
147
A push down automation pda is given in the following extended notation of finite state diagram The nodes denote the states while the edges denote the moves of the pda The edge labels are of the form d s s where d is the input symbol read and s s are the stack contents before and after the move For example the edge labeled 1 s 1 s denotes the move from state q_0 to q_0 in which the input symbol 1 is read and pushed to the stack Introduce two edges with appropriate labels in the above diagram so that the resulting pda accepts the language left x2x R mid x in left 0 1 right x R ext denotes reverse of x right by empty stack Describe a non deterministic pda with three states in the above notation that accept the language left 0 n 1 m mid n leq m leq 2n right by empty stack
Pushdown Automata
147
The set of values of p for which the roots of the equation 3x 2 2x p p u20131 0 are of opposite sign is A u2013 u221e 0 B 0 1 C 1 u221e D 0 u221e
Quadratic Equations
148
The roots of ax2 bx c 0 are real and positive a b and c are real Then ax2 b x c 0 has no roots 2 real roots 3 real roots 4 real roots
Quadratic Equations
148
In a quadratic function the value of the product of the roots alpha beta is 4 Find the value of dfrac alpha n beta n alpha n beta n n 4 4 n 2 2n 1 4 n 1
Quadratic Equations
148
What is the minimum number of stacks of size n required to implement a queue of size n One Two Three Four
Queues
149
Suppose you are given an implementation of a queue of integers The operations that can be performed on the queue are isEmpty Q u2014 returns true if the queue is empty false otherwise delete Q u2014 deletes the element at the front of the queue and returns its value insert Q i u2014 inserts the integer i at the rear of the queue Consider the following function void f queue Q int i if isEmpty Q i delete Q f Q insert Q i What operation is performed by the above function f Leaves the queue Q unchanged Reverses the order of the elements in the queue Q Deletes the element at the front of the queue Q and inserts it at the rear keeping the other elements in the same order Empties the queue Q
Queues
149
Suppose a circular queue of capacity n u22121 elements is implemented with an array of n elements Assume that the insertion and deletion operations are carried out using REAR and FRONT as array index variables respectively Initially REAR FRONT 0 The conditions to detect queue full and queue empty are full REAR 1 mod n FRONT empty REAR FRONT full REAR 1 mod n FRONT empty FRONT 1 mod n REAR full REAR FRONT empty REAR 1 mod n FRONT full FRONT 1 mod n REAR empty REAR FRONT
Queues
149
Suggest a data structure for representing a subset S of integers from 1 to n Following operations on the set S are to be performed in constant time independent of cardinality of S i MEMBER X Check whether X is in the set S or not ii FIND ONE S If S is not empty return one element of the set S any arbitrary element will do iii ADD X Add integer X to set S iv DELETE X Delete integer X from S Give pictorial examples of your data structure Give routines for these operations in an English like language You may assume that the data structure has been suitable initialized Clearly state your assumptions regarding initialization
Queues
149
Let Q denote a queue containing sixteen numbers and S be an empty stack Head Q returns the element at the head of the queue Q without removing it from Q Similarly Top S returns the element at the top of S without removing it from S Consider the algorithm given below while Q is not Empty do if S is Empty OR Top S u2264 Head Q then x Dequeue Q Push S x else x Pop S Enqueue Q x end end The maximum possible number of iterations of the while loop in the algorithm is _______
Queues
149
Consider the following statements First in first out types of computations are efficiently supported by STACKS Implementing LISTS on linked lists is more efficient than implementing LISTS on an array for almost all the basic LIST operations Implementing QUEUES on a circular array is more efficient than implementing QUEUES on a linear array with two indices Last in first out type of computations are efficiently supported by QUEUES ii and iii are true i and ii are true iii and iv are true ii and iv are true
Queues
149
Consider the following operation along with Enqueue and Dequeue operations on queues where k is a global parameter MultiDequeue Q m k while Q is not empty and m gt 0 Dequeue Q m m u2013 1 What is the worst case time complexity of a sequence of n queue operations on an initially empty queue u0398 n u0398 n k u0398 nk u0398 n 2
Queues
149
An implementation of a queue Q using two stacks S1 and S2 is given below void insert Q x push S1 x void delete Q if stack empty S2 then if stack empty S1 then print u201cQ is empty u201d return else while stack empty S1 x pop S1 push S2 x x pop S2 let n insert and m leq n delete operations be performed in an arbitrary order on an empty queue Q Let x and y be the number of push and pop operations performed respectively in the process Which one of the following is true for all m and n n m leq x lt 2n and 2m leq y leq n m n m leq x lt 2n and 2m leq y leq 2n 2m leq x lt 2n and 2m leq y leq n m 2m leq x lt 2n and 2m leq y leq 2n
Queues
149
A queue Q containing n items and an empty stack S are given It is required to transfer all the items from the queue to the stack so that the item at the front of queue is on the TOP of the stack and the order of all other items are preserved Show how this can be done in O n time using only a constant amount of additional storage Note that the only operations which can be performed on the queue and stack are Delete Insert Push and Pop Do not assume any implementation of the queue or stack
Queues
149
A queue is implemented using an array such that ENQUEUE and DEQUEUE operations are performed efficiently Which one of the following statements is CORRECT n refers to the number of items in the queue Both operations can be performed in O 1 time At most one operation can be performed in O 1 time but the worst case time for the operation will be Omega n The worst case time complexity for both operations will be Omega n Worst case time complexity for both operations will be Omega log n
Queues
149
A circular queue has been implemented using a singly linked list where each node consists of a value and a single pointer pointing to the next node We maintain exactly two external pointers FRONT and REAR pointing to the front node and the rear node of the queue respectively Which of the following statements is are CORRECT for such a circular queue so that insertion and deletion operations can be performed in O 1 time Next pointer of front node points to the rear node Next pointer of rear node points to the front node I only II only Both I and II Neither I nor II
Queues
149
A main memory unit with a capacity of 4 megabytes is built using 1M imes 1 bit DRAM chips Each DRAM chip has 1K rows of cells with 1K cells in each row The time taken for a single refresh operation is 100 nanoseconds The time required to perform one refresh operation on all the cells in the memory unit is 100 nanoseconds 100 imes 2 10 nanoseconds 100 imes 2 20 nanoseconds 3200 imes 2 20 nanosesonds
Ram
150
A dynamic RAM has a memory cycle time of 64 nsec It has to be refreshed 100 times per msec and each refresh takes 100 nsec What percentage of the memory cycle time is used for refreshing 10 6 4 1 0 64
Ram
150
Suppose X_i for i 1 2 3 are independent and identically distributed random variables whose probability mass functions are Pr X_i 0 Pr X_i 1 frac 1 2 ext for i 1 2 3 Define another random variable Y X_1X_2 oplus X_3 where oplus denotes XOR Then Pr Y 0 mid X_3 0 ______
Random Variable
151
Let X be a Gaussian random variable with mean 0 and variance sigma 2 Let Y max left X 0 right where max left a b right is the maximum of a and b The median of Y is ______________
Random Variable
151
If the difference between the expectation of the square of a random variable left E left X 2 right right and he square of the expectation of the random variable left E left X right right 2 is denoted by R then A R 0 B R lt 0 C R geq 0 D R gt 0
Random Variable
151
For any discrete random variable X with probability mass function P X j p_j p_j geq 0 j in 0 dots N and Sigma_ j 0 N p_j 1 define the polynomial function g_x z Sigma_ j 0 N p_j z j For a certain discrete random variable Y there exists a scalar beta in 0 1 such that g_y z 1 beta beta z N The expectation of Y is N beta 1 beta N beta N 1 beta Not expressible in terms of N and beta alone
Random Variable
151
Consider a random variable X that takes values 1 and u22121 with probability 0 5 each The values of the cumulative distribution function F x at x u22121 and 1 are A 0 and 0 5 B 0 and 1 C 0 5 and 1 D 0 25 and 0 75
Random Variable
151
Consider a finite sequence of random values X x_1 x_2 dots x_n Let mu_x be the mean and sigma_x be he standard deviation of X Let another finite sequence Y of equal length be derived from this as y_i a x_i b where a and b are positive constants Let mu_y be the mean and sigma_y be the standard deviation of this sequence Which one of the following statements is INCORRECT A Index position of mode of X in X is the same as the index position of mode of Y in Y B Index position of median of X in X is the same as the index position of median of Y in Y C mu_y a mu_x b D sigma_y a sigma_x b
Random Variable
151
Let f x be the continuous probability density function of a random variable x the probability that a lt x leq b is f b a f b f a int limits_a b f x dx int limits_a b xf x dx
Random Variable
151
Nobody knows yet if P NP Consider the language L defined as follows L begin cases 0 1 amp ext if P NP phi amp otherwise end cases Which of the following statements is true L is recursive L is recursively enumerable but not recursive L is not recursively enumerable Whether L is recursively enumerable or not will be known after we find out if P NP
Recursive And Recursively Enumerable Languages
152
Let X be a recursive language and Y be a recursively enumerable but not recursive language Let W and Z be two languages such that overline Y reduces to W and Z reduces to overline X reduction means the standard many one reduction Which one of the following statements is TRUE W can be recursively enumerable and Z is recursive W can be recursive and Z s recursively enumerable W is not recursively enumerable and Z is recursive W is not recursively enumerable and Z is not recursive
Recursive And Recursively Enumerable Languages
152
Let L1 be a recursive language and let L2 be a recursively enumerable but not a recursive language Which one of the following is TRUE L1 is recursive and L2 is recursively enumerable L1 is recursive and L2 is not recursively enumerable L1 and L2 are recursively enumerable L1 is recursively enumerable and L2 is recursive
Recursive And Recursively Enumerable Languages
152
Let L_1 be the recursive language Let L_2 and L_3 be languages that are recursively enumerable but not recursive Which of the following statements is not necessarily true L_2 L_1 ext is recursively enumerable L_1 L_3 ext is recursively enumerable L_2 cap L_3 ext is recursively enumerable L_2 cup L_3 ext is recursively enumerable
Recursive And Recursively Enumerable Languages
152
Let L be a language and bar L be its complement Which one of the following is NOT a viable possibility Neither L nor bar L is recursively enumerable r e One of L and bar L is r e but not recursive the other is not r e Both L and bar L are r e but not recursive Both L and bar L are recursive
Recursive And Recursively Enumerable Languages
152
Let A leq_m B denotes that language A is mapping reducible also known as many to one reducible to language B Which one of the following is FALSE If A leq_m B and B is recursive then A is recursive If A leq_m B and A is undecidable then B is undecidable If A leq_m B and B is recursively enumerable then A is recursively enumerable If A leq_m B and B is not recursively enumerable then A is not recursively enumerable
Recursive And Recursively Enumerable Languages
152
If the strings of a language L can be effectively enumerated in lexicographic i e alphabetic order which of the following statements is true L is necessarily finite L is regular but not necessarily finite L is context free but not necessarily regular L is recursive but not necessarily context free
Recursive And Recursively Enumerable Languages
152
If L and bar L are recursively enumerable then L is regular context free context sensitive recursive
Recursive And Recursively Enumerable Languages
152
For any two languages L_ 1 and L_ 2 such that L_ 1 is context free and L_ 2 is recursively enumerable but not recursive which of the following is are necessarily true bar L _ 1 Compliment of L_ 1 is recursive bar L _ 2 Compliment of L_ 2 is recursive bar L _ 1 is context free bar L _ 1 u222a L_ 2 is recursively enumerable I only III only III and IV only I and IV only
Recursive And Recursively Enumerable Languages
152
Choose the correct alternatives More than one may be correct Recursive languages are A proper superset of context free languages Always recognizable by pushdown automata Also called type emptyset languages Recognizable by Turing machines
Recursive And Recursively Enumerable Languages
152
The following table has two attributes A and C where A is the primary key and C is the foreign key referencing A with on delete cascade A C 2 4 3 4 4 3 5 2 7 2 9 5 6 4 The set of all tuples that must be additionally deleted to preserve referential integrity when the tuple 2 4 is deleted is 3 4 and 6 4 5 2 and 7 2 5 2 7 2 and 9 5 3 4 4 3 and 6 4
Referential Integrity
153
Consider the following tables T1 and T2 T1 P Q 2 2 3 8 7 3 5 8 6 9 8 5 9 8 T2 R S 2 2 8 3 3 2 9 7 5 7 7 2 In table T1 P is the primary key and Q is the foreign key referencing R in table T2 with on delete cascade and on update cascade In table T2 R is the primary key and S is the foreign key referencing P in table T1 with on delete set NULL and on update cascade In order to delete record langle 3 8 rangle from the table T1 the number of additional records that need to be deleted from table T1 is _______
Referential Integrity
153
Let R a b c and S d e f be two relations in which d is the foreign key of S that refers to the primary key of R Consider the following four operations R and S Insert into R Insert into S Delete from R Delete from S Which of the following can cause violation of the referential integrity constraint above Both I and IV Both II and III All of these None of these
Referential Integrity
153
The string 1101 does not belong to the set represented by a 110 0 1 b 1 0 1 101 c 10 01 00 11 d 00 11 0
Regular Expressions
154
The regular expression 0 10 denotes the same set as 1 0 1 0 0 10 0 1 10 0 1 None of the above
Regular Expressions
154
Let S and T be languages over Sigma a b represented by the regular expressions a b and a b respectively Which of the following is true S subset T T subset S S T S cap T phi
Regular Expressions
154
In some programming language an identifier is permitted to be a letter followed by any number of letters or digits If L and D denote the sets of letters and digits respectively which of the following expressions defines an identifier L D L D L L D L L D
Regular Expressions
154
If the regular set A is represented by A 01 1 and the regular set B is represented by B left left 01 right 1 right which of the following is true a A subset B b B subset A c A and B are incomparable d A B
Regular Expressions
154
Give a regular expression over the alphabet 0 1 to denote the set of proper non null substrings of the string 0110
Regular Expressions
154
Give a regular expression for the set of binary strings where every 0 is immediately followed by exactly k 1 s and preceded by at least k 1 u2019s k is a fixed integer
Regular Expressions
154
02 Choose the correct alternatives more than one may be correct and write the corresponding letters only Which of the following regular expression identities is are TRUE a r r b r s r s c r s r s d r s r s
Regular Expressions
154
Which two of the following four regular expressions are equivalent varepsilon is the empty string 00 varepsilon 0 00 0 0 00 i and ii ii and iii i and iii iii and iv
Regular Expressions
154
Which one of the following regular expressions represents the language the set of all binary strings having two consecutive 0 s and two consecutive 1 s 0 1 0011 0 1 0 1 1100 0 1 0 1 00 0 1 11 11 0 1 00 0 1 0 1 00 0 1 0 1 11 0 1 00 0 1 11 11 0 1 00
Regular Expressions
154
The regular expression for the language recognized by the finite state automaton of figure is ______
Regular Expressions
154
Choose the correct alternatives more than one may be correct and write the corresponding letters only Let r 1 1 0 s 11 0 ext and t 1 0 be three regular expressions Which one of the following is true L s subseteq L r and L s subseteq L t L r subseteq L s and L s subseteq L t L s subseteq L t and L s subseteq L r L t subseteq L s and L s subseteq L r None of the above
Regular Expressions
154
Is the language generated by the grammer G regular If so give a regular expression for it else prove otherwise G S rightarrow aB B rightarrow bC C rightarrow xB C rightarrow c
Regular Grammar
155
Consider the regular grammar below S u2192 bS aA u03f5 A u2192 aS bA The Myhill Nerode equivalence classes for the language generated by the grammar are w u220a a b a w is even and w u220a a b a w is odd w u220a a b a w is even and w u220a a b b w is odd w u220a a b a w b w and w u220a a b a w u2260 b w u03f5 wa w u220a a b and wb w u220a a b
Regular Grammar
155
Consider the alphabet Sigma 0 1 the null empty string lambda and the set of strings X_0 X_1 ext and X_2 generated by the corresponding non terminals of a regular grammar X_0 X_1 ext and X_2 are related as follows X_0 1 X_1 X_1 0 X_1 1 X_2 X_2 0 X_1 lambda Which one of the following choices precisely represents the strings in X_0 10 0 10 1 10 0 10 1 1 0 10 1 10 0 10 1 110 0 10 1
Regular Grammar
155
The number of edges in a regular graph of degree d and n vertices is ____________
Regular Graph
156
What can be said about a regular language L over a whose minimal finite state automaton has two states L must be an n is odd L must be an n is even L must be an n u2265 0 Either L must be an n is odd or L must be an n is even
Regular Languages
157
Let Sigma left 0 1 right L Sigma and R left 0 n1 n mid n gt 0 right then the languages L cup R and R are respectively A regular regular B not regular regular C regular not regular D not regular not regular
Regular Languages
157
Let L subseteq Sigma where Sigma left a b right Which of the following is true a L left x mid x ext has an equal number of a ext s and b ext s right is regular b L left a nb n mid n geq 1 right is regular c L left x mid x ext has more number of a ext s than b ext s right is regular d L left a mb n mid m geq 1 n geq 1 right is regular
Regular Languages
157
Let L be a regular language Consider the constructions on L below repeat L ww w u220a L prefix L u u2203v uv u220a L suffix L v u2203u uv u220a L half L u u2203v v u and uv u220a L Which of the constructions could lead to a non regular language Both I and IV Only I Only IV Both II and III
Regular Languages
157
Let L be a regular language Consider the constructions on L below ext repeat L ww mid w in L ext prefix L u mid exists v uv in L ext suffix L v mid exists u uv in L ext half L u mid exists v v u ext and uv in L Which of the constructions could lead to a non regular language Both I and IV Only 1 Only IV Both II and III Which choice of L is best suited to support your answer above a b u03f5 a ab bab ab a nb n mid n geq 0
Regular Languages
157
If s is a string over 0 1 then let n0 s denote the number of 0 u2019s in s and n1 s the number of 1 u2019s in s Which one of the following languages is not regular L left s in 0 1 mid n_ 0 s ext is a 3 digit prime right L left s in 0 1 mid ext for every prefix s of s mid n_ 0 s n_ 1 s mid leq 2 right L left s in 0 1 mid n_ 0 s n_ 1 s mid leq 4 right L left s in 0 1 mid n_ 0 s mod 7 n_ 1 s mod 5 0 right
Regular Languages
157
Consider the following two statements S_1 left 0 2n mid n geq 1 right is a regular language S_2 left 0 m1 n0 m n mid m geq 1 ext and n geq 1 right is a regular language Which of the following statement is correct Only S_1 is correct Only S_2 is correct Both S_1 and S_2 are correct None of S_1 and S_2 is correct
Regular Languages
157
Consider the following languages L1 left ww mid w in a b right L2 left ww R mid w in a b w R ext is the reverse of w right L3 left 0 2i mid ext i is an integer right L4 left 0 i 2 mid ext i is an integer right Which of the languages are regular Only L1 and L2 Only L2 L3 and L4 Only L3 and L4 Only L3
Regular Languages
157
Choose the correct alternatives More than one may be correct Let R_ 1 and R_ 2 be regular sets defined over the alphabet Sigma Then R_ 1 cap R_ 2 is not regular R_ 1 cup R_ 2 is regular Sigma R_ 1 is regular R_ 1 is not regular
Regular Languages
157
Choose the correct alternatives more than one may be correct and write the corresponding letters only Which of the following is the strongest correct statement about a finite language over some finite alphabet Sigma a It could be undecidable b It is Turing machine recognizable c It is a context sensitive language d It is a regular language e None of the above
Regular Languages
157
Given that A is regular and A cup B is regular does it follow that B is necessarily regular Justify your answer Given two finite automata M1 M2 outline an algorithm to decide if L M1 subset L M2 note strict subset
Regular Languages
157
Suppose the adjacency relation of vertices in a graph is represented in a table Adj X Y Which of the following queries cannot be expressed by a relational algebra expression of constant length List all vertices adjacent to a given vertex List all vertices which have self loops List all vertices which belong to cycles of less than three vertices List all vertices reachable from a given vertex
Relational Algebra
158
Let r and s be two relations over the relation schemes R and S respectively and let A be an attribute in R The relational algebra expression sigma_ A a r bowtie s is always equal to sigma_ A a r r sigma_ A a r bowtie s None of the above
Relational Algebra
158
Information about a collection of students is given by the relation ext studInfo underline ext studId ext name sex The relation ext enroll underline ext studId underline ext courseId gives which student has enrolled for or taken what course s Assume that every course is taken by at least one male and at least one female student What does the following relational algebra expression represent pi _ courceId left left pi_ ext studId left sigma_ sex female left ext studInfo right right imes pi_ courseId left ext enroll right right ext enroll right Courses in which all the female students are enrolled Courses in which a proper subset of female students are enrolled Courses in which only male students are enrolled None of the above
Relational Algebra
158
Given two union compatible relations R_1 A B and R_2 C D what is the result of the operation R_1 Join_ A C wedge B D R_2 R_1 cup R_2 R_1 imes R_2 R_1 u2013 R_2 R_1 cap R_2
Relational Algebra
158
Consider the relation Student name sex marks where the primary key is shown underlined pertaining to students in a class that has at least one boy and one girl What does the following relational algebra expression produce Note rho is the rename operator pi_ name mathcal r _ sex female Student pi_ name Student_ sex female wedge x male wedge marks leq m rho_ n x m Student names of girl students with the highest marks names of girl students with more marks than some boy student names of girl students with marks not less than some boy student names of girl students with more marks than all the boy students
Relational Algebra
158
Consider the relation scheme AUTHOR ANAME INSTITUTION ACITY AGE PUBLISHER PNAME PCITY BOOK TITLE ANAME PNAME Express the following queries using one or more of SELECT PROJECT JOIN and DIVIDE operations Get the names of all publishers Get values of all attributes of all authors who have published a book for the publisher with PNAME u2019TECHNICAL PUBLISHERS u2019 Get the names of all authors who have published a book for any publisher located in Madras
Relational Algebra
158
Consider the join of a relation R with a relation S If R has m tuples and S has n tuples then the maximum and minimum sizes of the join respectively are m n and 0 mn and 0 m n and m n mn and m n
Relational Algebra
158
Consider the following SQL query Select distinct a_1 a_2 u2026 a_n from r_1 r_2 u2026 r_m where P For an arbitrary predicate P this query is equivalent to which of the following relational algebra expressions Pi_ a_1 a_2 u2026 a_n sigma_p left r_1 imes r_2 imes dots imes r_m right Pi_ a_1 a_2 u2026 a_n sigma_p left r_1 bowtie r_2 bowtie dots bowtie r_m right Pi_ a_1 a_2 u2026 a_n sigma_p left r_1 cup r_2 cup dots cup r_m right Pi_ a_1 a_2 u2026 a_n sigma_p left r_1 cap r_2 cap dots cap r_m right
Relational Algebra
158
Consider the following relational schema COURSES cno cname STUDENTS rollno sname age year REGISTERED FOR cno rollno The underlined attributes indicate the primary keys for the relations The u2018year u2019 attribute for the STUDENTS relation indicates the year in which the student is currently studying First year Second year etc Write a relational algebra query to print the roll number of students who have registered for cno 322 Write a SQL query to print the age and year of the youngest student in each year
Relational Algebra
158
Consider the following relational database schemes COURSES Cno name PRE REQ Cno pre Cno COMPLETED student_no Cno COURSES gives the number and name of all the available courses PRE REQ gives the information about which courses are pre requisites for a given course COMPLETED indicates what courses have been completed by students Express the following using relational algebra List all the courses for which a student with student_no 2310 has completed all the pre requisites
Relational Algebra
158
A university placement center maintains a relational database of companies that interview students on campus and make job offers to those successful in the interview The schema of the database is given below COMPANY cname clocation STUDENT scrollno sname sdegree INTERVIEW cname srollno idate OFFER cname srollno osalary The COMPANY relation gives the name and location of the company The STUDENT relation gives the student u2019s roll number name and the degree program for which the student is registered in the university The INTERVIEW relation gives the date on which a student is interviewed by a company The OFFER relation gives the salary offered to a student who is successful in a company u2019s interview The key for each relation is indicated by the underlined attributes Write a relational algebra expressions using only the operator sigma pi cup for the following queries List the rollnumbers and names of students who attended at least one interview but did not receive any job offer List the rollnumbers and names of students who went for interviews and received job offers from every company with which they interviewed Write an SQL query to list for each degree program in which more than five students were offered jobs the name of the degree and the average offered salary of students in this degree program
Relational Algebra
158
A table student with schema roll name hostel marks and another table hobby with schema roll hobbyname contains records as shown below Table Student Roll Name Hostel Marks 1798 Manoj Rathod 7 95 2154 Soumic Banerjee 5 68 2369 Gumma Reddy 7 86 2581 Pradeep Pendse 6 92 2643 Suhas Kulkarni 5 78 2711 Nitin Kadam 8 72 2872 Kiran Vora 5 92 2926 Manoj Kunkalikar 5 94 2959 Hemant Karkhanis 7 88 3125 Rajesh Doshi 5 82 Table hobby Roll Hobbyname 1798 chess 1798 music 2154 music 2369 swimming 2581 cricket 2643 chess 2643 hockey 2711 volleyball 2872 football 2926 cricket 2959 photography 3125 music 3125 chess The following SQL query is executed on the above tables select hostel from student natural join hobby where marks gt 75 and roll between 2000 and 3000 Relations S and H with the same schema as those of these two tables respectively contain the same information as tuples A new relation S u2019 is obtained by the following relational algebra operation S u2019 u220fhostel u03c3s roll H roll u03c3marks gt 75 and roll gt 2000 and roll lt 3000 S X H The difference between the number of rows output by the SQL statement and the number of tuples in S u2019 is 6 4 2 0
Relational Algebra
158
A library relational database system uses the following schema USERS User User Name Home Town BOOKS Book Book Title Author Name ISSUED Book User Date Explain in one English sentence what each of the following relational algebra queries is designed to determine sigma_ ext User 6 left pi_ ext User Book Title left left ext USERS bowtie ext ISSUED right bowtie ext BOOKS right right pi_ ext Author Name left ext BOOKS bowtie sigma_ ext Home Town Delhi left ext USERS bowtie ext ISSUED right right
Relational Algebra
158
Suppose we have a database consisting of the following three relations FREQUENTS CUSTOMER HOTEL SERVES HOTEL SNACKS LIKES CUSTOMER SNACKS The first indicates the hotels each customer visits the second tells which snacks each hotel serves and last indicates which snacks are liked by each customer Express the following query in relational algebra Print the hotels the serve the snack that customer Rama likes
Relational Algebra
158
Given the relations employee name salary dept no and department dept no dept name address Which of the following queries cannot be expressed using the basic relational algebra operations left sigma pi imes Join cup cap right Department address of every employee Employees whose name is the same as their department name The sum of all employees salaries All employees of a given department
Relational Algebra
158
The relational algebra expression equivalent to the following tuple calculus expression left t mid t in r land left t A 10 land t B 20 right right is sigma_ A 10 lor B 20 r sigma_ A 10 r cup sigma_ B 20 r sigma_ A 10 r cap sigma_ B 20 r sigma_ A 10 r sigma_ B 20 r
Relational Calculus
159
The following relations are used to store data about students courses enrollment of students in courses and teachers of courses Attributes for primary key in each relation are marked by u2018 u2019 Students rollno sname saddr courses cno cname enroll rollno cno grade each tno tname cao cno is course number cname is course name tno is teacher number tname is teacher name sname is student name etc Write a SQL query for retrieving roll number and name of students who got A grade in at least one course taught by teacher names Ramesh for the above relational database
Relational Calculus
159
Student school id sch roll no sname saddress School school id sch name sch address sch phone Enrolment school id sch roll no erollno examname ExamResult erollno examname marks Consider the following tuple relational calculus query t u2203 E u220a Enrolment t E school id x x u220a Enrolment x school id t u2203 B u220a ExamResult B erollno x erollno B examname x examname B marks gt 35 x x u220a Enrolment x school id t 100 gt 35 If a student needs to score more than 35 marks to pass an exam what does the query return The empty set schools with more than 35 of its students enrolled in some exam or the other schools with a pass percentage above 35 over all exams taken together schools with a pass percentage above 35 over each exam
Relational Calculus
159
Let R_1 left underline A B C right and R_2 left underline D E right be two relation schema where the primary keys are shown underlined and let C be a foreign key in R_1 referring to R_2 Suppose there is no violation of the above referential integrity constraint in the corresponding relation instances r_1 and r_2 Which of the following relational algebra expressions would necessarily produce an empty relation Pi_D r_2 Pi_C r_1 Pi_C r_1 Pi_D r_2 Pi_D left r_1 bowtie_ C eq D r_2 right Pi_C left r_1 bowtie_ C D r_2 right
Relational Calculus
159