Python Quizz
Python Quizz
Python:
o Question: What is the difference between a list and a tuple in Python?
A) Lists are mutable, while tuples are immutable.
B) Tuples are ordered, while lists are not.
C) Lists can contain elements of different data types, while tuples
cannot.
D) Tuples can be resized, while lists cannot.
Answer: A) Lists are mutable, while tuples are immutable.
2. Python:
o Question: How do you open a file in Python for reading?
A) file = open("myfile.txt", "w")
B) file = open("myfile.txt", "r")
C) file = open("myfile.txt", "a")
D) file = open("myfile.txt", "x")
Answer: B) file = open("myfile.txt", "r")
3. SQL:
o Question: What is the purpose of the GROUP BY clause in SQL?
A) To sort the result set in ascending order.
B) To filter rows based on a condition.
C) To group rows with similar values into summary rows.
D) To join two or more tables.
Answer: C) To group rows with similar values into summary rows.
4. Python:
o Question: How do you remove an element from a list in Python?
A) list.remove(item)
B) list.pop(index)
C) del list[index]
D) All of the above
Answer: D) All of the above
5. SQL:
o Question: What is the difference between INNER JOIN and LEFT JOIN?
A) INNER JOIN returns all rows from both tables, while LEFT JOIN
returns only matching rows.
B) INNER JOIN returns only matching rows, while LEFT JOIN
returns all rows from both tables.
C) INNER JOIN is used for self-joins, while LEFT JOIN is used for
joining different tables.
D) There is no difference; they are interchangeable.
Answer: A) INNER JOIN returns all rows from both tables, while
LEFT JOIN returns only matching rows.
6. SQL:
o Question: What is a subquery in SQL?
A) A query that runs in parallel with the main query.
B) A query that returns a single value.
C) A query nested inside another query.
D) A query that joins multiple tables.
Answer: C) A query nested inside another query.
7. Python:
o Question: How do you reverse a list in Python?
A) list.reverse()
B) reversed(list)
C) list[::-1]
D) All of the above
Answer: D) All of the above
Certainly! Here are 10 more intermediate-level interview questions related to Python and
SQL, along with 4 multiple-choice options for each question:
8.Python:
7. SQL:
o Question: What is the purpose of the LIKE operator in SQL?
A) To perform arithmetic operations.
B) To filter rows based on exact matches.
C) To search for patterns in string columns.
D) To join tables.
Answer: C) To search for patterns in string columns.
8. Python:
o Question: What is the use of a service account?
A) used to run individual jobs
B) used to run all application jobs
C) used to kill any individual jobs
D) All the above
Answer: A) string.lower()