Infosys Campus Connect - Non - IT Branches (Batch 1) Quiz

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Infycc
I
Infycc
Community Contributor
Quizzes Created: 2 | Total Attempts: 541
| Attempts: 152 | Questions: 50
Please wait...
Question 1 / 50
0 %
0/100
Score 0/100
1. To connect oracle database which module is required to be included in python

Explanation

The correct answer is cx_Oracle. This module is required to be included in Python in order to connect to an Oracle database. cx_Oracle is a Python extension module that enables access to Oracle Database. It provides a high-performance, reliable, and easy-to-use interface for connecting to and interacting with Oracle databases using Python.

Submit
Please wait...
About This Quiz
Infosys Campus Connect -  Non - IT Branches (Batch 1) Quiz - Quiz

This quiz is for Batch 1( NON IT batch) and contains 50 MCQ questions. All the best :)

2. For i in  range(2):     print (i)   for i in range(4,6):     print (i)

Explanation

The given code consists of two for loops. The first loop iterates over the range from 0 to 1 (exclusive), so it prints 0 and 1. The second loop iterates over the range from 4 to 6 (exclusive), so it prints 4 and 5. Therefore, the output of the code is 0 1 4 5.

Submit
3. Can private variables be accesses outside the class

Explanation

Private variables cannot be accessed outside the class. They are only accessible within the class in which they are declared. Private variables are used to encapsulate data and ensure data integrity by preventing direct access from outside the class. This helps in maintaining the security and integrity of the data.

Submit
4. List1 = ['physics', 'chemistry', 1997, 2000]   list2 = [1, 2, 3, 4, 5, 6, 7]   print ("list1[0]: ", list1[0])              #statement 1 print ("list1[0]: ", list1[-2])            #statement 2 print ("list1[-2]: ", list1[1:])           #statement 3 print ("list2[1:5]: ", list2[1:5])  #statement 4

Explanation

The correct answer is list1[0]: physics, list1[0]: 1997, list1[-2]: ['chemistry', 1997, 2000], list2[1:5]: [2, 3, 4, 5]. This is because in statement 1, list1[0] returns the first element of list1 which is 'physics'. In statement 2, list1[-2] returns the second last element of list1 which is 1997. In statement 3, list1[1:] returns a sublist of list1 starting from the second element to the end, which is ['chemistry', 1997, 2000]. In statement 4, list2[1:5] returns a sublist of list2 from the second element to the fifth element, which is [2, 3, 4, 5].

Submit
5. List1 = [1998, 2002, 1997, 2000] list2 = [2014, 2016, 1996, 2009]   print ("list1 + list 2 = : ", list1 + list2)   #statement 1   print ("list1 * 2 = : ", list1 * 2 ) #statement 2

Explanation

The given code demonstrates the concatenation and repetition operations on lists. In statement 1, the '+' operator is used to concatenate list1 and list2, resulting in a new list that contains all the elements from both lists. In statement 2, the '*' operator is used to repeat list1 twice, resulting in a new list that contains the elements of list1 repeated twice.

Submit
6. The HAVING clause does which of the following?

Explanation

The HAVING clause is used to filter the results of a GROUP BY query based on a condition applied to the groups, rather than individual rows. It is similar to the WHERE clause, but while the WHERE clause filters rows, the HAVING clause filters groups. It allows you to specify conditions that must be met by the groups in order for them to be included in the result set.

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

Explanation

The execute() method of the cursor class is used to execute SQL queries on a database. This method allows the user to pass SQL statements as arguments and execute them against the database. It is commonly used for executing SELECT, INSERT, UPDATE, and DELETE queries. This method returns the result of the query execution, which can then be fetched using other methods like fetchone() or fetchall(). The close() method is used to close the cursor and release any resources associated with it, while the scroll() method is used to scroll through the result set.

Submit
8. If (7 < 0) and (0 < -7):     print("Hello") elif (7 > 0) or False:     print("Welcome") else:     print("Infosys")

Explanation

The correct answer is "Welcome" because the condition (7 > 0) evaluates to True and the condition False evaluates to False. Since the condition after "or" is False, the second branch of the if statement is executed and "Welcome" is printed.

Submit
9. List = [1, 2, 3, None, (1, 2, 3, 4, 5), ['Geeks', 'for', 'Geeks']] print len(list)

Explanation

The correct answer is 6. The len() function is used to find the length of a list. In this case, the list has 6 elements, so the length of the list is 6.

