Q.
Which of the following is an immutable data type in Python?
Tuple
Set
List
Dictionary
Show Explanation
Explanation:
Tuples are immutable, while lists, sets, and dictionaries are mutable.
Q.
Which of the following is the correct way to assign a value to a variable in Python?
int x = 10;
10 -> x
x = 10
Show Explanation
Explanation:
The correct option is: Option A
Q.
Which of the following is the correct way to print "Hello World" in Python 3?
echo "Hello World"
print("Hello World")
print "Hello World"
Show Explanation
Explanation:
The correct option is: Option C
Q.
What is the data type of the value True in Python?
Show Explanation
Explanation:
The correct option is: Option B
Q.
If mylist = [10,20,30], what is mylist[1]?
Show Explanation
Explanation:
The correct option is: Option A
Q.
Which operator is used to concatenate strings in Python?
Show Explanation
Explanation:
The correct option is: Option C
Q.
Which symbol is used to begin a comment in Python?
Show Explanation
Explanation:
The correct option is: Option B
Q.
Which keyword is used to define a function in Python?
Show Explanation
Explanation:
The correct option is: Option A
Q.
In Python, indentation is used for:
Comments
Variable declaration
Defining code blocks
Show Explanation
Explanation:
The correct option is: Option C
Q.
What is the result of 7 // 2 in Python?
Show Explanation
Explanation:
The correct option is: Option A
Q.
Which of the following is a boolean operator in Python?
Show Explanation
Explanation:
The correct option is: Option B
Q.
Which keyword is used to start a loop that iterates over a sequence in Python?
Show Explanation
Explanation:
The correct option is: Option A
Q.
Which keyword is used to start a loop that continues as long as a condition is true in Python?
Show Explanation
Explanation:
The correct option is: Option B
Q.
Which keyword is used to exit a loop prematurely in Python?
Show Explanation
Explanation:
The correct option is: Option C
Q.
Which keyword is used to skip the current iteration of a loop and continue with the next?
Show Explanation
Explanation:
The correct option is: Option B
Q.
Which of the following is the correct way to define a dictionary in Python?
mydict = ["a":1, "b":2]
mydict = {"a":1, "b":2}
mydict = ("a":1, "b":2)
Show Explanation
Explanation:
The correct option is: Option A
Q.
Which of the following creates a set in Python?
s = set([1,2,3])
s = {}
s = []
Show Explanation
Explanation:
The correct option is: Option C
Q.
Which function is used to take input from the user in Python?
Show Explanation
Explanation:
The correct option is: Option A
Q.
Which of the following converts a string to an integer in Python?
Show Explanation
Explanation:
The correct option is: Option B
Q.
Which function returns the number of items in a list in Python?
Show Explanation
Explanation:
The correct option is: Option C
Q.
Which keyword is used for exception handling in Python?
Show Explanation
Explanation:
The correct option is: Option A