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

Python_QB2

The document covers various topics related to Python programming, including operators, control statements, arrays, and NumPy functionalities. It provides definitions, examples, and explanations of concepts such as operator precedence, input/output statements, loops, and mathematical functions. Additionally, it discusses array manipulation, including indexing, slicing, and operations in NumPy.

Uploaded by

veena more
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)
1 views5 pages

Python_QB2

The document covers various topics related to Python programming, including operators, control statements, arrays, and NumPy functionalities. It provides definitions, examples, and explanations of concepts such as operator precedence, input/output statements, loops, and mathematical functions. Additionally, it discusses array manipulation, including indexing, slicing, and operations in NumPy.

Uploaded by

veena more
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/ 5

UNIT-2

1. What is the difference between = and == operators in Python?


2. What are operators?
3. Write an example of a unary minus operator in Python.
4. What is the purpose of the is operator in Python?
5. Differentiate between membership operators in and not in with
examples.
6. Explain the difference between logical and and bitwise & operators.
7. What is operator precedence? Give an example.
8. What is the associativity of the exponentiation operator ** in
Python?
9. Write the result of the expression 3 + 4 * 2 / (1 - 5) ** 2 based on
precedence rules.
10. Name any two mathematical functions in Python.
11. How do you execute a Python program using the system prompt?
12. Write the syntax of an output statement in Python.
13. How do you accept input from the user in Python?
14. What data type is returned by the input() function?
15. What is the purpose of sys.argv in Python?
16. Write the syntax of an if statement in Python.
17. What is the difference between if...else and if...elif...else?
18. Write a simple while loop that prints numbers from 1 to 5.
19. What is an infinite loop? Give an example.
20. What is the purpose of the break statement? Provide an example.
21. How does the continue statement affect loop execution?
22. What does the pass statement do in Python?
23. What is an assert statement? Give an example.
24. What is the use of the return statement in Python functions?
25. Write an example of a nested loop.
26. What is an array? How is it different from a list?
27. Mention any two advantages of using arrays.
28. How do you create an array using the array module?
29. Write an example of array indexing and slicing.
30. Name two types of arrays in Python.
31. What is NumPy? Why is it used?
32. How do you create a NumPy array using the array() function?
33. What is the purpose of linspace() function in NumPy?
34. Write a code snippet to create an array using arange() function.
35. What is the difference between zeros() and ones() functions in
NumPy?
36. How do you perform element-wise addition of two arrays in NumPy?
37. What is aliasing of arrays? Explain with an example.
38. How can you view and copy a NumPy array?
39. How do you find the dimensions of a NumPy array?
40. What does the reshape() method do in NumPy?
41. Explain the flatten() method with an example.
42. How do you index a multi-dimensional array?
43. How do you slice a 2D array in NumPy?
44. How do you create a matrix using NumPy?
45. Write a code snippet to get the diagonal elements of a NumPy
matrix.
46. How do you find the maximum and minimum elements in a NumPy
array?
47. Write a function to find the sum and average of elements in an
array.
48. How do you sort a NumPy matrix?
49. What is the difference between matrix addition and matrix
multiplication in NumPy?
50. Write a code snippet to transpose a matrix in NumPy.
5 and 10 Marks Questions

1. What are operators ? Explain different types of Operators with


example.

2. What is operator precedence ? List out all Operators starting with


higher precedence.

3. What are Mathematical functions ? In how many varieties we can


import mathematical functions?

4. List out all Different Mathematical Functions with description and


examples.

5. Which are the different Output statements? Explain with example.

6. Which are the different Input statements? Explain with example.

7. Explain Command Line Arguments with example.

8. What are Control Statements? List out all Control Statements.


9. Explain the below Statements with syntax and example.
a)if statement
b)if….else statement
c)if…..elif….else Statement
d)While loop
e)for loop
f)Infinite loop
g) Nested loop
h) else suite
i)Indentation
j)break Statement
k)continue Statement
l)pass statement
m)assert statement
n)return statement

10) What are Arrays? State the advantages of array.


11)How to create array explain with example.
12)Which are the different types of importing array module explain
with example?
13)Explain with example Slicing and Indexing Array.
14)Explain in detail working with numpy in arrays with subtypes.
15)Explain Mathematical Operation in Array with example.
16)How do you Compare Arrays in Python? Explain with example
including all subtypes.
17)Explain with example Aliasing Array, Viewing array and Copying
Array.
18)Explain with example Slicing and Indexing in umpy Arrays in
1Dimensional and 2 Dimensional Arrays.

19)What is Dimensions of Array? Explain the different Attributes of


Dimensions Array.

20)Explain Working with Multidimensional Array with example and


Different ways(Subtypes).
21)What is Indexing and Slicing in Multidimensional Array with
example.

22)Write a short note on(With example)


a)Processing Arrays
b)Types of Arrays
c)reshape() Method
d)flatten() Method
e)Matrices in Numpy
f)Getting diagonal elements of a Matrix
g)Finding Maximum and Minimum elements
h)Find sum and Average of elements
i)Product of Elements
j)Sorting the matrix
k)Transpose of Matrix
l)Matrix addition and Multiplication

You might also like