CST 3 Sem Scripting Languages Python 307 2 N Jun 2022
CST 3 Sem Scripting Languages Python 307 2 N Jun 2022
Time Allowed:
902 sCRIPTING LANGUAGES (PYTHON) 307/2(N)
3 Hours Full Marks: 60
GROUP-A
1. Choose the correct alternative 1x10=10
(Any 10)
) Which one of the following is not a keyword in Python language? A) pass b) eval o) assert d) nonlocal
11) The input() function takes user's input as a- a) integer b) float c) string d) character
iv) Which statement is used to terminate the execution of the nearest enclosing loop in which it appears?
a) Pass b) break c) continue d) jumpP
vi) DRY principle makes the code a) Reusable b) Loop forever c)Bad and repetitive d) Complex
xi) What does pip stand for python? a) Unlimited lengthb) All private members must have leading and
d) None of these
trailing underscores c) Preferred Installer Program
xi) Which of the following functions can help us to find the version of python that we are currently
d) sys.version
working on? a) sys.version(1) b) sys.version(0) c) sys.version()
10 20 30 b) 10/20/30
xii) What will be the output of print(10,20,30,sep="") a) a) c) 1020130
d) error
b) {} c)[l,2, 3] d) (1, 2, 3)
xiv) Which ofthe following is a Python tuple? a) {1,2, 3}
xv) Predict output for the snippet
for j in range(1,5):
1
printj)
a) 123 4,b) indentation eror, c) jjij,d) J
a, b=b, a
print(a,b) is the final output.
v) To convert '5' into int data
command is used.
vi) Open) function is used fortype ,
vi) a = 10<<12
print(a,b.c,d)
vii) To find x,you will use
is the output.
operator.
ix) A program in python is stored with a extension.
x) The value of the expression set([1,
1, 2, 3]) is
xi) method is used to delete a file.
xii) The statement is a combination of an else statement and an if statement.
xiii) import time
a- time.localtime()
c time. asctime(a)
print(c) is the output.
Xiv) is used to define a block of code in
xv) The 13//(4+3%S) evaluates to Python language.
3. Answer the
following questions (any ten)
Ix 10 10
i) What is a lambda function?
) What is an
Interpreted language?
ii) What is the purpose of isatty() ?
iv) What are python iterators?
V What is Scope in Python?
vi) How to comment
multiple lines in python?
vii) Explain find() function.
viii) How will you capitalize the first letter
of string?
ix) What is the purpose of flush) ?
x) What are Python's dictionaries?
xi) How can you generate random
numbers?
xii) What is PEP 8?
xiv) What is the purpose of the PYTHONPATH environment variable'?
xv) Is python a case-sensitive language?
2
GROUP-B
4. Answer the 2x6-12
questions (Any six)
i) What is slicing?
ii) What are membership
operators?
iii) Differentiate between continue and break statement.
iv) Differentiate between globals() and locals()
v) Name two file built-in functions. Give their syntax.
vi) What is the difference between Python Arrays and lists?
Vn) Give two ways to convert a number into a string.
viil) B-3, A=2. Swap the values of these variables.
ix) How can the ternary operators be used in python?
x) How do you insert a static file to a template in Django?
xi) Is Django better than Flask?
xii) Write a Python code to add the values of two variables.
GROUP-C
6x1
5. Answer the question (any one)
a) Explain the basic data types available in Python with examples. the key features of Python?
b) What is the difference between list and tuples in Python?What
are
6xl
7. Answer the question (any one)
do you input and output files in Python?
a) What are input and output files? How
use