Python Programming — Basics & Syntax
Python fundamentals to advanced for interviews
100 Questions 10 Topics Take Test
Advertisement
Showing 91–100 of 100 questions in Basics & Syntax
Q.91 Medium Basics & Syntax
What will be the output of: 'Hello' * 2?
A 'HelloHello'
B Error
C 'Hello' concatenated twice
D HelloHello
Correct Answer:  D. HelloHello
EXPLANATION

String multiplication repeats the string. 'Hello' * 2 produces 'HelloHello'.

Take Test
Q.92 Medium Basics & Syntax
Which method is used to add an element to a Python list?
A add()
B append()
C insert()
D Both B and C
Correct Answer:  D. Both B and C
EXPLANATION

append() adds an element at the end, while insert() adds at a specific position. Both are valid methods.

Take Test
Q.93 Medium Basics & Syntax
Which of the following will create an empty dictionary?
A {}
B {:}
C dict()
D Both A and C
Correct Answer:  D. Both A and C
EXPLANATION

{} and dict() both create empty dictionaries. {} is more concise while dict() is explicit.

Take Test
Q.94 Medium Basics & Syntax
Which operator is used for integer division in Python 3?
A /
B //
C %
D **
Correct Answer:  B. //
EXPLANATION

The '//' operator performs floor division and returns an integer, while '/' returns a float in Python 3.

Take Test
Q.95 Easy Basics & Syntax
What will be the output of: len('Python')?
A 5
B 6
C 7
D Error
Correct Answer:  B. 6
EXPLANATION

The string 'Python' has 6 characters: P, y, t, h, o, n. The len() function returns the number of characters.

Take Test
Advertisement
Q.96 Medium Basics & Syntax
Which data type is immutable in Python?
A List
B Dictionary
C Tuple
D Set
Correct Answer:  C. Tuple
EXPLANATION

Tuples are immutable sequences in Python. Once created, their elements cannot be modified, unlike lists.

Take Test
Q.97 Easy Basics & Syntax
Which keyword is used to create a function in Python?
A function
B def
C func
D define
Correct Answer:  B. def
EXPLANATION

The 'def' keyword is used to define functions in Python. It is followed by the function name and parameters.

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

5.0 is a floating-point number in Python. The type() function returns <class 'float'> for decimal numbers.

Take Test
Q.99 Easy Basics & Syntax
Which of the following is NOT a valid Python identifier?
A _variable
B variable2
C 2variable
D var_name
Correct Answer:  C. 2variable
EXPLANATION

Python identifiers cannot start with a digit. They must begin with a letter or underscore.

Take Test
Q.100 Easy Basics & Syntax
What is the correct way to create a variable in Python?
A variable_name = value
B $variable_name = value
C variable-name = value
D variable name = value
Correct Answer:  A. variable_name = value
EXPLANATION

Python variables are created using the assignment operator (=) with valid identifiers containing letters, digits, and underscores.

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