Submit
10. A = {i: i * i for i in range(6)} print (a)

Explanation

The given code is an example of dictionary comprehension in Python. It creates a dictionary where the keys are the numbers from 0 to 5 and the values are the square of each number. The output of the code is the dictionary {0: 0, 1: 1, 2: 4, 3: 9, 4: 16, 5: 25}.

Submit
11. Super is used to

Explanation

The keyword "super" is used in object-oriented programming languages to access the members (methods, variables) of the base class from within the derived class. It allows the derived class to inherit and utilize the functionalities and data defined in the base class. So, the correct answer is "Access Base class members".

Submit
12. A = True b = False c = False   if not a or b:     print (1) elif not a or not b and c:     print (2) elif not a or b or not b and a:     print (3) else:     print (4)

Explanation

The correct answer is 3 because the condition in the elif statement is true. The condition "not a or b or not b and a" evaluates to true because the first part "not a" is true, the second part "b" is true, and the third part "not b and a" is also true. Therefore, the code will execute the print statement for the third condition, which is "print (3)".

Submit
13. Class A():        def __init__(self):                 self.__x = 1        def m1(self):                 print("m1 from A")  class B(A):         def __init__(self):                   self.__y = 1             def m1(self):                print("m1 from B")                super().m1()   c = B() c.m1()

Explanation

The correct answer is "m1 from B followed by m1 from A". This is because when the method m1 is called on object c, it first looks for the method in class B. Since class B has a method m1, it is executed and "m1 from B" is printed. However, after executing the method in class B, the super() function is called, which allows the method to be inherited from the parent class A. This means that the method m1 from class A is also executed and "m1 from A" is printed. Therefore, the output is "m1 from B followed by m1 from A".

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

Explanation

An outer join is needed when you wish to include rows that do not have matching values. In an outer join, all rows from one table are included in the result set, even if there is no matching value in the other table. This allows you to retrieve data from one table even if there are no corresponding records in the other table.

Submit
15. I = 0 while i < 3:     print(i)     i += 1 else:     print(0)

Explanation

The given code snippet is a while loop that starts with i = 0 and continues until i is less than 3. Inside the loop, it prints the value of i and then increments i by 1. After the loop finishes, it executes the else block, which in this case, prints 0. So, the output of this code will be 0 1 2 0.

Submit
16. Which of the following group functions ignore NULL values?

Explanation

All of the group functions mentioned in the options (Max, Min, and Sum) ignore NULL values. When these functions are used to calculate a result from a group of values, any NULL values within the group are automatically excluded from the calculation. Therefore, all of these functions will only consider non-NULL values and provide the desired result.

Submit
17. Which of the following statements contains an error?

Explanation

The statement "SELECT empid WHERE empid = 56949 AND lastname = 'SMITH';" contains an error. The correct syntax for a SELECT statement is "SELECT column_name FROM table_name WHERE condition;" In this statement, the column_name is missing, so it should be "SELECT empid FROM ..." instead.

Submit
18. Which of the following is not a super key in relational schema with attributes V, W, X, Y, Z and primary key VY?

Explanation

A super key is a set of attributes that can uniquely identify each tuple in a relation. In this case, the primary key is VY, which means that V and Y together uniquely identify each tuple. So, any super key that does not contain V or Y as attributes would not be able to uniquely identify each tuple. The super key V WXZ does not contain either V or Y, so it is not a super key in this relational schema.

Submit
19. Class methods need cls as the first argument

Explanation

In Python, class methods are defined using the @classmethod decorator and they require the cls parameter as the first argument. This parameter refers to the class itself and allows access to class-level variables and methods. By convention, the first parameter of a class method is named cls, although any valid variable name can be used. Therefore, the statement "Class methods need cls as the first argument" is true.

Submit
20. Which one is not applicable while querying on a view?

Explanation

When querying on a view, the "Order by" clause is not applicable. This clause is used to sort the result set in ascending or descending order based on one or more columns. However, when querying on a view, the view itself does not store any data, it is just a virtual table that is created by a query. Therefore, there is no need to sort the result set of a view since the underlying tables are already sorted or can be sorted using the "Order by" clause when creating the view.

Submit
21. If in JOIN operation, conditions of JOIN operation are not satisfied then results of operation is

Explanation

If the conditions of a JOIN operation are not satisfied, it means that there are no matching tuples between the two relations being joined. As a result, the operation will produce zero tuples and an empty relation. This means that there will be no output from the JOIN operation, as there are no common values or matching criteria between the two relations.

