0% found this document useful (0 votes)
62 views5 pages

Python Class 7 Q&A Guide

Uploaded by

VISHAL SHINDE
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)
62 views5 pages

Python Class 7 Q&A Guide

Uploaded by

VISHAL SHINDE
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

DNYANSAGAR ARTS AND COMMERCE COLLEGE, BALEWADI, PUNE – 45

Subject: 504 : Python CLASS: TYBBA(CA) V SEM (2019 PATTERN)

Unit 1: Introduction to Python

Q:1 ) Answer the following questions in short:

1. Which are data types in Python?


2. What are the types of variables?
3. Which are the different conditional statements?
4. What is looping?
5. What is Operator?
6. List out python basic operators.
7. List out Loop control statements.
8. What is difference between Xrange and range?
9. What is string slice?
[Link] are the different types of function?

Q:2) Answer the following question in brief:

1. Explain Loop control statements used in python?


2. Write a python program to display Fibonacci series.
3. Write a python program to check whether number is even or odd.
4. Write a python program to display prime numbers between given range.
5. Which are special operations in string?
6. How to create and access elements in list.
7. How to access values in tuples?
8. How to access dictionary elements?
9. Write a program to calculate simple interest.
[Link] a program to swap numbers.

Prof. Gayatri [Link] [Link]


DNYANSAGAR ARTS AND COMMERCE COLLEGE, BALEWADI, PUNE – 45

Subject: 504 : Python CLASS: TYBBA(CA) V SEM (2019 PATTERN)

Unit 2 : Modules and Packages

Q:1 ) Answer the following questions in short:

1. What is module? Write the steps of creating the module.


2. What is the use of import statement?
3. Name any five built in modules in python.
4. What is the use of math module?
5. Write any three function of math module.
6. State any five functions of time module.
7. State three variable used by sys module.
8. Which package is used for 2D graphics in python?
9. What is the use of random function?
[Link] are the advantages of using Matplotlib library?

Q:2) Answer the following question in brief:

1. Write the use of import statement with an example.


2. Which are the 3 different ways to import modules in python?
3. Explain math and cmath Modules in detail.
4. Explain the sys module in detail.
5. Explain the features of Numpy.
6. Difference between numpy array and list.

Prof. Gayatri [Link] [Link]


DNYANSAGAR ARTS AND COMMERCE COLLEGE, BALEWADI, PUNE – 45

Subject: 504 : Python CLASS: TYBBA(CA) V SEM (2019 PATTERN)

Unit 3: Classes, Objects and Inheritance.

Q.1) Answer the following questions in short:

1. Define Class, Object.

2. Write syntax of class.

3. What is Class variables?

Q.2 Answer the following Questions:

1. Writ benefits of Inheritance.

2. Python program to create a class which performs Basics calculator operations.

Prof. Gayatri [Link] [Link]


DNYANSAGAR ARTS AND COMMERCE COLLEGE, BALEWADI, PUNE – 45

Subject: 504 : Python CLASS: TYBBA(CA) V SEM (2019 PATTERN)

Unit 4 : Exception Handling.

Q.1 Answer the following question in short:


1. What is Exception in Python?
2. What is assertion?
3. What is the use of try finally clause.
4. Writ syntax of raise statement and explain it.
[Link] out standard built in exceptions.

Q.2 Answer the following Questions:


1. Which are built in exceptions in python?
2. How to handle exception in pyton?
3. Explain except clause with no exceptions.
4. Explain user defined exceptions.
5. Which are standard expectations?

Prof. Gayatri [Link] [Link]


DNYANSAGAR ARTS AND COMMERCE COLLEGE, BALEWADI, PUNE – 45

Subject: 504 : Python CLASS: TYBBA(CA) V SEM (2019 PATTERN)

Unit 5 GUI Programming

Q.1 Answer the following question in short.


1. Name the different tools python provides for developing graphical user
interface.
2. What is the purpose of tinkter?
3. List out geometry management methods.
4. Define Tkinter
2. Geometry management
5. List out any 5 button option.
6. List out any 5 label opetion.

