• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

Sudo GATE 2020 Mock I (27 December 2019)

Question 61

Consider the following database schema:
BOOK(Book_id, Title, Publisher_name)
BOOK_AUTHORS(Book_id, Author_name)
PUBLISHER(Name, Address, Phone)
BOOK_COPIES(Book_id, Branch_id, No_of_copies)
BOOK_LOANS(Book_id, Branch_id, Card_no, Date_out, Due_date)
LIBRARY_BRANCH(Branch_id, Branch_name, Address)
BORROWER(Card_no, Name, Address, Phone) 
Note that BOOK_COPIES only contains entries where No_of_copies is at least 1 - if a branch doesn\'t contain any copies of some book, there is no entry in BOOK_COPIES (not an entry with 0 copies). Key attributes are underlined. The foreign key constraints are the following:
  • The Publisher_name in BOOK refers to the Name in PUBLISHER.
  • The Book_id attributes in BOOK_AUTHORS, BOOK_COPIES, and BOOK_LOANS all refer to the Book_id in BOOK.
  • The Branch_id attributes in BOOK_COPIES and BOOK_LOANS both refer to the Branch_id in LIBRARY_BRANCH.
  • The Card_no in BOOK_LOANS refers to the Card_no in BORROWER.
We want to find the titles of all of the books written by the author(s) who have written the largest number of books. Which of the following query is not correct ? (Assume there can be tie.).
  • SELECT DISTINCT Title
        FROM BOOK NATURAL JOIN BOOK_AUTHORS
        WHERE Author_name IN ( SELECT Author_name
                               FROM BOOK NATURAL JOIN BOOK_AUTHORS
                               GROUP BY Author_name
                               HAVING COUNT(*) >= ALL ( SELECT COUNT(*)
                                                        FROM BOOK NATURAL JOIN BOOK_AUTHORS
                                                        GROUP BY Author_name ) )
  • SELECT DISTINCT Title
        FROM BOOK NATURAL JOIN BOOK_AUTHORS
        WHERE Author_name = ANY ( SELECT Author_name
                                  FROM BOOK NATURAL JOIN BOOK_AUTHORS
                                  GROUP BY Author_name
                                  HAVING COUNT(*) >= ALL ( SELECT COUNT(*)
                                                           FROM BOOK NATURAL JOIN BOOK_AUTHORS
                                                           GROUP BY Author_name ) )
  • SELECT DISTINCT Title
        FROM BOOK NATURAL JOIN BOOK_AUTHORS A
        WHERE ( SELECT COUNT(*)
                FROM BOOK_AUTHORS A2
                WHERE A.Author_name=A2.Author_name ) >= ALL ( SELECT COUNT(*)
                                                              FROM BOOK NATURAL JOIN BOOK_AUTHORS
                                                              GROUP BY Author_name )
  • SELECT DISTINCT Title
        FROM BOOK NATURAL JOIN BOOK_AUTHORS
        WHERE Author_name = ( SELECT Author_name
                               FROM BOOK NATURAL JOIN BOOK_AUTHORS
                               GROUP BY Author_name
                               HAVING COUNT(*) >= ALL ( SELECT COUNT(*)
                                                        FROM BOOK NATURAL JOIN BOOK_AUTHORS
                                                        GROUP BY Author_name ) )

Question 62

Consider the following C program: C
#include <stdio.h>#include <string.h>void geek1(char *s1, char *s2) {    char *temp;    temp = s1;    s1 = s2;    s2 = temp;}void geek2(char **s1, char **s2) {    char *temp;    temp = *s1;    *s1 = *s2;    *s2 = temp;}int main() {    char *str1 = \"for geek\", *str2 = \"by geek\";    geek1(str1, str2);    printf(\"%s %s\", str1, str2);    geek2(&str1, &str2);    printf(\" %d\", (int) strlen(str1));    return 0;}
Last printf will printed _______________ .
  • 2
     

  • 7
     

  • 3
     

  • None of these
     

Question 63

Consider the following relation algebra query:

Which of the following option is correct regarding above query ?
  • Find the names of suppliers supplying some red part for less than 100 Quid and some green part for less than 100 Quid.
  • Find the sids of suppliers supplying some red part for less than 100 Quid and some green part for less than 100 Quid, and return only sid’s of suppliers recorded in the table Supplier.
  • Find the names of suppliers such that there is a supplier with that name supplying some red part for less than 100 Quid and a supplier with that name supplying some green part for less than 100 Quid.
  • All of the these.

Question 64

Compute minimum spanning tree for the following undirected, weighted graph, using Prim\'s algorithm
The weight and number of spanning tree(s) are _____________ .
  • 38 and 2 respectively.
  • 34 and 1 respectively.
  • 34 and 2 respectively.
  • None of these.

Question 65

Consider the following statements: I. If L1 and L2 are languages such that L2, L1L2, and L2L1 are all regular, then L1 must be regular. II. If R and S are two regular expressions, then a solution of x = Rx + S is x = RS*. III. If L is a regular language, then {wwR | w in L} must be a regular language. (Here, wR denotes the reverse of string w.) Which of the following option is correct?
  • Statements I and II are false. Statement III is true.
  • All statements I, II, and III are false.
  • Only statement I and III are false. Statement II is true.
  • None of these.

There are 65 questions to complete.

Last Updated :
Take a part in the ongoing discussion