Submit
22. Data = 50 try:     data = data/0 except ZeroDivisionError:     print('Cannot divide by 0 ', end = '') else:     print('Division successful ', end = '')   try:     data = data/5 except:     print('Inside except block ', end = '') else:     print('Hello', end = '')

Explanation

The code first tries to divide the variable "data" by 0, which raises a ZeroDivisionError. The except block is then executed, which prints "Cannot divide by 0". However, since there is no error in the second try-except block, the else block is executed, which prints "Hello". Therefore, the output is "Cannot divide by 0 Hello".

Submit
23. What is the output of the following snippet of code                 class abc:                                  count=2                                  def __init__(self):                                                    pass                                  def xyz():                                                  print(abc.count)                 a=abc;                 a.xyz()                 abc.count=4                 a.xyz()

Explanation

The output of the code snippet is "2 4" because the variable "count" is a class variable with a value of 2. When the method "xyz()" is called, it prints the value of "count" which is 2. Then, the value of "count" is changed to 4. When "xyz()" is called again, it prints the updated value of "count" which is 4.

Submit
24. What is the relationship between car and   class Maruti   class Engine

Explanation

The relationship between car and class Maruti is that car HAS-A class Maruti. This means that a car can have a class Maruti, indicating that it belongs to the Maruti brand. On the other hand, the relationship between car and class Engine is that car IS-A class Engine. This means that a car is a type of class Engine, suggesting that the car itself is an engine.

Submit
25. What is the output of the following snippet of code                 class A:                                  count=2                                  def abc():                                                   pass                 class B(A):                                  def abc():                                                 print(super.count)                 x=B                 x.abc()

Explanation

The code snippet defines two classes, A and B. Class A has a class variable "count" with a value of 2 and a method "abc()" which does nothing. Class B is a subclass of A and overrides the "abc()" method. In the "abc()" method of class B, it tries to print the value of "super.count". However, since the "count" attribute is not defined in the superclass A, it raises an error stating that "Super has no attribute count". Therefore, the output of the code is "Error: Super has no attribute count".

Submit
26. Which of the following is the use of id() function in python?

Explanation

The id() function in Python is used to return the memory location of an object. It is a unique identifier assigned to each object in memory. This can be useful in certain situations, such as when comparing two objects to check if they refer to the same memory location. The id() function does not return the class of the object or the type of the object, so these options are incorrect. Therefore, the correct answer is that the id() function returns the memory location of the object.

Submit
27. A table on the many side of a one to many or many to many relationship must:

Explanation

In a one to many or many to many relationship, a table on the many side must have a composite key. This means that the table's primary key is made up of multiple attributes, rather than just a single attribute. A composite key is necessary in order to uniquely identify each record in the table, as a single attribute may not be sufficient. By using multiple attributes as the key, it ensures that each combination of values is unique and can be used to establish relationships with the corresponding records in the other table(s) involved in the relationship.

Submit
28. Using the ______ clause retains only one copy of such identical tuples.

Explanation

The DISTINCT clause is used to eliminate duplicate rows from the result set of a SELECT statement. It retains only one copy of identical tuples, ensuring that each tuple appears only once in the output. Therefore, the correct answer is "Distinct".

Submit
29. I = 1 while True:     if i % 3 == 0:         break     print(i)     i + = 1

Explanation

The given code will result in a syntax error. The error occurs on the line "i + = 1" because there shouldn't be a space between the "+" and the "=" sign in the compound assignment operator "+=". The correct syntax should be "i += 1" without any spaces.

