Python Fundamentals Class 11 Computer Science Exam Questions

Exam Questions Class 11

Please refer to Python Fundamentals Class 11 Computer Science Exam Questions provided below. These questions and answers for Class 11 Computer Science have been designed based on the past trend of questions and important topics in your class 11 Computer Science books. You should go through all Class 11 Computer Science Important Questions provided by our teachers which will help you to get more marks in upcoming exams.

Class 11 Computer Science Exam Questions Python Fundamentals

Class 11 Computer Science students should read and understand the important questions and answers provided below for Python Fundamentals which will help them to understand all important and difficult topics.

Question. Which of the following is false about “import modulename” form of import?
(a) The namespace of imported module becomes part of importing module
(b) This form of import prevents name clash
(c) The namespace of imported module becomes available to importing module
(d) The identifiers in module are accessed as: modulename.identifier

Answer

A

Question. Ankita has used some predefined functions in her program like sin() and randint(). But when she executes the program , it display error(s) that she hadn’t included required module. Help her to find which Python Library module she needs to import?
(a) math and trig module
(b) random and string module
(c) math and random module
(d) random module only

Answer

C

Question. What is the value returned by math.fact(6)?
(a) 720
(b) 6
(c) [1, 2, 3, 6].
(d) error

Answer

D

Question. Which of the following aren’t defined in the math module?
(a) log2()
(b) log10()
(c) logx()
(d) none of the mentioned

Answer

C

Question. All modular designs are because of a top-down design process? True or False?
(a) True
(b) False

Answer

B

Question. Which of the following random module function generates a floating point number?
(a) random()
(b) randint()
(c) uniform()
(d) all of the above

Answer

B

Question. Which of the following is false about “from-import” form of import?
(a) The syntax is: from modulename import identifier
(b) This form of import prevents name clash
(c) The namespace of imported module becomes part of importing module
(d) The identifiers in module are accessed directly as: identifier

Answer

B

Question. Which is the correct command to load just the tempc method from a module called usable?
(a) import usable, tempc
(b) import tempc from usable
(c) from usable import tempc
(d) import tempc

Answer

C

Question. The help <module> statement displays____ from a module
(a) constants
(b) functions
(c) classess
(d) docstrings

Answer

D

Question. A Python module has ______ extension
(a) .mod
(b) .imp
(c) .py
(d) ,mpy

Answer

C

Question. What is the output of the following piece of code?
from math import factorial
print(math.factorial(5))
(a) 120
(b) Nothing is printed
(c) Error, method factorial doesn’t exist in math module
(d) Error, the statement should be: print(factorial(5))

Answer

D

Question What is the output of the function shown below if the random module has already been imported?
random.randint(3.5,7)
(a) Error
(b) Any integer between 3.5 and 7, including 7
(c) Any integer between 3.5 and 7, excluding 7
(d) The integer closest to the mean of 3.5 and 7

Answer

A

Question. Which of these definitions correctly describes a module?
(a) Denoted by triple quotes for providing the specification of certain program elements
(b) Design and implementation of specific functionality to be incorporated into a program
(c) Defines the specification of how it is to be used
(d) Any program that reuses cod

Answer

B

Question. Which of the following is not a valid namespace?
(a) Global namespace
(b) Public namespace
(c) Built-in namespace
(d) Local namespace

Answer

B

Question. What is returned by math.ceil(3.4)?
(a) 3
(b) 4
(c) 4.0
(d) 3.0

Answer

B

Question. To include the use of functions which are present in the random library, we must use the option:
(a) import random
(b) random.h
(c) import.random
(d) random.random

Answer

A

Question. Which file must be a part of a folder to be used as a Python package?
(a) package.py
(b) _init_.py
(c) _package_.py
(d) _module.py_

Answer

B

Question. What is the value returned by math.floor(3.4)?
(a) 3
(b) 4
(c) 4.0
(d) 3.0

Answer

A

Very Short answer Type Questions 

Question: What is the error in following code: x, y =7 ?
Answer: The following error comes – ‘int’ object is not iterable. Which means an integer object i.e.
cannot be repeated for x and y. one more integer object is required after 7.

