My Sample Apper Python
My Sample Apper Python
isdigit()
2. Write a program for the given syntax and tabulate the results 1. isnumeric() 2. islower()
2. Explain in detail about Python Files, its types, functions and operations that can be performed on
files with examples. (16 marks)
a) Write a program to enter a number in Python and print its octal and hexadecimal
equivalent. (6 marks)
d) Write an algorithm to check whether a student is pass or fail, the total marks of student
being the input. (4 marks)
Variables are names or identifiers that map to objects. A namespace is a dictionary of variable
names/keys and their corresponding object values. A python statement can access variables in a local
namespace and global namespace. If the local and global variables have the same name, the local
variable shadows the global variable. Each function has its own local namespace.
5. List some few common Exception types and explain when they occur.
ArithmeticError- Base class for all errors that occur for numeric calculations. OverflowError-
Raised when a calculation exceeds maximum limit for a numeric type. ZeroDivisionError- Raised
when division or modulo by zero takes o place. ImportError- Raised when an import statement fails.
IndexError- Raised when an index is not found in a sequence. RuntimeError- Raised when a
generated error does not fall into any category.
Pickling is so called because it ―preserves‖ data structures. The pickle module contains the
necessary commands. To use it, import pickle and then open the file in the usual way: >>> import
pickle >>> f = open("test.pck","w")
The break statement is new. Executing it breaks out of the loop; the flow of execution moves to the
first statement after the loop. The continue statement ends the current iteration of the loop, but
continues looping. The flow of execution moves to the top of the loop, checks the condition, and
proceeds accordingly.
A text file is a file that contains printable characters and whitespace, organized into lines separated
by newline characters. [Type text] To demonstrate, we‘ll create a text file with three lines of text
separated by newlines: >>> f = open("test.dat","w") >>> f.write("line one\nline two\nline three\n")
>>> f.close()
8. Which method is used to read the contents of a file which is already created?
The read method reads data from the file. With no arguments, it reads the entire contents of the
file: >>> text = f.read() >>> print text Now is the timeto close the file
9. Define python lists? With a program explain the concept of Accessing Values in Lists, updating lists
and deleting list elements.
10. With assumed list write a program for the given code Cmp(list1, list2), len(List), max(list) &
min(list) respectively.
11. Define python tuples? With program explain the concept of Accessing Values in tuples, updating
tuples and deleting tuple elements.
13. Explain the concepts of multiline statements, the quotation in python & comments in python in
brief.
15. Mention the different types of operators, descriptions and suitable examples related to python
Assignment & bitwise operators.
16. Mention the different types of operators, descriptions and suitable examples related to python
Logical, Membership & Identity operators.
17. Explain the concept of Single Statement Suites and pass statement related to decision making &
loop control statements respectively.
18. With suitable program explain the concept of using else statement with loops related to for loop
19. With syntax & program explain the concept of elif statement in decision making
20. Explain the concept of break statement involved in loop control statements with flow diagram &
program.
21. Explain the concept of continue statement involved in loop control statements with flow diagram
& program.
22. Discuss the operator functions of String Special Operators & String Formatting Operator in detail.
23. Mention the function, description of random number functions and trigonometric functions
related to python numbers.
24. Explain the concept, syntax, program of capitalize() Method & center(width, fillchar) Method
related to Built-in String Methods.
26. Explain in brief about Built-in tuple Functions and Methods, Indexing, Slicing, and Matrixes &
Basic Tuples Operations.
27. With assumed list write a program for the given code Cmp(list1, list2), len(List), max(list) &
min(list) respectively
28. Explain in brief about Basic list Operations, Indexing, Slicing, and Matrixes & Built-in List
Functions and Methods.
29. Explain the concepts of No enclosing delimiters in brief and also write a program for Cmp(tuple1,
tuple2) syntax respectively