Submit
30. What is the output of the following? a = 4.5 b = 2 print (a//b)  

Explanation

The output of the given code is 2.0. In Python, the double slash (//) operator is used for floor division, which returns the largest integer that is less than or equal to the result of the division. In this case, 4.5 divided by 2 is equal to 2.25, and the largest integer less than or equal to 2.25 is 2.0. Therefore, the output is 2.0.

Submit
31. Rollback segments are used for

Explanation

Rollback segments are used to undo changes when a transaction is rolled back. When a transaction is rolled back, the changes made by that transaction need to be reversed in order to maintain data consistency. Rollback segments store the before-images of the modified data, allowing the system to revert the changes made by the transaction. Therefore, the correct answer is that rollback segments are used to undo changes when a transaction is rolled back.

Submit
32. Which of the following scenarios may lead to an irrecoverable error in a database system?

Explanation

If a transaction reads a data item after it is written by an uncommitted transaction, it may lead to an irrecoverable error in a database system. This is because the uncommitted transaction's changes are not yet finalized and may be rolled back. If the second transaction reads the data item before the first transaction is committed or rolled back, it may retrieve inconsistent or incorrect data. This can result in data integrity issues and make it difficult to maintain the consistency and reliability of the database system.

Submit
33. Line =  "What will have so will" L = line.split('a') for i in L:      print(i, end=' ')  

Explanation

The given code splits the string "line" using the character 'a' as the delimiter and stores the resulting substrings in a list called L. Then, it iterates over each element in L and prints it followed by a space. The output of the code is "Wh t will h ve so will". The correct answer, "Wh t will h ve so will", matches the output of the code.

Submit
34. List1 = [1, 2, 3, 4, 5] list2 = list1   list2[0] = 0;   print ("list1= : ", list1)  #statement 2

Explanation

The correct answer is "list1= : [0, 2, 3, 4, 5]". When we assign list2 = list1, it means that both variables are referring to the same list object in memory. Therefore, when we modify list2 by changing the value at index 0 to 0, it also affects list1 because they are both pointing to the same list. Thus, the value at index 0 in list1 is also changed to 0.

Submit
35. Suppose you need to print pi constant defined in math module. Which of the following code can do this task?

Explanation

The correct answer is "from math import pi
print(math.pi)". This code imports the pi constant from the math module and then prints the value of pi using the "math.pi" syntax.

Submit
36. ON UPDATE CASCADE ensures which of the following

Explanation

ON UPDATE CASCADE ensures data integrity. When a row in the referenced table is updated, the update is automatically propagated to the referencing table, ensuring that the foreign key relationship is maintained. This prevents any inconsistencies or orphaned records in the database, maintaining the integrity of the data.

Submit
37.
  1. Empid
  2. Name
  3. Age
  4. Mobile
  1. Multivalued
  2. Derived
  3. Composite
  4. Simple

Explanation

not-available-via-ai

Submit
38. Def greetPerson(*name):      print('Hello', name)   greetPerson('Frodo', 'Sauron')

Explanation

The correct answer is "Hello('Frodo','Sauron')". This is because the code defines a function called greetPerson that takes in any number of arguments and prints "Hello" followed by the names. When the function is called with the arguments 'Frodo' and 'Sauron', it will print "Hello Frodo Sauron".

Submit
39. What is the output                 class A:                              z=3                                 def __init__(self):                                                 self.x = 1                                                 self.y = 1                                                 A.z=4                                 def getY(self):                                                  return self.y                a = A()              a.y = 45               print(a.getY())               print(a.z)

Explanation

The code will produce an error because the attribute "y" is not defined in the class A. Although the variable "a" is created as an instance of class A and the attribute "y" is assigned a value of 45, the method getY() is trying to access a non-existent attribute. Therefore, an error will occur when trying to print(a.getY()). The attribute "z" is defined in the class A and is also assigned a value of 4, so the code will print 4 when trying to print(a.z).

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

Explanation

The correct answer is "for result in cur: print result". This code snippet will iterate over the cursor object "cur" and print each retrieved record.

Submit
41. Connect() method takes what as argument

Explanation

The connect() method in this context requires three arguments: username, password, and Connection String. These arguments are necessary to establish a connection to a database or a server. Without providing all three arguments, the connect() method will not be able to establish a successful connection.

Submit
42. A = "hello and welcome to python "   b = 13   print (a + b)

Explanation

The code will result in a TypeError because we cannot concatenate a string and an integer using the "+" operator. The correct answer is None of the above.

Submit
43. Which are the join types in join condition:

Explanation

The correct answer is Cross join. A cross join, also known as a Cartesian join, returns the Cartesian product of the two tables being joined. It combines each row from the first table with every row from the second table, resulting in a potentially large number of rows in the output. This type of join does not require any specific join condition and is used when all possible combinations of rows from both tables are needed.

Submit
44. Which one is correct?

Explanation

not-available-via-ai

Submit
45. List = ['a', 'b', 'c', 'd', 'e'] print list[10:]

Explanation

The code tries to access elements in the list starting from index 10 to the end. However, since the list only has 5 elements, there are no elements from index 10 onwards. Therefore, an empty list is returned as the output.

Submit
46. AN SQL view is said to be updatable, if clause contains only attribute names of relation i.e.

Explanation

The correct answer is the Where Clause. In an SQL view, the Where Clause is used to specify conditions that filter the rows returned by the view. It allows for the selection of specific rows based on certain criteria. By using attribute names in the Where Clause, the view can be updated because it identifies the specific rows that need to be modified. The other clauses listed (Define, Having, and Select) do not affect the updatable nature of the view.

Submit
47. My_string = 'welcometocampusconnect' for i in range(len(my_string)):     print (my_string)     my_string = 'a'

Explanation

The code starts by initializing the variable "my_string" with the value "welcometocampusconnect". Then, it enters a for loop that iterates over the range of the length of "my_string".

Inside the loop, it first prints the value of "my_string", which is "welcometocampusconnect" in the first iteration.

Then, it assigns the value "a" to "my_string". This means that in the next iteration of the loop, "my_string" will have the value "a".

The loop continues until it reaches the end of the range, printing "welcometocampusconnect" followed by "a" on each iteration.

Submit
48. X = ['ab', 'cd'] for i in x:     i.upper() print (x)

Explanation

The given code assigns a list of strings, ['ab', 'cd'], to the variable x. Then, it iterates through each element in x using a for loop. Inside the loop, the upper() method is called on each element, which converts the string to uppercase. However, the updated strings are not stored or assigned to any variable. Finally, the original list, x, is printed. Since no changes were made to the original list, the output is still ['ab', 'cd'].

Submit
49. Class ParentClass:                                 def __init__(self):                                                   self.x = 1                                                   self.y = 10                                   def print(self):                                                   print(self.x, self.y) class ChildClass(ParentClass):                                 def __init__(self):                                                  super().__init__()                                                 self.x = 2                                                 self.y = 20  c = ChildClass()  c.print()

Explanation

The correct answer is 1 20 because when the ChildClass object c is created, the __init__ method of the ParentClass is called using the super() function. This initializes the values of x and y in the ParentClass to 1 and 10 respectively. Then, the __init__ method of the ChildClass is called, which reassigns the value of x to 2 and y to 20. When the print method is called on the ChildClass object c, it prints the values of x and y, which are 1 and 20 respectively.

Submit
50. Find the Salary in increasing order of all employees

Explanation

The correct answer is "SELECT ENAME, SALARY FROM EMP ORDER BY ENAME". This query will retrieve the names and salaries of all employees from the EMP table and sort them in increasing order based on the employee names.

Submit
View My Results

Quiz Review Timeline (Updated): Jan 31, 2023 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Jan 31, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Dec 07, 2018
    Quiz Created by
    Infycc
Cancel
  • All
    All (50)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
To connect oracle database which module is required to be included in...
For i in  range(2): ...
Can private variables be accesses outside the class
List1 = ['physics', 'chemistry', 1997, 2000] ...
List1 = [1998, 2002, 1997, 2000] ...
The HAVING clause does which of the following?
Which method of cursor class is used to execute SQL query on database
If (7 < 0) and (0 < -7): ...
List = [1, 2, 3, None, (1, 2, 3, 4, 5), ['Geeks',...
A = {i: i * i for i in range(6)} print (a)
Super is used to
A = True...
Class A(): ...
What type of join is needed when you wish to include rows that do not...
I = 0 ...
Which of the following group functions ignore NULL values?
Which of the following statements contains an error?
Which of the following is not a super key in relational schema with...
Class methods need cls as the first argument
Which one is not applicable while querying on a view?
If in JOIN operation, conditions of JOIN operation are not satisfied...
Data = 50 ...
What is the output of the following snippet of code ...
What is the relationship between car and ...
What is the output of the following snippet of code ...
Which of the following is the use of id() function in python?
A table on the many side of a one to many or many to many relationship...
Using the ______ clause retains only one copy of such identical...
I = 1 ...
What is the output of the following? ...
Rollback segments are used for
Which of the following scenarios may lead to an irrecoverable error in...
Line =  "What will have so will" ...
List1 = [1, 2, 3, 4, 5] ...
Suppose you need to print pi constant defined in math module. Which of...
ON UPDATE CASCADE ensures which of the following
Empid ...
Def greetPerson(*name): ...
What is the output ...
"Study the code ...
Connect() method takes what as argument
A = "hello and welcome to python " ...
Which are the join types in join condition:
Which one is correct?
List = ['a', 'b', 'c', 'd',...
AN SQL view is said to be updatable, if clause contains only attribute...
My_string = 'welcometocampusconnect' ...
X = ['ab', 'cd'] ...
Class ParentClass: ...
Find the Salary in increasing order of all employees
Alert!

Advertisement