[go: up one dir, main page]

0% found this document useful (0 votes)
8 views4 pages

Python Programming Lab Question Bank (1)

The document is a comprehensive question bank covering various topics in Python programming, including basic syntax, data types, control flow, functions, file handling, object-oriented programming, and libraries. It consists of 100 questions designed to test knowledge and understanding of Python concepts and functionalities. Each section addresses specific areas of Python, providing a structured approach to learning and assessment.

Uploaded by

lokeshisukala
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)
8 views4 pages

Python Programming Lab Question Bank (1)

The document is a comprehensive question bank covering various topics in Python programming, including basic syntax, data types, control flow, functions, file handling, object-oriented programming, and libraries. It consists of 100 questions designed to test knowledge and understanding of Python concepts and functionalities. Each section addresses specific areas of Python, providing a structured approach to learning and assessment.

Uploaded by

lokeshisukala
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/ 4

QUESTION BANK

Basic Syntax & Data Types

1 What is Python? List a few features of Python.

2 What are the key data types in Python?

3 How do you write a comment in Python?

4 What is the difference between a list and a tuple?

5 What is a dictionary in Python?

6 What is the use of the len() function?

7 How do you convert a string to an integer?

8 How do you take user input in Python?

9 How do you print something without a newline?

10 What is a variable in Python? How do you declare one?

Control Flow

11 What are if, elif, and else used for?

12 How do you write a for loop in Python?

13 What is the use of the range() function?

14 What is the difference between break and continue?

15 How do you write a while loop in Python?

Functions

16 How do you define a function in Python?

17 What is the purpose of the return statement?

18 What is a default parameter in a function?

19 How do you call a function in Python?

20 What is the difference between a function and a method?

Strings and Lists

21 How do you access the first character of a string?

22 How do you find the length of a string or list?

23 How can you append an element to a list?


24 How can you sort a list?

25 How do you slice a string?

File Handling

26 How do you open a file in Python?

27 What is the difference between read(), readline(), and readlines()?

28 How do you write to a file in Python?

29 What does the with statement do when handling files?

30 What happens if you try to open a file that doesn’t exist?

Section 1: Python Basics

31 What is the difference between the Python shell and script mode?

32 What does help() do in the Python interpreter?

33 How do you calculate compound interest in Python?

34 How do you find the distance between two points using coordinates?

35 How can you accept multiple user inputs from the keyboard?

Section 2: Loops & Conditions

36 How do for and while loops differ in Python?

37 How do you print a triangle pattern using a nested loop?

38 How can you check if a character is uppercase or a digit?

39 How does the Fibonacci sequence work in a while loop?

40 How can you break out of a loop when a prime is found?

Section 3: Functions and Lists

41 How do you convert a list or tuple to an array?

42 What methods can be used to find common elements in two arrays?

43 Write a recursive function to compute gcd.

44 What is a palindrome? How do you check one in Python?

45 How do you check if a list is sorted without using sort?

46 How do you detect duplicates in a list without changing it?

47 What does set() do when removing duplicates?

48 How do you invert a dictionary in Python?

Section 4: Strings & Recursion


49 How can you insert a comma between characters of a string?

50 How do you replace or remove a word in a string?

51 Write a function that capitalizes the first letter of each word.

52 How do you generate binary strings of n bits recursively?

Section 5: Matrices & Exception Handling

53 How do you represent a matrix in Python?

54 How do you add two square matrices?

55 How do you multiply matrices in Python?

56 What is a Python module? How do you create and use one?

57 What are exceptions in Python?

58 How do you catch general exceptions?

Section 6: OOP and Canvas Drawing

59 What is a class and an object in Python?

60 What are attributes in classes?

61 How do you draw shapes using a Canvas?

62 What is MRO (Method Resolution Order)?

63 How is MRO used in multiple inheritance?

64 How do you validate email and phone number using regex?

Section 7: File Handling

65 How do you merge contents of two files in Python?

66 How do you check if a word exists in a text file?

67 How do you count the most frequent word in a file?

68 How can you count words, vowels, spaces, upper/lowercase letters in a file?

Section 8: Libraries and Logic Gates

69 What is NumPy used for?

70 What can SciPy do?

71 How do you create a simple plot using matplotlib?

72 How do you install packages using pip?

73 How do you implement an AND gate in Python?

74 What is the logic behind a Half Adder?

75 How is a Full Adder different from a Half Adder?


76 What is a Parallel Adder?

77 What is tkinter used for?

78 How do you create a GUI with text fields and buttons?

General Programming Questions

79 What are the key data types in Python?

80 How does Python handle memory management?

81 What is the difference between == and is in Python?

82 What is the purpose of __init__() in a class?

83 What is recursion? Give a use case.

84 How do you handle multiple exceptions in Python?

85 What is the difference between break, continue, and pass?

86 How do you read a file line by line?

87 What is slicing in Python?

88 How do you sort a dictionary by its values?

89 What’s the use of enumerate() in loops?

90 What’s the difference between list, tuple, set, and dict?

91 How is a lambda function different from a normal function?

92 What is list comprehension?

93 What is the difference between shallow copy and deep copy?

94 What are global and local variables?

95 What is the use of try-except-finally?

96 What are Python decorators?

97 What are docstrings in Python?

98 What are *args and **kwargs?

99 How do you import a module in Python?

100 What is the difference between a package and a module?

You might also like