Python 1 Mark Questions

Complete Study Guide for Quick Revision

Python Basics

1. PVM stands for ______
Python Virtual Machine
2. Who developed Python?
Guido van Rossum
3. _____ extension represents Python Compiled File
.pyc
4. IDLE stand for _______
Integrated Development and Learning Environment
5. The _____ symbol is a shell prompt in python.
>>> (triple greater than)
6. _____ default extension of python file.
.py
7. ___ is/are container(s) for strong basic data value(s).
Variables

Data Types & Operations

8. List out standard data types of Python.
int, float, complex, str, bool, list, tuple, dict, set
9. List out string operators.
+ (concatenation), * (repetition), in (membership), not in (membership), == (equality), != (inequality), <, >, <=, >= (comparison)
10. Which function is used to count the substring?
count()
11. _____ method read string from the an open file in python.
read()

Object-Oriented Programming

12. Wrapping data into a single unit is called _____
Encapsulation
13. ADT stands for _________
Abstract Data Type
14. ______ has a brief description about the class.
Docstring

Functions & Exception Handling

15. What is a Python function?
A Python function is a reusable block of code that performs a specific task and can be called by name to execute that task.
16. Which keyword is used to define a user define function?
def
17. List out any 5 standard exceptions.
ValueError, TypeError, IndexError, KeyError, NameError
18. _______ exception catch all exception in python.
Exception
19. _____ catches all exceptions.
Exception
20. _____ statement forces exception to occur.
raise
21. The ____ Block Executes code regardless of whether an exception occurs or not.
finally
22. _____ error is raised when division or modulo by zero takes a place for all numeric types
ZeroDivisionError

Data Visualization (Matplotlib/PyLab)

23. Pl.plot(x,y,'r') here r means _____
Red color
24. Pl.plot(x,y,'- -') here - - means _______
Dashed line style
25. Which method is used to show the informative titles?
title()
26. Which method is used to display the graph on screen?
show()
27. PyLab is embedded with _____ module of python.
matplotlib
28. The ___() Function is used to create a new figure in pyLab.
figure()
29. The ___() Function is used to Display a plot on the screen in PyLab.
show()
30. The ___() Function is used to save a plot as a PNG file in PyLab.
savefig()
31. _____ function is used to display chart/figure
show()

Algorithms & Data Structures

32. List out different sorting algorithms.
Bubble Sort, Selection Sort, Insertion Sort, Merge Sort, Quick Sort, Heap Sort, Radix Sort, Counting Sort
33. Who invented dynamic programming?
Richard Bellman
34. Dynamic programming is mainly an optimization over plain _______.
recursion
35. An Example of a sorting algorithm that use the divide-and-conquer approach is ___ sort.
merge

File Formats & Data Processing

36. JSON stand for ______.
JavaScript Object Notation
37. XML full form
eXtensible Markup Language
38. CSV stand for ______.
Comma Separated Values
39. Give full form of png.
Portable Network Graphics
40. Which package is used for data analysis and manipulation?
pandas
41. Which function is used to fill and handle missing data in dataframes?
fillna()
42. What is a data frame?
A data frame is a two-dimensional labeled data structure with rows and columns, similar to a table or spreadsheet, used for storing and manipulating structured data.

Regular Expressions

43. Which library is imported for regular expression?
re
44. Which metacharacter is used for zero or more occurrences?
* (asterisk)
45. RegEx stand for ______.
Regular Expression
46. If there is no match _____ will be returned, instead of the Match object.
None

Machine Learning Metrics

47. ROC stand for __________
Receiver Operating Characteristic
48. MAE stand for ______
Mean Absolute Error
49. AUC stand for ______
Area Under the Curve
50. MSE stand for __
Mean Squared Error

Network Programming

51. Give the full form of IP.
Internet Protocol
52. TCP stands for _________
Transmission Control Protocol
53. Which method is used to create socket?
socket()
54. Which library is to be imported for sending the mail?
smtplib
55. The ___ Module is Commonly used socket programming to handle network connection.
socket
56. The ___ Method is used to associate the socket with a specific network interface and port number.
bind()
57. The ___ Protocol is used to send email over the internet.
SMTP
58. The "socket.gethostname()" function in python returns the ___ of the machine.
hostname

Database Operations

59. SQL stands for ____________
Structured Query Language
60. Which method saves the changes made to the database?
commit()
61. Which library is to be imported for connecting with database?
sqlite3
62. Which function/attribute is used to get the last row inserted id?
lastrowid
63. The Method ____() is used to establish a connection to a database.
connect()
64. The Method ____() is used to execute an SQL command.
execute()
65. The Method ____() is used to fetch all result by a query from database.
fetchall()

GUI Programming (Tkinter)

66. The Method ____() is used to set layout widgets in a grid form in Tkinter.
grid()