Python Scripting Exam Prep
Full explanation, worked examples & memory tricks in the app
Shared by a Veda learner · Generated with Veda AI
Full explanation, worked examples & memory tricks in the app
Every question in the paper gets a full exam-length answer in the app — organised by marks, the way a topper writes it.
List out different types of Data types in Python and Explain each one with example.
Data types include int, float, str, list, tuple, dict, set, each serving different purposes.
The full exam-length answer is in the app.
Explain Input and Output statements in Python by giving examples.
Input statements take user input, while output statements display data.
The full exam-length answer is in the app.
Explain type casting with example.
Type casting converts one data type to another, e.g., int('5') converts string to integer.
The full exam-length answer is in the app.
Explain membership and identity operators with examples.
'in' checks membership, 'is' checks identity; e.g., 5 in [1, 2, 3, 5].
The full exam-length answer is in the app.
Develop a program that picks a random integer from 1 to 100, and has players guess the number.
Use random.randint(1, 100) for the number and implement guessing logic.
The full exam-length answer is in the app.
Develop a program that displays an ASCII character table from ! to ~.
Use a loop and chr() to display characters and their ASCII values.
The full exam-length answer is in the app.
Develop a program that counts the occurrences of each digit in a string.
Use a dictionary to count digits in the input string.
The full exam-length answer is in the app.
Develop a program to repeatedly prompt the user to enter the capital of a state.
Use a loop to check user input against a dictionary of states and capitals.
The full exam-length answer is in the app.
Develop a program to print the dates of all the Sundays in a given year.
Use datetime module to find and print all Sundays of the year.
The full exam-length answer is in the app.
Create a user defined module with simple functions for: addition, subtraction, multiplication, division, modulo, square, factorial.
Define functions in a .py file and import it to use.
The full exam-length answer is in the app.
Develop an automated censor program that reads the text from a file and creates a new file where all of the four-letter words have been replaced by “****”.
Read file, replace words, and write to a new file.
The full exam-length answer is in the app.
Develop a program that reads a text file and calculates the average word length and sentence length in that file.
The program reads a file, counts words and sentences, then calculates averages.
The full exam-length answer is in the app.
Write a Python program to check whether a given string is palindrome or not.
A palindrome check can be done by comparing the string to its reverse.
The full exam-length answer is in the app.
Write a program to display the Fibonacci sequences up to n^{th} term where n is provided by the user.
Use a loop to generate Fibonacci numbers until the n^{th} term.
The full exam-length answer is in the app.
Write a program to check palindrome number.(example- 13231-palindrome 1201-not palindrome)
Check if the string is equal to its reverse.
The full exam-length answer is in the app.
Given a two list of numbers, write a program to create a new list such that the new list should contain even numbers from the first list and odd numbers from the second list. L1=[12,15,30,42,35] L2=[34,23,77,50,32] Expected output: Result list=[12,30,42,23,77]
Filter even from L1 and odd from L2, then combine.
The full exam-length answer is in the app.
Write a program to define module to find sum of two numbers. Import module to another program.
Define a function in a module and use import to access it.
The full exam-length answer is in the app.
List testing functions in string. Explain any five testing functions with example.
Functions include isalpha(), isdigit(), isalnum(), isspace(), and istitle().
The full exam-length answer is in the app.
List file modes with their description(any seven modes).
Modes include 'r', 'w', 'a', 'r+', 'w+', 'a+', 'x'.
The full exam-length answer is in the app.
List out arithmetic operations. Build python code that performs three arithmetic operations.
Arithmetic operations include addition, subtraction, multiplication; code example demonstrates these operations.
The full exam-length answer is in the app.
Create a Python program to display the following patterns using loop concept. * * * * *
The program uses nested loops to print the star pattern.
The full exam-length answer is in the app.
Write a Python program to perform the below operations on the list: Read n numbers from a user, Find positive numbers, Find negative numbers.
The program reads numbers, filters positive and negative ones.
The full exam-length answer is in the app.
Create a user-defined module with a simple functions for finding the area of a square, circle and rectangle. Write a program to import the module and access functions defined in the module.
The module contains area functions; program imports and uses these functions.
The full exam-length answer is in the app.
Write a Python program that reads a text file and counts the occurrences of each alphabet in the file. The program should prompt the user to enter the filename.
The program reads a file and counts letter occurrences, prompting for filename.
The full exam-length answer is in the app.
Explain how to create Dictionary in Python. Write a Python program to concatenate two dictionaries into a new one.
Dictionaries are created using {} or dict(); program shows concatenation.
The full exam-length answer is in the app.
Write output of following. 1. print(6-10/2+1) 2. if n=4, what is n**3? 3. print(5.5//2) 4. print(5.5/2)
Outputs: 3.0, 64, 2.0, 2.75
The full exam-length answer is in the app.
Explain usage of given string methods i) swapcase() ii) replace() iii) rstrip() iv) upper()
swapcase() toggles case, replace() substitutes substrings, rstrip() removes trailing whitespace, and upper() converts to uppercase.
The full exam-length answer is in the app.
Explain usage of given string methods in Python. ▪ islower ( ) ▪ isupper ( ) ▪ isdigit ( ) ▪ isalnum ()
The methods islower(), isupper(), isdigit(), and isalnum() are used to check the case and type of characters in a string.
The full exam-length answer is in the app.
Explain in detail about control flow structures in python.
Control flow structures include if, for, while, allowing conditional and iterative execution.
The full exam-length answer is in the app.
Write the syntax and usage of for loop.
for variable in iterable: # code block
The full exam-length answer is in the app.
List built-in Dictionary functions with description.
Functions include keys(), values(), items(), get(), and pop().
The full exam-length answer is in the app.
Differentiate between a package and a module in python.
A module is a single file, while a package is a collection of modules.
The full exam-length answer is in the app.
Differentiate between text file and binary file.
Text files store data in human-readable format, while binary files store data in a format readable by the machine.
The full exam-length answer is in the app.
Write a program to reverse string.
Use slicing or a loop to reverse the string.
The full exam-length answer is in the app.
Define selection statement. Explain any one in detail.
A selection statement executes code based on conditions; e.g., if-else.
The full exam-length answer is in the app.
Describe range function with example.
Range generates a sequence; e.g., range(5) produces [0, 1, 2, 3, 4].
The full exam-length answer is in the app.
Explain methods of python list with example.
List methods include append(), remove(), and sort(); e.g., myList.append(5).
The full exam-length answer is in the app.
Explain operation of Set in Python by giving example.
Sets are unordered collections; e.g., set([1, 2, 3]) creates a set.
The full exam-length answer is in the app.
What is package? How to Create and import package. Explain with example.
A package is a collection of modules; use __init__.py to create one.
The full exam-length answer is in the app.
List out types of plots in Matplotlib. Explain any one with example.
Types include line, bar, scatter; e.g., plt.plot(x, y) for line plot.
The full exam-length answer is in the app.
Explain usage of given string methods i) startswith() ii) find() iii) count() iv) index().
startswith() checks prefix; find() locates substring; count() counts occurrences; index() finds position.
The full exam-length answer is in the app.
Explain while loop with a suitable example.
while loop continues until a condition is false; example demonstrates its use.
The full exam-length answer is in the app.
Explain a random module of Python with a suitable example.
The random module generates random numbers; example shows its usage.
The full exam-length answer is in the app.
Explain to access string elements using index operator with a suitable example.
Index operator [] accesses elements by position; example shows its use.
The full exam-length answer is in the app.
Explain the usage of given file handling methods in Python. ▪ read ( ) ▪ readline ( ) ▪ readlines ( )
The methods read(), readline(), and readlines() are used to read data from files in Python.
The full exam-length answer is in the app.
Explain read(), readline() and readlines() for file with example.
read() reads the entire file, readline() reads one line, and readlines() reads all lines into a list.
The full exam-length answer is in the app.
Explain for loop with example.
A for loop iterates over a sequence; e.g., for i in range(5): print(i).
The full exam-length answer is in the app.
Explain break, continue, and pass statement with suitable example.
Break exits a loop, continue skips to the next iteration; pass does nothing.
The full exam-length answer is in the app.
Write down the properties of dictionary in python.
Dictionaries are unordered, mutable, and indexed by keys.
The full exam-length answer is in the app.
Write the difference between Tuple and List in python.
Tuples are immutable; lists are mutable.
The full exam-length answer is in the app.
Define function. Why do we need it?
A function is a reusable code block; it promotes code modularity.
The full exam-length answer is in the app.
What is Recursion? Explain with example.
Recursion is a function calling itself; e.g., factorial(n) = n * factorial(n-1).
The full exam-length answer is in the app.
Explain write(), append() and writelines () for file with example.
write() overwrites, append() adds, writelines() writes multiple lines.
The full exam-length answer is in the app.
List out features and application of python.
Features include simplicity, readability, and extensive libraries; applications range from web development to data science.
The full exam-length answer is in the app.
Explain if and if-else statement with a suitable example.
if checks a condition; if-else provides an alternative path.
The full exam-length answer is in the app.
Explain how to create a Set in Python by giving example.
A Set is created using set() or curly braces; example shows its creation.
The full exam-length answer is in the app.
Explain file handling basic Python function to open and close the text file.
open() opens a file, close() closes it; example demonstrates both.
The full exam-length answer is in the app.
Define Identifier. State rules of identifier.
An identifier is a name used to identify a variable, function, class, module, or other object.
The full exam-length answer is in the app.
What is break statement and continue statement in python?
break terminates the loop, while continue skips the current iteration.
The full exam-length answer is in the app.
Explain syntax of following statements. - If else - If elif else
if condition: # code else: # code for else.
The full exam-length answer is in the app.
The full Veda Bites deck, complete notes, spaced-repetition flashcards, leveled MCQs, tests and games for this kit — plus Daily Facts and the Arena, every day.