Question: What is None literal in Python?
Answer: Python has one special literal, which is None. The None literal is used to indicate absence of
value. It is also used to indicate the end of lists in Python. It means ―There is nothing here‖.

Question: Following code is creating problem X = 0281, find reason.
Answer: 0281 is an invalid token.

Question: Find the error in the following code:
(a) y = x +5 (b) a=input(“Value: “) (c) print(x = y = 5)
print(x,y) b = a/2
print( a, b)
Answer: (a) Name ‘x’ is not defined.
(b) Unsupported operand type(s) for /: ‘str’ and ‘int’.
(c) Invalid Syntax.

Question: what will the following code do: a=b=18 ?
Answer: This code will assign 18 to a and b both. 

Question: Find the error in the following code: 5
(a) temp=90
Print temp
(b) a=12 
 b = a + b
print( a And b)
(c) print(“x=”x)
(d) a, b, c=2, 8, 4
print(a, b, c)
c, b, a = a, b, c
print(a; b; c)
(e) x = 23
   4 = x
(f) else = 21-4

Answer: (a) Missing parentheses in call to ‘print’.
(b) Name ‗b‘ is not defined.
(c) Invalid Syntax.
(d) Invalid Syntax in second print statement.
(e) can’t assign to literal in second line.
(f) Invalid Syntax. 

Short Answer Type Questions

Question: What is the difference between a keyword and an identifier?
Answer: Difference between Keyword and Identifier: Every language has keywords and identifiers,
which are only understood by its compiler. Keywords are predefined reserved words, which
possess special meaning. An identifier is a unique name given to a particular variable, function
or label of class in the program.

Question: What are tokens in Python? How many types of tokens allowed in Python?
Answer: Tokens are the smallest unit of the program. There are following tokens in Python:

  • Reserved words or Keywords
  • Identifiers
  • Literals Definition of all tokens may come. Which is not given
  • Operators in this question bank.
  • Punctuators
Python Fundamentals Computer Science Exam Questions

Question: What are literals in Python? How many types of Literals allowed in Python?
Answer: Literals: Python comes with some built-in objects. Some are used so often that Python has a
quick way to make these objects, called literals.
The literals include the string, Unicode string, integer, float, long, list, tuple and
dictionary types.

Question: How many types of sequences are supported in Python?
Answer: Three Types of Sequences are supported in python:
(i) String
(ii) List
(iii) Tuple

Question: What is the difference between an expression and a statement in Python?
Answer: A statement is an instruction that the Python interpreter can execute. We have only seen the
assignment statement so far. Some other kinds of statements that we‘ll see shortly
are while statements, forstatements, if statements, and import statements. (There are other
kinds too!)
An expression is a combination of values, variables, operators, and calls to functions.
Expressions need to be evaluated. If you ask Python to print an expression, the
interpreter evaluates the expression and displays the result.

Question: What are operators? What is their function? Give examples of some unary and binary operators.
Answer:
 “Operators are those symbols used with operands, which tells compiler which operation is to be
done on operands.‖ in other words – ―operators are tokens that trigger some
computation/action when applied to variables and other objects in an expression.‖
Operators are of following types:

  • Unary operators like (+) Unary Plus, (-) Unary Minus, not etc.
  • Binary Operators like (+) addition, (*) multiplication, and etc.

Question: What factors guide the choice of identifiers in program?
Answer: (i) An identifier must start with a letter or underscore followed by any number of digits
and/or letters.
(ii) No reserved word or standard identifier should be used.
(iii) No special character (Other than underscore) should be included in the identifier.

Question: How many types of strings are supported by Python?
Answer: Python supports two types of strings:
(i) Single-line string       That terminates in single line.
(ii) Multi-line String        That stores multiple lines of text.

Question: What is block/code block/suit in Python?
Answer: Sometimes a group of statements is part of another statement of function. Such a group of one

Python Fundamentals Computer Science Exam Questions

Question: What is the role of indentation in Python?
Answer: Indentation plays a very important role in Python. Python uses indentation to create blocks ofcode. Statements at same indentation level are part of same block/suit. Youcannot
unnecessarily indent a statement; python will raise an error for that.

