0% found this document useful (0 votes)
77 views2 pages

Python Programming Question Bank II BCA

This document contains Python programming question banks for Class 2 BCA divided into two units. The first unit contains questions ranging from 2 to 10 marks on topics like Python features, variables, data types, operators, control flow statements, functions and recursion. The second unit focuses on string, list, tuples, sets, dictionaries, exceptions, modules and packages with questions from 2 to 10 marks. The document provides a comprehensive set of questions to test students' understanding of core Python concepts.

Uploaded by

tn
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)
77 views2 pages

Python Programming Question Bank II BCA

This document contains Python programming question banks for Class 2 BCA divided into two units. The first unit contains questions ranging from 2 to 10 marks on topics like Python features, variables, data types, operators, control flow statements, functions and recursion. The second unit focuses on string, list, tuples, sets, dictionaries, exceptions, modules and packages with questions from 2 to 10 marks. The document provides a comprehensive set of questions to test students' understanding of core Python concepts.

Uploaded by

tn
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

PYTHON PROGRAMMING

QUESTION BANK
Class: II BCA
UNIT I
2 MARKS
1. List out the features of Python.
2. Define variables in python.
3. What are the data types available in the python?
4. What is interpreter?
5. Why to use python.
6. Write short notes on comments in Python.
7. How to print a string in Python?
8. Write the syntax of if else statement in Python.
9. Define function in Python.
10. List any two built-in functions in Python.
11. Differentiate with and without lambda function.
12. Write syntax of user defined function.

5 MARKS
1. Explain the features of Python.
2. Discuss about Python data types.
3. How to use variables in Python?
4. Explain about Python input/output statement.
5. How to use break and continue in loops?
6. What is the purpose of if elif else statement in Python?
7. Explain user defined function in Python.

10 MARKS
1. Briefly discuss about Operators in Python.
2. Describe about the looping statement in Python.
3. Explain about data types in Python.
4. Write notes on lambda function in Python.
5. Explain about function and it’s argument types with example.
6. Write a Python program for find the factorial using recursion.
PYTHON PROGRAMMING
QUESTION BANK
Class: II BCA
UNIT II
2 MARKS
1. How to count string length in python?
2. What is string slicing?
3. List out any four string function in Python.
4. Define list in Python.
5. How remove list item?
6. List out any three methods in list.
7. What is the purpose of append method in list?
8. What is tuples in Python?
9. Define sets in Python.
10. What is the difference between sets and list?
11. Write short notes on dictionary in Python.
12. How to change values in dictionary?
13. What is the use of key in dictionary?
14. Define error.
15. What is an exception in Python?
16. How to use user defined exception in Python?
17. What is the purpose of module in Python?
18. List out the any two modules in Python.
19. Define package in Python.

5 MARKS
1. Write notes on string in Python.
2. How add and remove the items in list?
3. How to delete and change the values in dictionary?
4. Explain about user defined exception with example.
5. Discuss about package in Python.
6. How to use date module in Python?
7. Explain about modules in Python.
8. Discuss about tuples in Python.

10 MARKS
1. Briefly discuss about string functions in Python.
2. Write a Python program for string operations.
3. Describe about sets in Python.
4. Discuss about dictionary in Python.
5. Explain about try and catch blocks in Python with example.
6. Write a Python program print the calendar using module.
7. Explain about list in Python.

Common questions

Powered by AI

The 'break' statement is used to terminate the loop prematurely and transfer control to the first statement after the loop. Conversely, the 'continue' statement skips the rest of the code inside the loop for the current iteration and jumps to the start for the next iteration. Both enhance control flow within loops, but they serve different purposes: 'break' exits the loop entirely, while 'continue' skips the current loop iteration .

Sets in Python are used for tasks that require collection of unindexed, unordered, and non-duplicative items. They are ideal for operations like membership testing, eliminating duplicate entries, or set operations such as union, intersection, and difference, which are both mathematically based and relevant for logical data handling .

Python is preferred due to its simplicity and readability, making it easy to learn for beginners. It supports multiple programming paradigms such as procedural, object-oriented, and functional programming, which is appealing to experienced programmers. Additionally, Python offers a vast standard library that supports many common programming tasks, and its rich set of third-party modules enhances functionality .

Lambda functions in Python are anonymous, in-line functions defined with the lambda keyword, allowing the definition of small, one-expression functions without formally naming them. Unlike regular functions defined using the def keyword, lambda functions are limited to a single expression without any logical checks or multi-statement functionality, making them ideal for short-term use cases such as callbacks or as arguments to high-order functions .

Python handles exceptions using try and except blocks, allowing developers to catch and manage errors gracefully rather than letting the program crash. This mechanism is crucial for writing robust code as it enables developers to provide meaningful error messages, perform necessary clean-up actions, and ensure the program executes as expected in the face of unexpected conditions .

Comments in Python, initiated by the # symbol, are used to make annotations in code to increase its readability and maintainability. They help other programmers understand the purpose and logic behind code sections, making it easier to update and debug code over time, and ensure efficient teamwork in collaborative projects .

Packages and modules help organize Python code by logically grouping related functionalities into a directory hierarchy. This promotes code reusability and maintainability, reduces redundancy, and allows for concise program organization. Packages are collections of modules, and they simplify the inclusion and distribution of related modules across various projects, enhancing modularity .

To update entries in a dictionary, assign a new value to an existing key, e.g., `dict[key] = new_value`. To delete an entry, use the `del dict[key]` statement. These operations allow for dynamic modifications of dictionary data, key-value visualization, and ensure the data structure can be adjusted per program needs .

In Python, variables are dynamically typed, meaning that the variable type is determined at runtime, which allows variables to change types during execution. This is different from statically typed languages where the type is declared and fixed. Python uses dynamic typing for flexibility and ease, which can lead to fewer lines of code .

A dictionary in Python, which maps keys to values, is preferred when there is a need for fast direct lookups or when data needs to be accessed by a unique key. Lists, which store ordered collections of items, are beneficial when the data order should be preserved or when the data is accessed via index. Dictionaries serve better in scenarios requiring efficient retrieval and dynamic associations of data .

You might also like