Final Recap With Syllabus
Final Recap With Syllabus
●Introduction to Python, features of Python, execution modes: interactive mode and script mode,
Python character set, Python tokens (keyword, identifier, literal, operator, punctuator), variables,
concept of l-value and r-value, use of comments
● Knowledge of data types: number (integer, floating point, complex), boolean, sequence (string,
list, tuple), none, mapping (dictionary), mutable and immutable data types
● Operators: arithmetic operators, relational operators, logical operators, assignment operator,
augmented assignment operators, identity operators (is, is not), membership operators (in, not in)
● Expressions, statement, type conversion & input/output: precedence of operators, expression,
evaluation of expression, python statement, type conversion (explicit & implicit conversion),
accepting data as input from the console and displaying output
● Errors: syntax errors, logical errors, runtime errors
● Flow of control: introduction, use of indentation, sequential flow, conditional and iterative flow
control
● Conditional statements: if, if-else, if-elif-else, flowcharts, simple programs: e.g.: absolute value,
sort 3 numbers and divisibility of a number
● Iterative statements: for loop, range function, while loop, break and continue
statements, nested loops
( ● Strings: introduction, indexing, string operations (concatenation, repetition, membership &
slicing), traversing a string using loops, built-in functions: len(), capitalize(), title(), lower(), upper(),
count(), find(), index(), endswith(), startswith(), isalnum(), isalpha(), isdigit(), islower(), isupper(),
isspace(), lstrip(), rstrip(), strip(), replace(), join(), partition(), split()
● Lists: introduction, indexing, list operations (concatenation, repetition, membership & slicing),
traversing a list using loops, built-in functions: len(), list(), append(), extend(), insert(), count(),
index(), remove(), pop(), reverse(), sort(), sorted(), min(), max(), sum(); nested lists, suggested
programs: finding the maximum, minimum, mean of numeric values stored in a list; linear search
on list of numbers and counting the frequency of elements in a list
● Tuples: introduction, indexing, tuple operations (concatenation, repetition, membership &
slicing),built-in functions: len(), tuple(), count(), index(), sorted(), min(), max(), sum(); tuple
assignment,nested tuple, suggested programs: finding the minimum, maximum, mean of values
stored in atuple; linear search on a tuple of numbers, counting the frequency of elements in a tuple
● Dictionary: introduction, accessing items in a dictionary using keys, mutability of dictionary
(addinga new item, modifying an existing item), traversing a dictionary, built-in functions: len(),
dict(),keys(), values(), items(), get(), update(), del(), clear(), fromkeys(), copy(), pop(), popitem(),
setdefault(), max(), min(), count(), sorted(), copy(); suggested programs : count the number of
times a character appears in a given string using a dictionary, create a dictionary with names of
employees, their salary and access them
● Introduction to Python modules: , Importing math module (pi, e, sqrt, ceil, floor, pow, fabs, sin,
cos, tan); random module (random, randint, randrange), statistics module (mean, median, mode)
Text file: opening a text file, text file open modes (r, r+, w, w+, a, a+), closing a text
file, opening afile using with clause, writing/appending data to a text file using write()
and writelines(), readingfrom a text file using read(), readline() and readlines(), seek
and tell methods, manipulation of data in a text file
Binary file: basic operations on a binary file: open using file open modes (rb, rb+,
wb, wb+, ab, ab+),
close a binary file, import pickle module, dump() and load() method, read,
write/create, search, append and update operations in a binary file
CSV file: import csv module, open / close csv file, write into a csv file using
csv.writerow() and read from a csv file using csv.reader( )
XI – Python Recap
1. Which of the following are invalid identifier?
(a) While (b)XthClass (c) _Flash10 (iv) True
11. The ________ method remove all items from the dictionary.
(a) pop () (b) del() (c) clear() (d)All of the above
1. ___________ is a file containing python definitions and statements intended for use in other python
programs.
(i) library (ii) module (iii) function (iv) import
2. Choose the correct possible output for the following code fragment:
print(3+random.randint(3,5 )*2)
(i) 12 (ii) 13 (ii)14 (iv) 15
3. The function which is written by the programmer as per his/her requirement is known as
(i) module (ii) built-in (iii) user-defined (iv) keyword
8. Which values used by the functions to communicate information back to the caller.
(i) local (ii) global (iii) return (iv) random
(iv) What possible outputs(s) are expected to be displayed on screen at the time of execution of the
program from the following code? Also specify the maximum values that can be assigned to each
of the variables FROM and TO.
import random
AR=[20,30,40,50,60,70];
FROM=random.randint(1,3)
TO=random.randint(2,4)
for K in range(FROM,TO+1):
print (AR[K],end=”#“)
8. Which of the following keywords marks the beginning of the function block
(i) define (ii) fun (iii)return (iv)def
9. The values being passed through the function call statement are called _________
(i) real arguments (ii) actual arguments (iii) global arguments (iv) formal arguments
def Change(L):
return(L[2]+5//2)
Values=[5,20,100,110,50]
print(Change(Values))
13. Which of the following function calls can be used to invoke the below function definition?
def Execute(A,B,C=10,D=0):
print(A+B)
def interest(P=4000,R=2,T=0.10):
return(P*R*T)
print(interest(5000,3))
X=10
def Global(Y):
global X
X=15
X+=Y
return (X+Y)
K=Global(X)
print(X+K)
import random
Lst=[50,70,80,90]
option=random.randint(0,2)+3;
for K in range(1,4):
chance=random.randrange(4-K)
print(Lst[chance]+option,end='#')