Hello friends if you are looking for python introduction Multiple choice questions | python introduction objective type questions | python introduction mcq | python introduction mcq with answers | python introduction queston answers

1] Which of the following is an open source distribution of the Python and R
programming languages that uses the Conda package manager?

Ans: Anaconda

2] Which of the following terms best describes Jupyter notebooks that you can use to write Python code?

Ans: Interactive, Can view results on the same screen, Browser-based

3] As a new user of Python which version of Python should you use?

Ans: Either version of python is fine but 3.7 should be preferred

4] How can you execute shell commands on Jupyter notebook code cells?

Ans: Prefix the shell command using ! i.e. !python-version

5] What is the output of the following bit of code?
Code Editor:
13 // 5?

Ans: 2

6] Which of the following functions are valid built-in functions in Python?

Ans: len(), print(), type()

7] Which of the following commands are valid to store a numeric value of 2 in a variable named num_x?

Ans: num_x = 2, num_x = 6-4

8] Consider two Python variables initialized as shown below. Which of the
following logical statements below will have a value of True?

Code Editor:
a = True
b = True

Ans: a or b , a and b

9] Consider this bit of Python code:
Code Editor:
num_1 = 10
num_2 = 20
num_3 = num_1
num_1 = 100
What is the final value stored in num_3?

Ans: 10

10] If you want to increment the value stored in the num_1 variable by 10 which of the following Python statements are valid?

Ans: num_1 = num_1 + 10, num_1 += 10

11] Which of the following are valid data types in Python?

Ans: float, int, bool

12] What is the correct syntax for specifying multi-line strings in Python?

Ans: “””This is a multi-line string”””

13] Which of the following are valid string operations in Python?

Ans: “Hello” * 3, “Hello” + “World”

14] Which of the following statements about functions is true?

Ans: A function is defined using the “def” keyword, Function code is not
executed when defined

15] Which of the following are valid function names in Python?

Ans: _function_name(), functionName(), _123_Function_Name()

16] Which of the following statements about functions is false?

Ans: functions cannot access variables which are declared outside the function

17] Consider a function definition which looks like this:
def some_function(a, b, c):
print(a, b, c)
Which of the following function invocations are correct?

Ans: some_fuction(2,3,4), some_function(2,3,”Hello”)

18] Consider the following bit of code. What will be the result of executing this bit
of code?
def add(a, b):
result = x + y
add(10, 20)

Ans: 7

19] Which of the following statement(s) about positional arguments to functions is/are true?

Ans: A function can accept any number of positional arguments, They can be of any data type- primitive or complex types

20] What is the default return value from a function when no return statement is specified?

Ans: None

21] Which of the following statement(s) about return values is/are false?

Ans: A function can have just one return statement, A function has to have a
return statement, A function with input arguments cannot have a return

22] Which of the following statements(s) about the data types of return values
is/are false?

Ans: A return statement is mandatory in functions

23] Which of the following are valid kinds of input arguments for Python

Ans: Positional arguments, Keyword arguments

24] Which of the following are some of the advantages of using keyword
arguments to invoke functions?

Ans: Easier to maintain code since the value of each argument is clearly seen
during invocation, Keyword arguments can be specified out of order

25] What does this function definition indicate?
def some_fn(a, b, c=True):
print(a, b, c)

Ans: a and b are required arguments, c is required, a and b are numeric
arguments, c is boolean

26] Which of the following function definitions allows the function to accept
variable length arguments?

Ans: some_fn(*args)

27] Which of the following are valid types of arguments in Python?

Ans: Variable length arguments, Default arguments, Keyword arguments

28] Which of the following statement(s) about variable length arguments in
Python is/are true?

Ans: Variable length positional arguments are passed into the function as a
tuple, Variable length keyword arguments are passed into the function as a

Leave a Reply

Your email address will not be published. Required fields are marked *