SL Important Questions
SL Important Questions
SL Important Questions
Unit-I
1. Explain about the need for learning python programming and its importance.
2. Define scripting language and explain the characteristics of Scripting Languages
3. Explain the uses of Scripting Languages
4. Compare scripting languages from non-scripting languages
5. What are the different types of scripting languages and explain them in detail.
6. Who uses python today? What are Python’s technical strengths?
Unit-II
1. How does a computer run a python program? Explain with a neat diagram.
2. Write the history of python.
3. Compare python 2.x with python 3.x
4. Explain about different Logical operators in python with appropriate examples.
5. Write in brief about the applications of Python.
6. Write the rules for choosing names of variables.
7. Write in brief about any 5 keywords in Python.
8. Explain about different Relational operators in python with appropriate examples.
9. Explain about Membership operators in python with appropriate examples.
10. Explain about Identity operators in python with appropriate examples.
11. Explain about Arithmetic operators in python with appropriate examples.
12. Explain built-in data types in python.
13. How to comment specific lines in python program?
14. Give the syntax and significance of raw-input() and input() methods.
15. What is a numeric literal? Give examples.
16. Outline the operator precedence of arithmetic operators in python.
17. Write a python program to exchange the value of two variables.
18. Explain input function.
19. What are IDLE usability features?
20. What are 4 built-in numeric data types in python? Explain.
21. Discuss about variables and assignments.
22. What is indentation? Explain with example.
Unit-III
1. List different conditional statements in python with appropriate examples.
2. What are the different Loops available in python?
3. What are the different loop control statements available in python? Explain with suitable
examples.
4. Explain about iteration statements with examples.
5. Write a python program to retrieve the strings starting with m and having 5 characters.
6. Write a python program that counts the number of occurrences of the character in the given
string.
7. Write a python program to print Fibonacci series upto n terms.
Note: The Fibonacci numbers are 0, 1, 1, 1, 3, 5, 8, 13, 21, 34, ….. where each number is the sum of the
preceding two.
8. Write a python program to check whether the given number is Armstrong or not using user
defined function.
9. Give the output of following Python code:
str1 = ‘This is Python’
print “Slice of String:”,str1[1:4:1]
print “Slice of String:”,str1[0:-1:2]
10. Write a python program to accept two numbers find the greatest and print the result.
11. Appraise with an example nested if and elif header in python.
12. Write a python program to find average of best two test marks out of three test marks.
13. Explain with an example while loop, break statement and continue statement in python
14. Explain about string formatting operator with example.
15. Write a python program to find the factorial of a given number without recursion and with
recursion.
16. Write the python program to check whether a given number is prime or not, using for-else
statement.
17. Write a python program to read a string with punctuations and print the same string without
punctuations.
Unit-IV
1. Explain about Lambda function with suitable examples.
2. Explain about methods in Lists of Python with appropriate examples.
3. Write a python program to describe different ways of deleting an element from the given List.
4. What are the different operations that can be performed on a list? Explain with examples.
5. Write in brief about List in python.
6. Write in brief about Tuple in python. Write operations with suitable examples.
7. Is tuple mutable? Demonstrate any two methods of tuple.
8. Write a python script to display the current date and time.
9. Write in brief about Set in python. Write operations with suitable examples.
10. Write in brief about Dictionary in python. Write operations with suitable examples.
11. Write in brief about Sequence in python. Write operations with suitable examples.
12. Compare List and Tuple.
13. How to create a module and use it in a python program? Explain with an example.
14. Explain the concept of namespaces with an example.
15. Write about the concept of scope of a variable in a function.
16. Write about different types of arguments in a function.
17. Write in brief about anonymous functions.
18. Why to use modules? How to structure a program?
19. Explain the function that is used to retrieve the parts of the URL.
20. What is the use of islower() and isupper() method? Explain with examples.
21. Write a python program using function to find the sum of first ‘n’ even numbers and print the
result.
22. Explain the default argument.
23. Explain about required and variable length arguments
24. Discuss in detail about the import statement.
25. Distinguish between local and global variables with examples.
26. Briefly discuss about python packages.
27. Discuss the importance of docstring.
28. Write a python program to read a word and print the number of letters, vowels and percentage
of vowels in the word using a dictionary.
29. Consider the following two sets and write the python code to perform following operations on
them.
i. Union Lows = 0,1,2,3,4
ii. Difference Odds=1,3,5,7,9
iii. Symmetric difference
iv. intersection
30. Consider the list qty =[5,4,7,3,6,2,1] and write the python code to perform the following
operation without using built-in methods:
i. Insert an element 9 at the beginning of the list
ii. Insert an element 8 at the end of the list
iii. Insert an element 8 at the index position 3 of the list
iv. Delete an element at the beginning of the list
v. Delete an element at the end of the list
vi. Delete an element at the index position 3
vii. Print the list in reverse order (end to start)
viii. Delete all elements of the list.
Unit-V
1. Write a python program to know the current working directory and to print all contents of the
current directory. What changes we need to make in the program if we wish to display the
contents of only ‘mysub’ directory available in current directory?
2. Write a python program to append data to an existing file ‘python.py’. Read data to be
appended from the user. Then display the contents of entire file.
3. Write a python program to retrieve name and date of birth (mm-dd-yyyy) of students from a
given file student.txt.
4. Read a text file in Python and print number of lines and number of unique words.
5. Tabulate the different modes for opening a file and explain the same.
6. How can we use ‘with’ statement while opening a text file? Explain.
7. Write a python program to read the contents of a text file and write into another.