Q.2 Answer the following question in Long.


1. Explain label widget in tkinker with an example.
2. Explain entry widgt in tkinker with an example.
3. Explain the following with proper syntax and example.
[Link], [Link]

Prof. Gayatri [Link] [Link]

Common questions

Powered by AI

'range' and 'xrange' in Python 2.x both generate lists of numbers used in loops, but 'range' returns a list while 'xrange' returns an 'xrange' object, which is not a list but behaves like one. 'xrange' generates numbers on the fly and thus is more memory efficient than 'range,' which constructs the entire list at once. In Python 3, 'xrange' was renamed to 'range' and the original 'range' was removed, so 'range' in Python 3 has 'xrange'-like behavior .

The 'math' module provides mathematical functions for real numbers, such as trigonometric functions and logarithms. In contrast, the 'cmath' module focuses on complex numbers, offering similar functions but adapted for complex inputs. While 'math' is used for standard arithmetic applicable to real-number applications, 'cmath' supports operations including square roots of negative numbers and angles in radians for complex calculations. Choosing between them depends on whether the application involves real numbers or requires handling complex numbers .

Exception handling in Python involves the use of 'try', 'except', 'finally', and 'raise' statements to manage errors gracefully. User-defined exceptions can be created by defining a new class that inherits from the base 'Exception' class. This can provide specialized behavior or error messages tailored to specific conditions in a program. For example, define a class 'MyError(Exception):' with custom behavior and then raise it using 'raise MyError("An error occurred")' when a particular error condition is met .

Assertions are used in Python to verify assumptions during code execution and are implemented using the 'assert' statement. They are primarily used as a debugging aid as they halt program execution when an expression evaluates to false, prompting immediate response to incorrect program states. This helps in identifying logical errors promptly, ensuring code reliability. When 'python' is run with optimization, assertions can be ignored, which should be considered in deployment environments .

Loop control statements in Python, such as 'break', 'continue', and 'pass', are used to control the execution of loops. 'break' exits a loop prematurely, 'continue' skips the rest of the code inside a loop for the current iteration and moves to the next iteration, and 'pass' acts as a placeholder when a statement is required syntactically but no action is desired. These statements allow developers to fine-tune loop execution and control flow according to specific conditions .

The 'sys' module in Python provides access to some variables used or maintained by the interpreter and functions that interact with the interpreter. Common uses include 'sys.argv' for command-line arguments, 'sys.exit()' to terminate the program, 'sys.path' for module search path configuration, and 'sys.version' to retrieve Python version information. These functionalities allow deep interaction with the Python runtime environment, crucial for writing scripts that react dynamically to execution context .

Matplotlib provides a wide range of plotting capabilities, making it a powerful choice for generating static, interactive, and animated 2D graphs in Python. It offers extensive customization options for charts and plots, is highly compatible with NumPy, and seamlessly integrates into scientific computing environments. Its versatility in visual representation helps developers convey complex data insights clearly and effectively .

The import statement in Python is used to include the functionality of external modules into a Python script. There are three ways to use it: 1) 'import module_name' allows access to the module's functions/variables with 'module_name.' prefix, 2) 'from module_name import function_name' allows direct access to specified functions without module prefix, and 3) 'from module_name import *' imports all public attributes, allowing direct access without prefixes. Each method suits different scenarios based on the need for namespace management .

Inheritance in Python allows a class to inherit attributes and methods from another class, promoting code reusability and organization. It simplifies complex systems by allowing hierarchical classification, enabling new objects to be created that extend existing functionality without code duplication. It also facilitates polymorphism, where different subclasses can define their own behaviors for methods, allowing flexible and dynamic code management .

In Python, tuples are immutable, meaning once they are created, their values cannot be changed, whereas lists are mutable, allowing modifications. This immutability can enhance data integrity as it prevents accidental changes to data, making tuples a safer choice for handling fixed collections of items, especially when consistency across different parts of a program is critical. This immutability also makes tuples hashable, allowing their use as dictionary keys .

You might also like