0% found this document useful (0 votes)
52 views

CST 3 Sem Scripting Languages Python 307 2 N Jun 2022

The document provides a set of questions to test Python scripting language skills across multiple groups - Group A contains multiple choice and fill in the blank questions testing basics of Python, Group B contains short answer questions on intermediate concepts, and Group C contains longer answer questions testing deeper knowledge of Python concepts and applications. Students are instructed to answer questions from each group to demonstrate their proficiency with Python scripting.

Uploaded by

Manik Singh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views

CST 3 Sem Scripting Languages Python 307 2 N Jun 2022

The document provides a set of questions to test Python scripting language skills across multiple groups - Group A contains multiple choice and fill in the blank questions testing basics of Python, Group B contains short answer questions on intermediate concepts, and Group C contains longer answer questions testing deeper knowledge of Python concepts and applications. Students are instructed to answer questions from each group to demonstrate their proficiency with Python scripting.

Uploaded by

Manik Singh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

June 2022

Time Allowed:
902 sCRIPTING LANGUAGES (PYTHON) 307/2(N)
3 Hours Full Marks: 60

Answer the following questions from Group-A, B & Cas directed.

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

ii) What is the output of the following?


x= ['ab', 'cd']
for i in x:
x.append(i.upper())
print(x)
a) [AB, 'CD']. b)['ab', 'cd', 'AB, 'CD']. c)'ab', 'cd']. d) none of the mentioned

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

v) What will be the output of Python code snippet x<<2 ifx=1? a) 4 b) 2 c) 1 d) 8

vi) The default access mode is a) r b) w c)rb d)wb

vi) DRY principle makes the code a) Reusable b) Loop forever c)Bad and repetitive d) Complex

viii) What will be the output of the following Python function?


min(max(False,-3,-4), 2,7)
a)-3 b) -4 c) error d) false
ix) What will be the output of the Python expression round(4.576)? a) 4 b) 4.6 c) 5 d) 4.5

x) Which function is called an anonymous function? a) Lambda b) Map c) Filter d) Reduce

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

2. Fill in the blanks


(Any ten): 1x 10=10
i) All
keywords in Python are in
11) The Python built-in function for viewing variable types is
ii) Django
supports the
iv) a= 5, b=6
pattern.

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

b=34 >> 10, c = 7| 13, d = 12 A 13

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

c) Write a Python program to print the factorial ofa number.

6. Answer the question (any one)


6x1
a) What is difference between module and package? Is pandas a module or package?
b) Explain different types of loops available in Python with suitable examples.
is palindrome or not.
c) Write a python program to check whether the
number given a

6xl
7. Answer the question (any one)
do you input and output files in Python?
a) What are input and output files? How
use

b) Write a Python program to calculate the length of a string.


table from 1 to 10.
c) Write a python function to print multiplication

You might also like