Infosys Campus Connect - IT Branches (Batch 2 To 5) Quiz

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Infycc
I
Infycc
Community Contributor
Quizzes Created: 2 | Total Attempts: 514
Questions: 50 | Attempts: 367

SettingsSettingsSettings
Infosys Campus Connect - IT Branches (Batch 2 To 5) Quiz - Quiz

This quiz is for Batch 2, 3, 4, 5 (IT branches) and contains 50 MCQ questions. All the best :)


Questions and Answers
  • 1. 

    a = True b = False c = False if a or b and c: print "IF" else: print "ELSE"

    • A.

      IF

    • B.

      ELSE

    • C.

      Run Time Error

    • D.

      None of These

    Correct Answer
    A. IF
    Explanation
    The correct answer is "IF" because the condition in the if statement is evaluated as true. The condition is "a or b and c", which means that if either a is true or both b and c are true, the condition is true. In this case, a is true, so the condition is true and the code inside the if block is executed, which prints "IF".

    Rate this question:

  • 2. 

    count = 1 def doThis(): count = 1 for i in (1, 2, 3): count += 1 doThis() print count

    • A.

      1

    • B.

      2

    • C.

      4

    • D.

      None of These

    Correct Answer
    A. 1
    Explanation
    The code defines a function called "doThis" which initializes a local variable "count" to 1. Then, a for loop iterates over the tuple (1, 2, 3) and increments the "count" variable by 1 for each iteration. However, the "doThis" function is never called in the code. Therefore, the value of "count" remains 1. Finally, the value of "count" is printed, which is 1.

    Rate this question:

  • 3. 

    Suppose list1 is [3, 4, 15, 20, 5, 25, 1, 3], what is list1 after list1.pop(1)?

    • A.

      [3, 4, 15, 20, 5, 25, 1, 3]

    • B.

      [3, 15, 20, 5, 25, 1, 3]

    • C.

      [1, 3, 3, 4, 15, 5, 20, 25]

    • D.

      [3, 15, 20, 5, 25, ]

    Correct Answer
    B. [3, 15, 20, 5, 25, 1, 3]
    Explanation
    After executing the code list1.pop(1), the element at index 1 (value 4) is removed from the list. The remaining elements are shifted to fill the gap, resulting in the updated list [3, 15, 20, 5, 25, 1, 3].

    Rate this question:

  • 4. 

    Which function removes an object from a list?

    • A.

       list.index(obj)

    • B.

      list.insert(index, obj)

    • C.

      list.pop(obj=list[-1])

    • D.

      list.remove(obj)

    Correct Answer
    D. list.remove(obj)
    Explanation
    The function list.remove(obj) is used to remove an object from a list. It takes the object as an argument and removes the first occurrence of that object from the list. This function modifies the original list and does not return any value.

    Rate this question:

  • 5. 

    Which of the following function convert a String to a set in python?

    • A.

       set(x)

    • B.

      frozenset(s)

    • C.

      dict(d)

    • D.

      chr(x)

    Correct Answer
    A.  set(x)
    Explanation
    The function set(x) in Python converts a string to a set.

    Rate this question:

  • 6. 

    find the output of following statement: name = "snow storm"  print(name[6:8])

    • A.

      st

    • B.

      sto

    • C.

      to

    • D.

      error

    Correct Answer
    C. to
    Explanation
    The given statement assigns the string "snow storm" to the variable name. The expression name[6:8] is used to access a substring of name starting from index 6 and ending at index 8 (exclusive). This means it will access the characters at index 6 and 7. In the string "snow storm", the characters at index 6 and 7 are "t" and "o" respectively. Therefore, the output of the statement will be "to".

    Rate this question:

  • 7. 

    What data type is the object below ? L = [1, 23, ‘hello’, 1]

    • A.

      Lists

    • B.

      Dictionary

    • C.

      Class

    • D.

      Tuples

    Correct Answer
    A. Lists
    Explanation
    The object L is a list because it is enclosed in square brackets and contains a sequence of elements separated by commas. Lists are a data type in Python that can hold multiple values of different types. In this case, the list contains the values 1, 23, 'hello', and 1.

    Rate this question:

  • 8. 

    Which of the following operators has its associativity from right to left?  

    • A.

      +

    • B.

      //

    • C.

      %

    • D.

      **

    Correct Answer
    D. **
    Explanation
    The operator with right-to-left associativity is the exponentiation operator (**). This means that when there are multiple exponentiation operators in an expression, the calculation is performed from right to left. For example, in the expression 2 ** 3 ** 2, the calculation is performed as 2 ** (3 ** 2), resulting in 2 ** 9.

    Rate this question:

  • 9. 

    Identify the output of following statements : boxes = {} jars = {} crates = {} boxes['cereal'] = 1 boxes['candy'] = 2 jars['honey'] = 4 crates['boxes'] = boxes crates['jars'] = jars print(len(crates[boxes]))

    • A.

      1

    • B.

      2

    • C.

      4

    • D.

      7

    Correct Answer
    B. 2
    Explanation
    The code initializes three empty dictionaries: boxes, jars, and crates. Then, it assigns the value 1 to the key 'cereal' in the boxes dictionary and the value 2 to the key 'candy'. It also assigns the value 4 to the key 'honey' in the jars dictionary. Next, it assigns the boxes dictionary to the key 'boxes' in the crates dictionary, and the jars dictionary to the key 'jars'. Finally, it prints the length of crates[boxes]. Since boxes is a dictionary, crates[boxes] will raise a KeyError because it is looking for the key 'boxes' within the crates dictionary, not the variable boxes. Therefore, the output will be 2.

    Rate this question:

  • 10. 

    What is the output? f = None for i in range (5):     with open("data.txt", "w") as f:         if i > 2:             break print(f.closed)  

    • A.

      True

    • B.

      False

    • C.

      None

    • D.

      Error

    Correct Answer
    A. True
    Explanation
    The output of the code will be True. This is because the "with open" statement opens the file "data.txt" in write mode and assigns it to the variable f. Since the file is successfully opened, f.closed will return True. The for loop runs 5 times, but when i becomes greater than 2, the break statement is executed and the loop is terminated. However, since the file was opened outside of the loop, it remains open and f.closed still returns True.

    Rate this question:

  • 11. 

    What is the output ? sets = {3, 4, 5} sets.update([1, 2, 3]) print(sets)

    • A.

      {1, 2, 3, 4, 5}

    • B.

      {2,1,3,4,5}

    • C.

      {1,2,3,4}

    • D.

      none of these

    Correct Answer
    A. {1, 2, 3, 4, 5}
    Explanation
    The output of the code is {1, 2, 3, 4, 5}. The sets.update() method adds the elements from the given iterable (in this case, [1, 2, 3]) to the set. Since sets are unordered collections, the order of the elements in the output may vary. However, all the elements from the given iterable will be added to the set.

    Rate this question:

  • 12. 

    What is the output of the following code? a = {} a [2]=1 a [1]={2,3,4} print (a[1][1])  

    • A.

      [2,3,4]

    • B.

      3

    • C.

      2

    • D.

      an exception is thrown

    Correct Answer
    B. 3
    Explanation
    The code initializes an empty dictionary "a". Then, it assigns the value 1 to key 2 in dictionary "a". Next, it assigns a list [2, 3, 4] to key 1 in dictionary "a". Finally, it prints the value at index 1 in the list associated with key 1 in dictionary "a", which is 3.

    Rate this question:

  • 13. 

     ……............. clause is used to pass on privileges to other users in database 

    • A.

      Create option

    • B.

      Grant option

    • C.

      Update option

    • D.

      Select option

    Correct Answer
    B. Grant option
    Explanation
    The "grant option" clause is used to pass on privileges to other users in a database. This means that a user who has been granted a privilege with the "grant option" can then grant that same privilege to other users. This allows for the delegation of privileges and helps to manage access control in a database system.

    Rate this question:

  • 14. 

    In which of the following is a single-entity instance of one type related to many entity instances of another type?

    • A.

      One-to-One Relationship

    • B.

      One-to-Many Relationship

    • C.

      Many-to-Many Relationship

    • D.

      Composite Relationship

    Correct Answer
    B. One-to-Many Relationship
    Explanation
    A one-to-many relationship is when a single entity instance of one type is related to many entity instances of another type. This means that for every instance of the first entity, there can be multiple instances of the second entity associated with it.

    Rate this question:

  • 15. 

    In the __________ normal form, a composite attribute is converted to individual attributes.

    • A.

      First

    • B.

      Second

    • C.

      Third

    • D.

      Forth

    Correct Answer
    A. First
    Explanation
    In the First normal form, a composite attribute is converted to individual attributes. This means that instead of having a single attribute that contains multiple values, each value is separated into its own attribute. This helps to eliminate redundancy and improve data integrity.

    Rate this question:

  • 16. 

    The attribute that can not be divided into any other attributes is called ________

    • A.

      Simple

    • B.

      composite

    • C.

      multivalued

    • D.

      derived

    Correct Answer
    A. Simple
    Explanation
    A simple attribute is one that cannot be divided into any other attributes. It represents an atomic value and cannot be further decomposed.

    Rate this question:

  • 17. 

    _____________refers to the correctness and completeness of the data in a database

    • A.

      Data Integrity

    • B.

      Data Security

    • C.

      Data Independence

    • D.

      Data Constraints

    Correct Answer
    A. Data Integrity
    Explanation
    Data integrity refers to the correctness and completeness of the data in a database. It ensures that the data is accurate, consistent, and reliable. Data integrity is maintained through various mechanisms such as data validation rules, referential integrity constraints, and data quality checks. It is essential for ensuring the reliability and trustworthiness of the data stored in a database.

    Rate this question:

  • 18. 

    To delete rows from table use command in SQL

    • A.

      Drop

    • B.

      Delete

    • C.

      Rename

    • D.

      All

    Correct Answer
    B. Delete
    Explanation
    The correct answer is "Delete". In SQL, the "Delete" command is used to remove one or more rows from a table. It allows us to specify the condition for deleting the rows, such as deleting rows where a certain column value matches a specific criteria. The "Drop" command is used to remove an entire table, the "Rename" command is used to change the name of a table, and "All" is not a valid command in SQL.

    Rate this question:

  • 19. 

    Let F = {A → B, AB → E, BG → E, CD → I, E → C}. The closures, A+, (AE)+ and (ADE)+ will be

    • A.

      ABCE, ABDE, ABCDI

    • B.

      ABDE, ABCE, ABCDE

    • C.

      ABCE, ABCE, ABCDEI

    • D.

      None of the mentioned

    Correct Answer
    C. ABCE, ABCE, ABCDEI
    Explanation
    The closure of A+ is ABCE, which means that A can produce ABCE. The closure of (AE)+ is ABCE, which means that AE can produce ABCE. The closure of (ADE)+ is ABCDEI, which means that ADE can produce ABCDEI. Therefore, the correct answer is ABCE, ABCE, ABCDEI.

    Rate this question:

  • 20. 

    A functional dependency between two or more non-key attributes is called

    • A.

      Transitive Dependency

    • B.

      Partial transitive dependency

    • C.

      Functional Dependency

    • D.

      Partial Functional Dependency 

    Correct Answer
    A. Transitive Dependency
    Explanation
    A functional dependency between two or more non-key attributes is called a transitive dependency. This means that there is a relationship between these attributes where one attribute determines the value of another attribute, and that attribute in turn determines the value of another attribute. In other words, the dependency "transfers" from one attribute to another through a chain of dependencies.

    Rate this question:

  • 21. 

    A table that displays data redundancies yields  ____________ anomalies

    • A.

      Insertion 

    • B.

      Deletion

    • C.

      Update

    • D.

      All of them

    Correct Answer
    D. All of them
    Explanation
    A table that displays data redundancies can lead to insertion, deletion, and update anomalies. Data redundancies occur when the same data is repeated multiple times in a table, which can result in inconsistencies and errors when inserting, deleting, or updating data. These anomalies can cause data inconsistencies and make it difficult to maintain the integrity and accuracy of the data in the table.

    Rate this question:

  • 22. 

    A type of query that is placed within a WHERE and HAVING clause of another query is called

    • A.

      Super Query

    • B.

      Sub query

    • C.

      Master query

    • D.

      Multi-query

    Correct Answer
    B. Sub query
    Explanation
    A subquery is a type of query that is placed within a WHERE or HAVING clause of another query. It is used to retrieve data from one table based on the result of another query. The subquery is executed first and its result is used by the outer query to perform further operations or filtering. It helps in breaking down complex queries into smaller, more manageable parts and allows for more flexibility in retrieving specific data.

    Rate this question:

  • 23. 

    Which SQL keyword is used to sort the result-set?

    • A.

      SORT

    • B.

      SORT BY

    • C.

      ORDER BY

    • D.

      ORDER

    Correct Answer
    C. ORDER BY
    Explanation
    The SQL keyword "ORDER BY" is used to sort the result-set in ascending or descending order based on one or more columns. It is followed by the column(s) that should be used for sorting.

    Rate this question:

  • 24. 

    Which method of cursor class is used to execute SQL query on database

    • A.

      fetchone()

    • B.

      execute()

    • C.

      scroll()

    • D.

      close()

    Correct Answer
    B. execute()
    Explanation
    The execute() method of the cursor class is used to execute an SQL query on a database. This method allows you to pass an SQL statement as a parameter and execute it. It is commonly used to execute SELECT, INSERT, UPDATE, and DELETE statements.

    Rate this question:

  • 25. 

    Study the code import cx_Oraclecon = cx_Oracle.connect('pythonhol/welcome@localhost/orcl')cur = con.cursor()cur.execute('select * from employee')     Which code snippet will print all the reterived records

    • A.

      for con in cur:     print con

    • B.

      print cur.printall()

    • C.

      for result in cur:    print result

    • D.

      none of the above

    Correct Answer
    C. for result in cur:    print result
    Explanation
    The correct answer is "for result in cur: print result". This code snippet uses a for loop to iterate over the cursor object "cur" and print each result.

    Rate this question:

  • 26. 

    In python , When will the else part of try-except-else be executed?

    • A.

      always

    • B.

      when an exception occurs

    • C.

      when no exception occurs

    • D.

      when an exception occurs in to except block

    Correct Answer
    C. when no exception occurs
    Explanation
    The else part of the try-except-else block in Python will be executed when no exception occurs. This means that if the code inside the try block runs successfully without any errors or exceptions, then the else block will be executed.

    Rate this question:

  • 27. 

    What is the output of the program :  class Account:     def __init__(self, id):         self.id = id         id = 666 acc = Account(123) print(acc.id)

    • A.

      None

    • B.

      123

    • C.

      666

    • D.

      Syntax Error

    Correct Answer
    B. 123
    Explanation
    The program creates a class called Account with an __init__ method that takes an id parameter. Inside the __init__ method, the id attribute of the object is set to the value of the id parameter. Then, a local variable id is created and assigned the value 666, but it does not affect the id attribute of the object. Finally, an instance of the Account class is created with the id parameter set to 123. When the print statement is executed, it prints the value of the id attribute of the acc object, which is 123. Therefore, the output of the program is 123.

    Rate this question:

  • 28. 

    Which Of The Following Statements Is Most Accurate For The Declaration X = Circle()?

    • A.

      x contains an int value.

    • B.

      x contains an object of the Circle type.

    • C.

      x contains a reference to a Circle object.

    • D.

      You can assign an int value to x.

    Correct Answer
    C. x contains a reference to a Circle object.
    Explanation
    The correct answer is "x contains a reference to a Circle object." This is because when we declare X = Circle(), we are creating a new instance of the Circle class and assigning it to the variable X. In this case, X does not contain the actual Circle object itself, but rather a reference to it in memory. This means that X can be used to access and manipulate the properties and methods of the Circle object.

    Rate this question:

  • 29. 

    What is the output of the following piece of code? class A:     def __str__(self):         return '1' class B(A):     def __init__(self):         super().__init__() class C(B):     def __init__(self):         super().__init__() def main():     obj1 = B()     obj2 = A()     obj3 = C()     print(obj1, obj2,obj3) main()

    • A.

      111

    • B.

      123

    • C.

      ‘1’ ‘1’ ‘1’

    • D.

      An exception is thrown

    Correct Answer
    A. 111
    Explanation
    The code defines three classes: A, B, and C. Class A has a __str__ method that returns the string '1'. Class B inherits from A and has an __init__ method that calls the super().__init__() method. Class C inherits from B and also has an __init__ method that calls the super().__init__() method. The main function creates objects of classes B, A, and C. When the objects are printed, the __str__ method of class A is called, which returns '1'. Therefore, the output of the code is '1 1 1'.

    Rate this question:

  • 30. 

    class A():     def disp(self):         print("Text displayed") class B(A):     pass obj = B() obj.disp()

    • A.

      invalid syntax

    • B.

      Text displayed

    • C.

      Error because when object is created, argument must be passed

    • D.

       Nothing is printed

    Correct Answer
    B. Text displayed
    Explanation
    The correct answer is "Text displayed" because the code defines a class A with a method disp that prints "Text displayed". Class B is then created as a subclass of A, inheriting the disp method. An object obj of class B is created and the disp method is called on it, resulting in the text "Text displayed" being printed.

    Rate this question:

  • 31. 

    The error displayed in the code shown below is: import itertools l1=(1, 2, 3) l2=[4, 5, 6] l=itertools.chain(l1, l2) print(next(l1))

    • A.

      ‘list’ object is not iterator  

    • B.

      ‘list’ object is iterator  

    • C.

      ‘tuple’ object is iterator  

    • D.

      ‘tuple’ object is not iterator  

    Correct Answer
    D. ‘tuple’ object is not iterator  
    Explanation
    The error displayed in the code is that the 'tuple' object (l1) is not an iterator. The next() function is used to retrieve the next item from an iterator, but in this case, l1 is a tuple and not an iterator. Therefore, trying to call next(l1) will result in an error.

    Rate this question:

  • 32. 

    What is the output of the following code? class Demo:     def __init__(self):         self.a = 1         self.__b = 1       def display(self):         return self.__b obj = Demo() print(obj.a)

    • A.

      The program has an error because there isn’t any function to return self.a  

    • B.

      The program runs fine and 1 is printed  

    • C.

      The program has an error as you can’t name a class member using __b

    • D.

      The program has an error because b is private and display(self) is returning a private member  

    Correct Answer
    B. The program runs fine and 1 is printed  
    Explanation
    The code defines a class called Demo with an __init__ method that initializes two attributes, a and __b. The class also has a display method that returns the value of __b. An object of the Demo class is created and assigned to the variable obj. The code then prints the value of obj.a, which is 1. Since there are no errors in the code and the value of obj.a is printed correctly, the correct answer is "The program runs fine and 1 is printed."

    Rate this question:

  • 33. 

    Which of these is a private data field? def Demo: def __init__(self):     __a = 1     self.__b = 1     self.__c__ = 1     __d__= 1

    • A.

      __a  

    • B.

      __b  

    • C.

      __c__  

    • D.

      __d__  

    Correct Answer
    B. __b  
    Explanation
    The correct answer is __b. In Python, a private data field is indicated by starting the variable name with two underscores (__). In the given code, __b is a private data field because it starts with two underscores. __a, __c__, and __d__ are not private data fields because they either have only one underscore or have underscores at the end of the variable name.

    Rate this question:

  • 34. 

    What is the output of the following piece of code? class A:     def test(self):         print("test of A called") class B(A):     def test(self):         print("test of B called")         super().test()  class C(A):     def test(self):         print("test of C called")         super().test() class D(B,C):     def test2(self):         print("test of D called")      obj=D() obj.test()

    • A.

      test of B called  test of C called  test of A called  

    • B.

      test of C called  test of B called  

    • C.

      test of B called  test of C called  

    • D.

      Error, all the three classes from which D derives has same method test()  

    Correct Answer
    A. test of B called  test of C called  test of A called  
    Explanation
    The output of the code is "test of B called, test of C called, test of A called". This is because the class D inherits from both class B and class C, and both of these classes have a method named "test". When the method "test" is called on an object of class D, it first looks for the method in class D itself. Since class D does not have a method named "test", it then looks for the method in class B. Class B has a method named "test" which is called first and it prints "test of B called". After that, the method "test" is called on the object of class D again, but this time it looks for the method in class C. Class C has a method named "test" which is called next and it prints "test of C called". Finally, the method "test" is called on the object of class D one more time, but this time it looks for the method in class A. Class A has a method named "test" which is called last and it prints "test of A called".

    Rate this question:

  • 35. 

    What is the output of the following code? class Demo:     def_init_(self):           self.x=1    def change(self):          self.x=10  class Demo_derieved(Demo):         def change (self):         self.x=self.x+1         return self.x def main():         obj = Demo_derieved ()        print (obj.change()) main()  

    • A.

      11

    • B.

      2

    • C.

      1

    • D.

      An exception is thrown

    Correct Answer
    D. An exception is thrown
    Explanation
    The code provided will throw an exception because there is a syntax error in the code. The "__init__" method in the "Demo" class is not properly defined. It should be "__init__" instead of "_init_". Therefore, when the "Demo_derieved" class tries to inherit from the "Demo" class and calls the "change" method, it will throw an exception.

    Rate this question:

  • 36. 

    What is true about indexes?

    • A.

      Indexes enhance the performance even if the table is updated frequently

    • B.

      It makes harder for sql server engines to work to work on index which have large keys

    • C.

      It doesn’t make harder for sql server engines to work to work on index which have large keys

    • D.

      None of the mentioned

    Correct Answer
    B. It makes harder for sql server engines to work to work on index which have large keys
  • 37. 

    Find the name of cities with all entries whose temperature is in the range of 71 and 89

    • A.

      SELECT * FROM weather WHERE temperature NOT IN (71 to 89);

    • B.

      SELECT * FROM weather WHERE temperature NOT IN (71 and 89);

    • C.

      SELECT * FROM weather WHERE temperature NOT BETWEEN 71 to 89;

    • D.

      SELECT * FROM weather WHERE temperature BETWEEN 71 AND 89;

    Correct Answer
    D. SELECT * FROM weather WHERE temperature BETWEEN 71 AND 89;
    Explanation
    The correct answer is "SELECT * FROM weather WHERE temperature BETWEEN 71 AND 89." This query will retrieve all entries from the weather table where the temperature is within the range of 71 and 89. The BETWEEN keyword is used to specify a range, and the AND keyword is used to specify the upper and lower bounds of the range.

    Rate this question:

  • 38. 

    What type of join is needed when you wish to include rows that do not have matching values?

    • A.

      Equi-join

    • B.

      Natural join

    • C.

      Outer join

    • D.

      All of the above

    Correct Answer
    C. Outer join
    Explanation
    An outer join is needed when you wish to include rows that do not have matching values. An outer join returns all the rows from one table and the matching rows from another table, and if there is no match, it will still return the unmatched rows from one table. Equi-join and natural join only return the matching rows, while an outer join includes all rows. Therefore, the correct answer is outer join.

    Rate this question:

  • 39. 

    Which of the following is the correct syntax for creating a VARRAY named grades, which can hold 100 integers, in a PL/SQL block?

    • A.

      TYPE grades IS VARRAY(100) OF INTEGERS;

    • B.

      VARRAY grades IS VARRAY(100) OF INTEGER;

    • C.

      TYPE grades VARRAY(100) OF INTEGER;

    • D.

      TYPE grades IS VARRAY(100) OF INTEGER;

    Correct Answer
    D. TYPE grades IS VARRAY(100) OF INTEGER;
    Explanation
    The correct syntax for creating a VARRAY named grades, which can hold 100 integers, in a PL/SQL block is "TYPE grades IS VARRAY(100) OF INTEGER;".

    Rate this question:

  • 40. 

    In Triggers, action is executed when

    • A.

      event occcur

    • B.

      condition true

    • C.

      event not necessary but condition true

    • D.

      None of the mentioned

    Correct Answer
    A. event occcur
    Explanation
    In triggers, an action is executed when an event occurs. This means that the action is triggered or initiated by the occurrence of a specific event. The condition may also play a role in determining whether the action should be executed or not, but the primary factor is the occurrence of the event.

    Rate this question:

  • 41. 

    A table column that contains values that are primary-key values in another table?

    • A.

      primary key

    • B.

      foreign key

    • C.

      candidate key

    • D.

      all

    Correct Answer
    B. foreign key
    Explanation
    A foreign key is a table column that contains values that are primary-key values in another table. It is used to establish a relationship between two tables in a database. The foreign key in one table refers to the primary key of another table, creating a link between the two tables. This allows for data integrity and helps maintain the referential integrity of the database.

    Rate this question:

  • 42. 

    Advantages of Views are

    • A.

      Security

    • B.

      Query Reusability

    • C.

      Abstraction - Hiding Data

    • D.

      All

    Correct Answer
    D. All
    Explanation
    The advantages of views include security, query reusability, and abstraction - hiding data. Views provide a layer of security by allowing users to access only the data they are authorized to see. They also allow queries to be reused, saving time and effort in writing the same query multiple times. Additionally, views provide abstraction by hiding the underlying data structure, making it easier to work with and understand the data. Therefore, all of these advantages apply to views.

    Rate this question:

  • 43. 

    If a transaction acquires exclusive lock, then it can perform ………. operation.

    • A.

      Read

    • B.

      Write

    • C.

      Read and write

    • D.

      Update

    Correct Answer
    C. Read and write
    Explanation
    If a transaction acquires an exclusive lock, it means that it has exclusive access to the resource and no other transaction can access it. This allows the transaction to both read and write data, as it has full control over the resource. Therefore, the correct answer is "read and write".

    Rate this question:

  • 44. 

    The common column is eliminated in

    • A.

      Theta join

    • B.

      Outer join

    • C.

      Natural join

    • D.

      Composite join

    Correct Answer
    C. Natural join
    Explanation
    In a natural join, the common column(s) between two tables are used to match and combine the rows from both tables. The common column is eliminated in the resulting joined table because it is redundant information. The natural join only includes the columns that are unique to each table, ensuring that there are no duplicate columns in the joined table.

    Rate this question:

  • 45. 

    Which of the following statement on the view concept in SQL is invalid?

    • A.

      All views are not updateable

    • B.

      The views may be referenced in an SQL statement whenever tables are referenced.

    • C.

      The views are instantiated at the time they are referenced and not when they are defined.

    • D.

      The definition of a view should not have GROUP BY clause in it.

    Correct Answer
    D. The definition of a view should not have GROUP BY clause in it.
    Explanation
    The statement "The definition of a view should not have GROUP BY clause in it" is invalid because views can have a GROUP BY clause in their definition. The GROUP BY clause is used to group rows based on a specific column or expression in order to perform aggregate functions on the grouped data. This allows for more complex queries and analysis to be performed on the view.

    Rate this question:

  • 46. 

    If two relations R and S are joined, then the non matching tuples of both R and S are ignored in

    • A.

      left outer join

    • B.

      right outer join

    • C.

      full outer join

    • D.

      inner join

    Correct Answer
    D. inner join
    Explanation
    When performing an inner join between two relations R and S, only the matching tuples from both R and S are included in the result. The non-matching tuples are ignored.

    Rate this question:

  • 47. 

    The statement that is executed automatically by the system as a side effect of the modification of the database is

    • A.

      Backup

    • B.

      Assertion

    • C.

      Recovery

    • D.

      Trigger

    Correct Answer
    D. Trigger
    Explanation
    A trigger is a statement that is automatically executed by the system when a specific event occurs, such as a modification of the database. It is used to enforce certain actions or constraints, and is often used to maintain data integrity or perform additional tasks related to the modification. In this case, the trigger is executed as a side effect of the modification of the database, making it the correct answer.

    Rate this question:

  • 48. 

    If a relation scheme is in BCNF then it is also in

    • A.

      1NF

    • B.

      4NF

    • C.

      3NF

    • D.

      5NF

    Correct Answer
    C. 3NF
    Explanation
    If a relation scheme is in BCNF (Boyce-Codd Normal Form), it means that it satisfies the criteria of BCNF, which includes the absence of any non-trivial functional dependencies where the determinant is not a superkey. This also implies that it satisfies the criteria of 3NF (Third Normal Form), which includes the absence of any transitive dependencies. Therefore, if a relation scheme is in BCNF, it is also in 3NF.

    Rate this question:

  • 49. 

    Which of the following query is correct for using comparison operators in SQL?

    • A.

      SELECT name, course_name FROM student WHERE age>18 and <88;

    • B.

      SELECT name, course_name FROM student WHERE age>50 and age <80;

    • C.

      SELECT name, course_name FROM student WHERE age>50 and WHERE age<80;

    • D.

      None of these

    Correct Answer
    B. SELECT name, course_name FROM student WHERE age>50 and age <80;
    Explanation
    The correct answer is the second option: SELECT name, course_name FROM student WHERE age>50 and age

    Rate this question:

  • 50. 

    Which of the following SQL query is correct for selecting the name of staffs from 'staffinfo' table where salary is 10,000 or 25,000?

    • A.

      SELECT name FROM staffinfo WHERE salary BETWEEN 10000 AND 25000;

    • B.

      SELECT name FROM staffinfo WHERE salary IN (10000, 25000);

    • C.

      Both A and B

    • D.

      None of the above

    Correct Answer
    B. SELECT name FROM staffinfo WHERE salary IN (10000, 25000);
    Explanation
    The correct answer is "SELECT name FROM staffinfo WHERE salary IN (10000, 25000)". This query selects the name of staffs from the 'staffinfo' table where the salary is either 10,000 or 25,000. The IN operator is used to specify multiple values for a column, and in this case, it is used to check if the salary is either 10,000 or 25,000.

    Rate this question:

Related Topics

Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.