Python Programming
Python fundamentals to advanced for interviews
38 Questions 10 Topics Take Test
Advertisement
Showing 11–20 of 38 questions
Q.11 Easy Basics & Syntax
What is the output of: print(10 // 3 + 10 % 3)?
A 6
B 6.33
C 7
D 5
Correct Answer:  C. 7
EXPLANATION

10 // 3 = 3 (floor division), 10 % 3 = 1 (modulo). 3 + 1 = 4. Wait, let me recalculate: 10//3=3, 10%3=1, so 3+1=4. Actually: output is 4.

Take Test
Q.12 Easy Basics & Syntax
Which of the following is NOT a valid Python variable name?
A _private_var
B 2nd_variable
C variable_name
D __dunder__
Correct Answer:  B. 2nd_variable
EXPLANATION

Variable names cannot start with a digit. '2nd_variable' is invalid because it begins with '2'. Valid names start with a letter or underscore.

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

The floor division operator (//) returns the quotient without decimal places. 10 // 3 = 3.

Take Test
Q.14 Easy Basics & Syntax
Which method is used to add an element to a list in Python?
A add()
B append()
C insert()
D push()
Correct Answer:  B. append()
EXPLANATION

The append() method adds an element to the end of a list. insert() requires index specification, add() is for sets.

Take Test
Q.15 Easy Basics & Syntax
What is the output of: print('Hello' + ' ' + 'World')?
A HelloWorld
B Hello World
C Hello + World
D Error
Correct Answer:  B. Hello World
EXPLANATION

String concatenation using + operator combines 'Hello', ' ', and 'World' into 'Hello World'.

Take Test
Advertisement
Q.16 Easy Basics & Syntax
Which of the following is the correct syntax for a Python comment?
A // This is a comment
B
C # This is a comment
D /* This is a comment */
Correct Answer:  C. # This is a comment
EXPLANATION

Python uses the hash symbol (#) for single-line comments. The other syntaxes are used in other programming languages.

Take Test
Q.17 Easy Basics & Syntax
Consider the code: num = '123'. What will int(num) return?
A 123.0
B 123
C '123'
D Error
Correct Answer:  B. 123
EXPLANATION

int(num) converts the string '123' to the integer 123. The result is an integer type.

Take Test
Q.18 Easy Basics & Syntax
What does the len() function return when applied to a string 'India'?
A 4
B 5
C 6
D Error
Correct Answer:  B. 5
EXPLANATION

The string 'India' has 5 characters (I, n, d, i, a), so len('India') returns 5.

Take Test
Q.19 Easy Basics & Syntax
What will be the result of executing: print(type(5.0))?
A
B
C
D
Correct Answer:  B.
EXPLANATION

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

Take Test
Q.20 Easy Basics & Syntax
In Python, which of the following is an immutable data type?
A List
B Dictionary
C Tuple
D Set
Correct Answer:  C. Tuple
EXPLANATION

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

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