0% found this document useful (0 votes)
42 views3 pages

CST445 Practice Questions Set 1

Uploaded by

anjanaks003
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views3 pages

CST445 Practice Questions Set 1

Uploaded by

anjanaks003
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Government Engineering College Kozhikode

Academic Year 2024 – 2025

CST445 – Python for Engineers


Practice Questions Set 1 (Module 1 and 2)
Each question carry 8 Marks

Module 1
1. Illustrate the concept of modules and explain how they are used in Python programs
2. Explain the differences between pass and comment statement in python
3. Explain the basic data types available in Python with examples
4. With example explain about the following operators used in python
i) Arithmetic ii) Logical iii) Membership iv) Bitwise
5. Explain about Iteration statements with appropriate syntax and examples
6. What is the need of math module? Explain about different in-built methods used in math
module
7. What are the possible errors in python? Explain how the errors are Detected and
corrected in python program
8. Explain Arithmetic expressions and Mixed mode expressions with Type conversions
9. What is lazy evaluation in python? Explain with example.
10. What is type conversion? How is it done in Python? Explain with example.
11. Compare and contrast interpreted languages and compiled languages. How does it affect
the quality of program development and execution of the program?
12. Write the steps involved in running a program in IDLE and Jupyter.

13. Write a Python program to find the sum of all even numbers between 1 and N.
14. Write a python program to check whether a number is Armstrong or not.
15. Write a Python program to find the number of occurrence of each digit (0 to 9) in the
number entered by user and the sum of the digits of the number

16. Write a Python program to print the value of 2^(2n) +n+5 for n provided by the user.
17. Input 4 integers (+ve and −ve). Write a Python code to find the sum of negative
numbers, positive numbers, and print them. Also, find the averages of these two groups
of numbers and print.
18. Write a program to display the grades A, B, C, D, E, F and S, according to the marks
obtained.

19. Find the sum of the following series


sum

20. Write a program to find the largest of a 2D array of MxN numbers entered by the user.
Also find the sum of numbers of each row and print the result.
a. Without using library functions.
b. Using library functions.

21. Write a program to sort an array of 10 numbers in ascending order


a. Without using library functions.
b. Using library functions.
Module 2

22. Illustrate the use of __name__ variable and main function in python
23. Define Lambda function. List its characteristics
24. With examples explain about the tuple operations used in python.
25. Explain the different type of functional arguments available in Python with examples
26. Discuss the following list functions
a) append()
b) insert()
c) remove()
d) sort()
e) extend()
f) pop()
g) index()

27. Compare tuples, lists, sets and dictionaries.


28. Explain the concept of scope and lifetime of variables in Python programming language,
with a suitable example.
29. Illustrate the following Set methods with an example.
i. intersection( ) ii. Union( ) iii. Issubset( ) iv. Difference( ) v. update( ) vi.discard( )

30. Illustrate the following Dictionary methods with an example.


i. clear( ) ii. fromkeys( ) iii. get( ) iv. pop( ) v. update( ) vi.setdefault( )

31. Write a program to swap two numbers using tuple. Get the numbers from the user
prompt.
32. Write a Python script to print a dictionary where the keys are numbers between 1 and 15
(both included) and the values are square of keys.
33. Write a program using function to display a multiplication table of n*n size, for any given
„n‟.
34. Write a python program to find the factorial of a number using recursion. Print the
number of digits in the factorial
35. Consider a string, s = “ Python programming” . Write the output for the following code.
(i) print(s[ : len(s)])
(ii) print(s[0 : 7])
(iii) print(s[ : -1])
(iv) print(s[0 : ])
(v) print(s[-11 : -1])
(vi) print(s.split())

36. Write a Python program to get a string and change all occurrences of its first character to
'$', except the first character itself.
37. Given is a list of of words, wordlist, and a string, name. Write a Python function which takes
wordlist and name as input and returns a tuple. The first element of the output tuple is the
number of words in the wordlist which have name as a substring in it. The second element of
the tuple is a list showing the index at which the name occurs in each of the words of the
wordlist and a 0 if it doesn‟t occur.
38. Write a Python code to create a function called list_of_frequency that takes a string and
prints the letters in non-increasing order of the frequency of their occurrences. Use
dictionaries.
39. Write a Python program to read a list of numbers and sort the list in a non-decreasing
order without using any built in functions. Separate function should be written to sort the
list wherein the name of the list is passed as the parameter.
40. Write a Python program to check the validity of a password given by the user.
The Password should satisfy the following criteria:
a) Contains at least one letter between a and z
b) Contains at least one number between 0 and 9
c) Contains at least one letter between A and Z
d) Contains at least one special character from $, #, @
e) Minimum length of password: 6

You might also like