Skill Based Questions

Question: How can you create multi-line strings in Python?
Answer: We can create multi-line string by putting a backslash (\) at the end of line which allows you tocontinue typing in next line in same string.

Python Fundamentals Computer Science Exam Questions

Question: What will be the output of the following code:


Answer: Output: Hari , you are 18 now but You will be 19 next year

Question: Which of the following are syntactically correct strings? State reason.
(a) ”Python is nice Language”
(b) „He called me “Friend!” when he came‟
(c) “Very Good‟
(d) „This is a good book‟
(e) “Namaste
(f) “I liked „Harry Potter‟ very much”
Answer: (a) Correct (b) Correct (c) Incorrect (d) Correct (e) Incorrect (f) Correct

Question: What is the error in following Python program with one statement?
print(“My name is : “, name) suggest a solution 4
Answer: Error is : ―name ‘name’ is not defined‖. And the solution is to declare the variable-name before
this statement.

Python Fundamentals Computer Science Exam Questions

Question: What will be the sizes of following constants? 1
(a) „\a‟ (b) “\a” (c) “Kumar\‟s” (d) „\”‟ (e) “it‟s”
Answer: (a) 50 (b) 50 (c) 56 (d) 50 (e) 53
This screenshot is the output of the above question.

Python Fundamentals Computer Science Exam Questions

Question: Write a Program to obtain temperature in Celsius and convert it into Fahrenheit using formula –7
C X 9/5 + 32 = F
Answer:

Python Fundamentals Computer Science Exam Questions

Question: WAP to calculate simple interest.
Answer:

Python Fundamentals Computer Science Exam Questions

Question: WAP to read todays date (only date Part) from user. Then display how many days are left in the current month.
Answer:

Python Fundamentals Computer Science Exam Questions

Question: WAP to print the area of circle when radius of the circle is given by user.
Answer:

Python Fundamentals Computer Science Exam Questions

Question: Predict the output of the following:

Python Fundamentals Computer Science Exam Questions

Answer: Output: 17 5

Question: Predict output:

Python Fundamentals Computer Science Exam Questions

Answer: Output: 4 6 8

Question: WAP that asks your height in centimeters and converts it into foot and inches.
Answer:

Python Fundamentals Computer Science Exam Questions

Question: WAP to find area of a triangle.
Answer:

Python Fundamentals Computer Science Exam Questions

Question: WAP to print the volume of a cylinder when radius and height of the cylinder is given by user.
Answer:

Python Fundamentals Computer Science Exam Questions

Question: WAP to read a number in n and prints n2, n3, n4
Answer:

Python Fundamentals Computer Science Exam Questions

Case Based Questions :

Read the following incomplete code snippet and answer the questions following it. 
import …….. #Line1
Pick= ….. . randint(0,3) #Line2
City= [“Delhi’,”Mumbai”,:Chennai”]
for I in city:
for j in …..(1,Pick): #Line3
print(I, end=””)

Question. Which function will be used in Line3?
(a) sqrt
(b) range
(c) limit
(d) min

Answer

B

Question. Identify the suitable code for blank space marked in Line1
(a) math
(b) random
(c) math, random
(d) None of the above

Answer

B

Question. Choose the keyword to be used in the given space of Line2
(a) math
(b) math, random
(c) date and time
(d) random

Answer

D

Read the following code snippet carefully and answer the questions following it-:
import math
a= int(math.pow(3,2)) #Line1
b=math.exp(p) #Line2
x = math.isfinite(float(‘0.0’)) #Line3

Question. What will x return in Line3?
(a) True
(b) False
(c) None
(d) error

Answer

A

Question. What will get stored in variable a of Line1?
(a) 6
(b) 8
(c) 9
(d) 0

Answer

C

Question. What is the alternate way of writing exp() in Line2?
(a) (math.e ** p) – 1
(b) math.e ** (p – 1)
(c) error
(d) none of the mentioned

Answer

A

Python Fundamentals Computer Science Exam Questions

We hope you liked the above provided Python Fundamentals Class 11 Computer Science Exam Questions. If you have any further questions please put them in the comments section below so that our teachers can provide you an answer.