Courses
Tutorials
Jobs
Practice
Contests
Data Structure
Java
Python
HTML
Interview Preparation
Trending Now
DSA
Web Tech
Foundational Courses
Data Science
Practice Problem
Python
Machine Learning
JavaScript
System Design
Django
DevOps Tutorial
Java
C
C++
ReactJS
NodeJS
CP Live
Aptitude
Puzzles
Projects
Conditionals | and Flow Control | Question 2
Q2-What is the purpose of the elif keyword in a Python if-elif-else statement? (A)A. It is short for "else if" and is used to check multiple conditi...
Read More
Getting | started with python | Question 8
Q8-What does the strip() method do when applied to a Python string? (A)A. Removes leading and trailing whitespaces(B)B. Converts the string to upper...
Read More
Exceptions | Question 9
Q9-try: num = int("abc")except ValueError as e: print(f"Error: {e}")What is the output of this code? (A)A) "Error: invalid literal for int() with ...
Read More
Exceptions | Question 8
Q8-try: result = 10 / 0except ZeroDivisionError: print("Cannot divide by zero!")What will be printed to the console if this code is executed? (A)A...
Read More
Exceptions | Question 6
Q6-Which keyword is used to handle exceptions in Python? (A)A) catch(B)B) try(C)C) except(D)D) handle Answer: (B) (C) ...
Read More
Exceptions | Question 5
Q5-numbers = [1, 2, 3, 4, 5]average = sum(numbers) / len(numbers)What type of error might occur in the above code? (A)A) SyntaxError(B)B) NameError(...
Read More
Exceptions | Question 3
Q3-number = input("Enter a number: ")result = number + 10What type of error is likely to occur in the above code? (A)A) SyntaxError(B)B) NameError(C...
Read More
Special | functions Python | Question 9
Q9-text = "Python"ascii_values = [ord(char) for char in text]What is the value of ascii_values after executing the code? (A)A) [80, 121, 116, 104, 1...
Read More
Special | functions Python | Question 7
Q7-char = 'A'ascii_value = ord(char)What is the value of ascii_value after executing the code? (A)A) 65(B)B) 66(C)C) 67(D)D) 68 Answer: (A) ...
Read More
Special | functions Python | Question 6
Q6-What does the ord function in Python do? (A)A) Rounds a floating-point number to the nearest integer(B)B) Returns the Unicode code point of a cha...
Read More
Special | functions Python | Question 4
Q4-numbers = [1, 2, 3, 4, 5]squared_odd = list(map(lambda x: x**2, filter(lambda x: x % 2 != 0, numbers)))What does the squared_odd list contain after executin...
Read More
Special | functions Python | Question 3
Q3-nums1 = [1, 2, 3]nums2 = [4, 5, 6]result = list(zip(nums1, nums2))What is the value of result after executing the code? (A)A) [(1, 4), (2, 5), (3...
Read More
Special | functions Python | Question 1
Q1-numbers = [1, 2, 3, 4, 5]squares = list(map(lambda x: x**2, numbers))What does the squares list contain after executing the code? (A)A) [1, 2, 3,...
Read More
Functions | and oops | Question 8
Q8-import datetimecurrent_time = datetime.datetime.now()What is current_time in the above code? (A)A) A string containing the current date and time(...
Read More
Functions | and oops | Question 5
Q5-class Car: def __init__(self, make, model): self.make = make self.model = modelcar1 = Car("Toyota", "Camry")What is car1 in the above code? (...
Read More
1
...
1917
1918
1919
...
11500