Python Programming
Python fundamentals to advanced for interviews
38 Questions 10 Topics Take Test
Advertisement
Showing 21–30 of 38 questions
Q.21 Easy Basics & Syntax
What will be the output of: print(type(3.14))
A
B
C
D
Correct Answer:  B.
EXPLANATION

3.14 is a floating-point number, so type() returns <class 'float'>.

Take Test
Q.22 Easy Basics & Syntax
What does len() function return when applied to a string?
A The ASCII value of first character
B The number of characters in the string
C The memory size of the string
D The index of last character
Correct Answer:  B. The number of characters in the string
EXPLANATION

The len() function returns the number of characters (length) in a string.

Take Test
Q.23 Easy Basics & Syntax
What will be the output of: x = 5; y = 10; print(x == y)
A True
B False
C Error
D None
Correct Answer:  B. False
EXPLANATION

The comparison operator == checks if x equals y. Since 5 ≠ 10, the result is False.

Take Test
Q.24 Easy Basics & Syntax
Which of the following statements about Python tuples is correct?
A Tuples are mutable and can be modified after creation
B Tuples are immutable and cannot be modified after creation
C Tuples use square brackets for declaration
D Tuples automatically convert to lists when assigned
Correct Answer:  B. Tuples are immutable and cannot be modified after creation
EXPLANATION

Tuples are immutable sequences in Python, meaning their contents cannot be changed once created.

Take Test
Q.25 Easy Basics & Syntax
What is the correct way to create a dictionary in Python?
A d = {1: 'a', 2: 'b'}
B d = [1: 'a', 2: 'b']
C d = (1: 'a', 2: 'b')
D d = {1; 'a'; 2; 'b'}
Correct Answer:  A. d = {1: 'a', 2: 'b'}
EXPLANATION

Dictionaries in Python use curly braces with key-value pairs separated by colons.

Take Test
Advertisement
Q.26 Easy Basics & Syntax
Which of the following will correctly concatenate two strings 'Hello' and 'World'?
A 'Hello' + 'World'
B 'Hello' - 'World'
C 'Hello' & 'World'
D 'Hello' | 'World'
Correct Answer:  A. 'Hello' + 'World'
EXPLANATION

The + operator concatenates strings in Python. Other operators don't perform string concatenation.

Take Test
Q.27 Easy Basics & Syntax
What will be the output of: len('hello world')?
A 10
B 11
C 12
D 5
Correct Answer:  B. 11
EXPLANATION

The len() function counts all characters including the space. 'hello world' has 11 characters (including 1 space).

Take Test
Q.28 Easy Basics & Syntax
Which of the following is an immutable data type in Python?
A list
B dictionary
C tuple
D set
Correct Answer:  C. tuple
EXPLANATION

Tuples are immutable, meaning their elements cannot be changed after creation. Lists, dictionaries, and sets are mutable.

Take Test
Q.29 Easy Basics & Syntax
What is the output of: print(10 // 3)?
A 3
B 3.33
C 4
D 3.0
Correct Answer:  A. 3
EXPLANATION

The floor division operator (//) returns the quotient rounded down to the nearest integer. 10 // 3 = 3.

Take Test
Q.30 Easy Basics & Syntax
What will be the output of: print("Python"[2:5])?
A Pyt
B yth
C tho
D hon
Correct Answer:  B. yth
EXPLANATION

String slicing [2:5] extracts characters from index 2 to 4 (5 is exclusive). 'Python'[2:5] = 'yth'.

Take Test
IGET
iget AI
Online · Ask anything about exams
Hi! 👋 I'm your iget AI assistant.

Ask me anything about exam prep, MCQ solutions, study tips, or strategies! 🎯
UPSC strategy SSC CGL syllabus Improve aptitude NEET Biology tips