About Us Website: [Link]
com/ Feedback 8076665624
Learnpython4cbse Youtube Channel:
Inspiring Success SuperNova@learnpython4cbse
PYTHON ONLINE CLASSES COMPUTER SC. INFORMATICS PRAC. SAMPLE PAPERS PYTHON MCQs
Important Computer Science Class 12 Viva Questions For Projects
1. Tell me about your project.
2. Which concepts you have used for your project?
3. What are the software and minimum hardware required for your project?
4. How were you attracted to this project?
5. Tell about the existing system.
6. What is your proposed system to overcome the problems faced in the existing
system?
7. What is the future scope of your project?
8. What are the limitations of your project?
9. Which books/ study material websites you have used while making this
project?
10. What are your learning from this project?
11. Which skills you have acquired/enhanced by doing this project?
12. How to read , write, modify and delete the records from the Database using
python or from the CSV file?
13. Give the name of database and table used in the project or the file name(if CSV
file is uded).
Python Viva Questions with Answers
Q1. Brief introduction to your project?
Inventory management ( Explain Your Project) is all about tracking and controlling of
business inventory right from manufacturing, buying to storing and using. It controls the
entire flow of goods from purchasing to sale and ensures that you always have the right
quantities of the right item in the right location at the right time.
Q2. Objective of project?
Page 1 of 15 Website: [Link]
About Us Website: [Link] Feedback 8076665624
Learnpython4cbse Youtube Channel:
Inspiring Success SuperNova@learnpython4cbse
PYTHON ONLINE CLASSES COMPUTER SC. INFORMATICS PRAC. SAMPLE PAPERS PYTHON MCQs
Provide function to manage goods in the store more efficiently.
Provide searching facility based on various factors.
Reduce time and cost to control and manage inventory.
Reduce paperwork.
Increased accuracy and reliability.
Increased Data Consistency.
Q3. How did you make your project?
I made this project using Python and MySQL. I used Python to make Front end and
MySQL for Data Store.
Q4. Discuss about Frontend and Backend of the software in short.
Frontend- basically front end of any software refers to interface of the software through
which user interact with the application. Generally an programming language or tool is
used to make front end.
Backend- backend of any software is refers to data store of the software where all data
resides. Generally a RDBMS is used as backend of any software.
Q5. Can we use python as Backend and MySQL as Frontend?
No, we cannot use python as back end of any application because it is a programming
language which is used for developing application interface and logic of the software.
Similarly MySQL cannot be used as Front end because it is responsible for managing data
of any program or software.
Q6. Can we make this project without using MySQL? If no, why?
Yes we can make our project without using MySQL but it won’t be effective as we will not
be able to store data permanently.
Q7. Can we use CSV file or any other software with python to make this project?
Yes, we can use CSV or any other application as backend with python for our project.
Q8. What is MySQL Connector/Python?
MySQL Connector/Python is a standardized database driver provided by MySQL. It is used
to access the MySQL database from Python.
Q9. What are the five major steps for connecting MySQL and Python?
Page 2 of 15 Website: [Link]
About Us Website: [Link] Feedback 8076665624
Learnpython4cbse Youtube Channel:
Inspiring Success SuperNova@learnpython4cbse
PYTHON ONLINE CLASSES COMPUTER SC. INFORMATICS PRAC. SAMPLE PAPERS PYTHON MCQs
There are five major steps for connecting MySQL and Python.
• Import MySQL connector
• Open a connection to a database
• Create a cursor object
• Execute a query
• Close the connection
Q10. How do we create a connection object?
Connection object is created with the help of connect() function. The connect() function of
[Link] package is used to establish a connection to MySQL database.
For example:
conn1 = [Link](host='localhost', database='test', user='root',
password='tiger')
Here, [Link] is a MySQL-python library function that creates the
connection and returns a connection object, conn1. It connects to a specific MySQL
database (test in this case) using the given host (localhost in this case), username (root
in this case) and password (tiger in this case).
Q11. How do we create a cursor object?
The connection object returned by the connect() method is used to create a cursor object.
You can create a cursor object using the cursor() method of the connection object/class.
The cursor object is used to execute statements to perform database operations. Foe
example:
cursor1 = [Link]()
Here, cursor1 is a cursor object created using connection object conn1 using cursor()
method.
Q12. How do we execute SQL query through Python?
To execute SQL queries through Python, cursor object is used along with execute()
method. For example:
[Link]("select * from emp;")
Here, cursor1 is a cursor object which uses execute method to run the SQL query.
Page 3 of 15 Website: [Link]
About Us Website: [Link] Feedback 8076665624
Learnpython4cbse Youtube Channel:
Inspiring Success SuperNova@learnpython4cbse
PYTHON ONLINE CLASSES COMPUTER SC. INFORMATICS PRAC. SAMPLE PAPERS PYTHON MCQs
The sql query is given in the form of a string. The output of the SQL query is stored in the
cursor object in the form of a result set.
Q13. What is the difference between fetchall() and fetchnone() methods?
The fetchall() method fetches all rows of a result set and returns a list of tuples.
The fetchnone() method returns a single record as a list/ tuple and None if no more rows
are available.
Q14. What is the purpose of rowcount parameter?
It returns the number of rows affected by the last execute method for the same cur
object.
Q15. Which language translator is used by python?
Interpreter
Q16. What are the built-in types available in python?
Numbers, Strings, Lists, Tuples, Dictionaries
Q17. How python interpreter interprets the code?
Python interpreter interprets the code line by line.
Q18. Name a few mutable data types of python.
Lists, Sets, and Dictionaries
Q19. Name a few immutable data types of python.
Strings, Tuples, Numeric
Q20. What is the significance of a pass statement in python?
pass is no operation python statement. This is used where python requires syntax but
logic requires no actions.
Q21. What is slicing in python?
Python slicing is a statement of python that extracts a list of elements from the given
sequence in the range of start and stop values with step value intervals.
Q22. What are comments in python?
Page 4 of 15 Website: [Link]
About Us Website: [Link] Feedback 8076665624
Learnpython4cbse Youtube Channel:
Inspiring Success SuperNova@learnpython4cbse
PYTHON ONLINE CLASSES COMPUTER SC. INFORMATICS PRAC. SAMPLE PAPERS PYTHON MCQs
Python comments are nonexecutable text written in the python program to give a
description for a statement or group of statements.
Q23. How to print list l in reverse order in a single line statement?
print(l[::-1])
Q24. Python string can be converted into integer or float?
If the string contains only numbers it can be converted into an integer or float using int()
and float() functions.
Q25. What is the difference between / and //?
/ is used for division, // is used for floor division
/ returns float as answer whereas // returns integer as answer
/ gives you the number with decimal places whereas // gives you only integer part
Q26. How to check the variables stored in same object in python?
The id() function returns the memory address of python object.
Q27. What are the parameters of print() function? Explain.
The print function has three parameters:
1. message – Contains the message to be printed
2. sep – It is onptional parameter used to print a separator
3. end – It prints the endline character
Q28. What is the significance of ‘else’ in loops in python?
Else block is written in pyton progrm when loop is not satisfying the condition. It gets
executed when the while loop’s condition is false where as in for loop it executes when for
loop ends normally.
Q29. Divya is learning python. She wants to know the version of python using python
programming statements. Please help her to accomplish her task.
>>> import sys
>>> [Link]
Page 5 of 15 Website: [Link]
About Us Website: [Link] Feedback 8076665624
Learnpython4cbse Youtube Channel:
Inspiring Success SuperNova@learnpython4cbse
PYTHON ONLINE CLASSES COMPUTER SC. INFORMATICS PRAC. SAMPLE PAPERS PYTHON MCQs
Q30. How to remove the last element from a list?
To remove the last element from a list following ways can be used:
1. [Link]()
2. del l[-1]
Q31. What is the difference between append() and extend() methods?
append() is used to add an element to the list to the last.
extend() is used to add multiple elements to the list.
Q32. Consider the statement: L = [11,22,33,[45,67]], what will be the output of L[-
2+1}?
[45.67]
Q33. What is tuple unpacking?
Tuple unpacking refers to extracting tuple values into a separate variable.
Q34. What are the two ways to insert an element into dictionary?
Method 1 – Modifying a dictionary with fresh key and value ex. d={1:’A’,2:’B’}; d[3]=’C’
Method 2 – With a function setdefault ex. d={1:’A’,2:’B’};[Link](3,’C’)
Q35. John wants to remove an element by value. Suggest her a function name to
accomplish her task.
[Link](value)
Q36. How to remove all elements of a list?
There are two ways to remove all elements of list
1. Using clear – [Link]()
2. Using del – del l
Q37. How del is different from clear?
del removes entire list object where clear() just removes elements and makes list empty
Q38. What is a function?
Page 6 of 15 Website: [Link]
About Us Website: [Link] Feedback 8076665624
Learnpython4cbse Youtube Channel:
Inspiring Success SuperNova@learnpython4cbse
PYTHON ONLINE CLASSES COMPUTER SC. INFORMATICS PRAC. SAMPLE PAPERS PYTHON MCQs
A function is a subprogram and a smaller unit of a python program consists of a set of
instructions and returns a value.
Q39. Does every python program must return a value?
No, not every python program returns a value.
Q40. What are the parts of a function?
A python function has the following parts:
1. Function header – Starts with def keyword followed by function name and
parameters
2. Function body – Block of statements/instructions that define the action performed
by the function, indentation must be followed
3. Function caller statement – writing function name including parameter values
Q41. What are the needs of function in the python program?
Easy program handling
Reduce the size of the program
Reduce the repeated statements
Ambiguity can be reduced
Make program more readable and understandable
Q42. How to call your function through python interactive mode?
Save a program if not saved and click on Run > Run Module or press the F5 button from
the python script mode
Now interactive mode will appear with the message RESTART ……
Write a function call statement with function name and list of parameter values in the
brackets
A function call statement is just like a function name with required parameters
Press enter and supply input as per requirements
Q43. What are void functions? Explain with example?
Page 7 of 15 Website: [Link]
About Us Website: [Link] Feedback 8076665624
Learnpython4cbse Youtube Channel:
Inspiring Success SuperNova@learnpython4cbse
PYTHON ONLINE CLASSES COMPUTER SC. INFORMATICS PRAC. SAMPLE PAPERS PYTHON MCQs
The void functions are those functions that do not return any value.
Python function which does not contain any return statement and having a bunch of
different print statements are called void functions.
Python supports a special object “nothing” or None datatype.
Q44. Observe the following lines of code and identify function definition or function
caller statement:
myfun(“Learnpython4cbse”,2024) – function caller with positional arguments
myfun(name=”Learnpython4cbse”,year=2024) – function caller with default arguments
def myfun(name, year=2024) – function definition with default argument
myfun(name=”Learnpythin4cbse”,year) – function caller but reaise an error
Q45. What are the physical line and logical line structure in python program?
The physical lines in python programs contain EOL (End Of Line) character at the point of
termination of lines
The logical lines in python programs contain white spaces or tab or comment at the point
of termination of lines
Q46. What is indentation? Explain its importance in two lines.
Indentation refers to white spaces added before each line of the code.
In python, it detects the block of code.
It also makes the program more readable and presentable.
It organizes the code of blocks in a good manner.
Q47. What is a top-level statement in python?
The python unindented statements in python programs are considered as a top-level-
statement.
_main_ is also a python top-level statement
Q48. What are the comments? Explain the role of comments in the python programs?
Comments are non-executable parts of python programs.
Page 8 of 15 Website: [Link]
About Us Website: [Link] Feedback 8076665624
Learnpython4cbse Youtube Channel:
Inspiring Success SuperNova@learnpython4cbse
PYTHON ONLINE CLASSES COMPUTER SC. INFORMATICS PRAC. SAMPLE PAPERS PYTHON MCQs
You can write a comment for the description or information related to statements, basic
details of programs etc.
There are two types of comments:
Single-Line: These comments written for explaining single line comments, begins with #
Multi-Line: These comments written for explaining multi-line comments, begins and ends
with ”’ triple quotes
Q49. Does python program functions contain multiple return statements and return
multiple values?
Yes, python program functions can have multiple return statements.
To return multiple values you can write values with return keyword separated by comma
Q50. What do you mean by fruitful and non-fruitful functions in python?
The functions which return values are called fruitful functions.
The function not returning values are called non-fruitful functions.
Q51. Which three types of functions supported by python?
Python supports the following three types of functions:
1. Built-in Functions
2. Functions defined in modules
3. User-defined functions
Q52. What are parameters and arguments in python programs?
Parameters are the values provided at the time of function definition. For Ex. p,r and n.
Arguments are the values passed while calling a function. For Ex. princ_amt, r, n in
main().
Q53. Which types of arguments supported by Python?
Python supports three argument types:
1. Positional Arguments: Arguments passed to a function in correct positional order,
no. of arguments must match with no. of parameters required.
Page 9 of 15 Website: [Link]
About Us Website: [Link] Feedback 8076665624
Learnpython4cbse Youtube Channel:
Inspiring Success SuperNova@learnpython4cbse
PYTHON ONLINE CLASSES COMPUTER SC. INFORMATICS PRAC. SAMPLE PAPERS PYTHON MCQs
2. Default Arguments: Assign default to value to a certain parameter, it is used when
the user knows the value of the parameter, default values are specified in the function
header. It is optional in the function call statement. If not provided in the function call
statement then the default value is considered. Default arguments must be
provided from right to left.
3. Key Word Arguments: Keyword arguments are the named arguments with assigned
values being passed in function call statement, the user can combine any type of
argument.
4. Variable Length Arguments: It allows the user to pass as many arguments as
required in the program. Variable-length arguments are defined with * symbol.
Q54. What are the rules you should follow while combining different types of
arguments?
An argument list must contain positional arguments followed by any keyword argument.
Keyword arguments should be taken from the required arguments preferably.
The value of the argument can’t be specified more than once.
Q55. What do you mean by python variable scope?
The python variable scope refers to the access location of the variable defined in the
program.
A python program structure has different locations to declare and access the variable.
There are two scopes of variables in python:
1. Local Scope
2. Global Scope
Q56. What is the local and global scope variable?
The variable which is declared inside a function and can be accessible inside a function is
known as local variable scope.
The variable declared in top-level statements of the python program is called a global
variable scope, it is accessible anywhere in the program.
Q57. What is the full form of LEGB? Explain in detail.
Page 10 of 15 Website: [Link]
About Us Website: [Link] Feedback 8076665624
Learnpython4cbse Youtube Channel:
Inspiring Success SuperNova@learnpython4cbse
PYTHON ONLINE CLASSES COMPUTER SC. INFORMATICS PRAC. SAMPLE PAPERS PYTHON MCQs
LEGB stands for Local-Enclosing-Global-Buil-in.
Python checks the order of variable in a program by the LEGB rule.
First, it checks for the local variable, if the variable not found in local then it looks in
enclosing then global then built-in environment.
Q58. What are mutable and immutable arguments/parametersin a function call?
Mutable arguments/parameters values changed over the access of value and variable at
runtime.
Immutable arguments/parameters whose values cannot be changed. They allocate new
memory whenever the value is changed.
Q59. What are modules in python?
A large program is divided into modules.
A module is a set of small coding instructions written in a programming language.
These modules create a library.
A python module is a .py that contains statements, classes, objects, functions, and
variables.
That allows reusing them anytime by importing the module.
The structure of the python module plays an important role in python library functions.
Q60. Name few commonly used libraries in python.
Standard library
Numpy Library
Matplotlib
SciPy
Q61. What do you mean docstrings in python?
Docstrings is the triple quoted text of the python program.
It provides comments related to the authors of the program, details about functions,
modules, classes.
Page 11 of 15 Website: [Link]
About Us Website: [Link] Feedback 8076665624
Learnpython4cbse Youtube Channel:
Inspiring Success SuperNova@learnpython4cbse
PYTHON ONLINE CLASSES COMPUTER SC. INFORMATICS PRAC. SAMPLE PAPERS PYTHON MCQs
The docstrings contents written in the module can be accessed through help().
Q62. Is there any difference between docstrings and comments?
The docstrings and comments ignored by the python interpreter in execution.
But the docstring provides the information about modules, functions or classes which can
be accessed by help() function.
Q63. What is the use of dir() function?
The dir() function is used to display defined symbols in the module.
Q64. What are the two ways to import modules?
You can import modules in python using these two ways:
import <modulename>
from <module> import <object>
Q65. What is a file?
A file is a stream of bytes stored on secondary storage devices having an extension.
Q66. What are the different modes of opening a file?
The different modes of opening a file are as follows:
r,w,a,r+,w+,a+,rb,wb,ab,rb+,wb+,ab+
Q67. If no mode is specified in open() function, which mode will be considered?
Q68. What is the difference between “w” and “a” mode?
“a” mode adds the content to the existing file whereas “w” mode overwrites the contents
into the file.
Q69. What is the difference between readline() and readlines() function?
readline() function reads the content of the text file and returns the content into the string
whereas readlines() function reads the content of the text file and returns the content into
the list.
Page 12 of 15 Website: [Link]
About Us Website: [Link] Feedback 8076665624
Learnpython4cbse Youtube Channel:
Inspiring Success SuperNova@learnpython4cbse
PYTHON ONLINE CLASSES COMPUTER SC. INFORMATICS PRAC. SAMPLE PAPERS PYTHON MCQs
Q70. Parth wants to read only n number of characters from a text file. Suggest him a
function to accomplish his task.
The read(n) function can be used
Q71. Nakshatra wants to count no. of words from the text file. Suggest her code to
accomplish a task.
f=open(“[Link]”)
w=[Link]().split()
c=0
for i in w:
c+=1
print(c)
Q72. What are the two different types of text files?
Plain text or regular text files
Delimited text files or separated text files
Q73. What are full forms of: a) csv b) tsv
csv – comma separated values
tsv – tab-separated values
Q74. Are CSV files and Text Files same?
CSV files and Text Files are same in storage but csv file stores the data separated by a
delimiter.
Q75. What are the different valid delimiters?
, is default delimiter
other delimiters are tab – \t, colon – :, or semi colon – ;
Q76. What is pickling?
Pickling refers to the process of converting python object hierarchy into a byte stream to
write into a binary file.
Page 13 of 15 Website: [Link]
About Us Website: [Link] Feedback 8076665624
Learnpython4cbse Youtube Channel:
Inspiring Success SuperNova@learnpython4cbse
PYTHON ONLINE CLASSES COMPUTER SC. INFORMATICS PRAC. SAMPLE PAPERS PYTHON MCQs
Q77. What is unpickling?
It is the process of converting the byte stream back into an object hierarchy.
Q78. Which module is required to handle binary files?
pickle
Q79. Name the functions used to read and write data into binary files.
[Link](list_object, file_handle)
[Link](file_object)
Q80. Which error is reported while reading the file binary file?
ran out of input
Q81. How to avoid reading file errors in binary file?
By using exception handling with try and except blocks
Q82. What is the significance of tell() and seek() functions?
tell() function returns the current file position in a file
seek() function change the current file position
Q83. What is the default value of offset for seek function?
Q84. What is offset in the syntax of seek function?
Offset refers to the number bytes by which the file object is to be moved.
Q85. Nimesh is working on a stack. He started deleting elements and removed all the
elements from the stack. Name this situation.
Stack underflow
Q86. What are the operations can be performed on the stack?
Push
Pop
Page 14 of 15 Website: [Link]
About Us Website: [Link] Feedback 8076665624
Learnpython4cbse Youtube Channel:
Inspiring Success SuperNova@learnpython4cbse
PYTHON ONLINE CLASSES COMPUTER SC. INFORMATICS PRAC. SAMPLE PAPERS PYTHON MCQs
Peep or Peek
Q87. Which principle is followed by stack?
LIFO (Last in First Out)
Q88. Name any three applications of stack.
Call history on mobile
Browser history
Undo and redo commands
CD/DVD tracks
Books on the tables
Q89. What is an exception in python?
An error or unusual condition that occurs in the program that causes abnormal
termination of the program or crash of the python program is called an exception.
Q90. What do you mean by debugging?
The process of finding program errors is called debugging.
Q91. Tell me the three basic types of errors that occur in Python.
Syntax Errors
Logical Errors
Run-Time Errors
Page 15 of 15 Website: [Link]