Class 12 IP Viva Questions | Important Python MySQL Viva Questions

Most Important Python Viva Questions for CBSE Informatics Practices Class 12 Practical Exams | MySQL Practical Viva Questions for class 12 IP with answers.

Download PDF Python MySQL Viva Questions

Python Viva Questions with Answers

Q.1 Brief introduction to your project?

Inventory management 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.

Q.2 Objective of project?

  • 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.

Q.3 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.

Q.4 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.

Q.5 Can we use python as Backend and my SQL 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.

Q.6 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.

Q.7 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.

Q.8 What version of Python and SQL you used ?

Python version: 3.10
MySQL version: 8.0

Q.9 Is there any difference between SQL and MySQL or both are same?

MySQLSQL
It is an application softwareIt is a language
It is database management system software used to store and manage datait has various command which can be used in MySQL to make query to store, retrieve, update and delete data in MySQL
SQL is integral part of MySQLSQL can be integrated with any RDBMS like MySQL, Oracle etc.

Q.10 Are both MySQL and python free?

Yes both Python and MySQL are free to use. Both are Open Source Software.

Q.11 What is source code?

Source code is basically the code we write using any programming language to create program and application logic for software.

Q.12 Is Python interpreted language?

Yes, python is interpreted programming language.

Q.13 List any four application of python?

  • Web development: Django, Pyramid, Flask, and Bottle for developing web frameworks
  • Game development: PySoy, PyGame
  • Artificial Intelligence and Machine language: SciPy, Pandas, Seaborn, Keras, NumPy,
  • Data Visualization: pandas, matplotlib
  • Desktop GUI: PyQt, PyGtk, Kivy, Tkinter, WxPython, PyGUI, and PySide are some of the best Python-based GUI frameworks

Q.14 Why python is popular? (Features of python)

  • Dynamic
  • Large set of library and community support
  • Easy to learn and use
  • it can be used in many varieties of environments such as mobile applications, desktop applications, web development, hardware programming, and many more. 
  • Best for cloud computing, AI and Machine Learning

Q.15 What is module?

Python module is simple file with .py extension which contain python code to perform a task.

Q.16 What is extension of python module?

.py is extension of python module

Q.17 List five python library we can use?

  • Pandas
  • Matplotlib
  • Tabulate
  • Numpy
  • SciPy

Q.18 How to import module in python?

import <module> as <module name>

Exp:

import pandas as pd

Q.19 Difference between complier and Interpreter?

CompilerInterpreter
It translate source code into machine codeIt only scan and produce error in code
It scans all code at onceIt scan all code line by line
It takes less time for interpretationIt take more time for interpretation
it is large in sizeIt is small in size
It checks both syntax and semantic errorIt only checks syntax error

Q.20 Write Step to write python program?

Start python IDLE -> File -> New -> New Script opens, now type your code -> Save -> Run -> Run Module

Q.21 Is there any default data types in python?

Ideally there is no default data type in python, but when you input any value in python variable, it is treated as String.

Q.22 Explain if with example?

If is used to implement condition in python.

Example: larger between two number

X = int(input(“Enter a Number”)
Y = int(input(“Enter second Number”)
If X > Y:
            Print(X, “is Larger”)
else:
            Print(Y, “is Larger”)

Q.23 Explain loop with example?

Loop is used to repeat set statements till the given condition is True in Python.

Exp: display even numbers between 0 and 100

for I in range(0,100,2):
            print(i)

exp: factorial of anumber

X = int(input(“Enter a Number”)
R = 1
While X > 1:
            R = R*X
            X = X – 1
print(‘factorial = ‘,R)

Q.24 How to connect python with SQL? Write code.

Import pandas as pd
import mysql.connector as sqlt
con = sqlt.connect(host = “localhost”, user = “root”, passwd = “sanjay”, database = “hospital”)
cursor = con.cursor()
qry=”select * from item;”
df=pd.read_sql(qry,con)
print(df)

Q.25 Which library we use to connect with SQL?

Mysql-connector-python

Q.26 Have you use dataframe in your python program? Than what is it?

Yes, I used dataframe in Python. it is 2D data structure available in PANDAS library. It is used to manage large and complex data efficiently and also used in Data visualization.

Q.27 Differentiate between dataframe and Series.

DataframeSeries
It is 2D data structureIt is 1D data structure
It is size and value mutableIt is size immutable, value mutable
It can store heterogeneous dataIt stores homogeneous data

Q.28 What is PANDAS full form?

PANDAS = Panel Data system

Q.28 Why Python PANDAS is important?

  • It supports data visualization
  • It handles large data efficiently
  • More work can be done in less no of code
  • It can read data in many formats
  • It handles missing and duplicate data very efficiently

Q.29 Can we use pandas directly to python or we need to install it. If yes, than How to install it?

No we cannot use PANDAS directly in python. To use it first we need to install by giving following command:

pip install pandas

Q.30 Write program to create series using list.

import pandas as pd
L = [3,6,7,10]
S = pd.Series(L)
print(S)

Q.31 Can we give our own index in series? If yes, How?

Yes we can provide our own index labels to Series as given below:

import pandas as pd
L = [3,6,7,10]
S = pd.Series(L, index = [‘a’,’b’,’c’,’d’])
print(S)

Q.32   For given series’ S’ [1, 2, 4, 6, 8]? Write code to display [2, 4, 6].

print(S[1:4])

Q. 33 Write code to reverse and display series element?

print(S[::-1]

Q.34 For series [4,6,8,10,12] what will be output of S[1:4:2]?

 [6,10]

Q.35 If you make series with dictionary than index is created by ____ of dictionary.

Key

Q.36 How will you display to first 3 value of series?

S.head(3)

Or

S[:3]

Q.37 Write three features of dataframe?

  • Dataframe is 2D data structure
  • It can store heterogeneous data
  • It is size and value mutable both.

Q.38 For given dataframe ‘df’, write code to display value of a particular row and column.

Df[‘column label’][‘row lbel’]

Or

Df.at[‘column label’,’row label’]

Or

Df.at[‘column label’,’row label’]

Q.39 Explain the purpose of ‘at’ and ‘iat’ method in python.

at is label based single value selection method and iat is index based single value selection method in python pandas

Q.40 Differentiate between loc and iloc?

lociloc
It is label based seletion methodIt is index based selection method
Both starts and end label are included when given start:endLike slices end position or index is excluded when given as start:end

Q.41 Give example to make dataframe from using 2D dictionary.

 import pandas as pd
D = {‘Toys’:{‘MP’:7000,’UP’:3400,’AP’:7800,’CG’:4100},
     ‘Books’:{‘MP’:4300,’UP’:3200,’AP’:5600,’CG’:2000},
     ‘Shoes’:{‘MP’:6000,’UP’:1200,’AP’:3280,’CG’:3000},}
aid = pd.DataFrame(D)
print(‘—-DataFrame—-‘)
print(aid)

Q42 differentiate between count() and len() in python.

Count() method of dataframe is used to count the non-NA entries for each row or column.

Df.count(axis = 0 or 1)

0 – index
1 – columns

Len() returns total number of rows in a dataframe.

Len(df)

Q.43 How to check database is empty?

Df.empty

Q.44 How to change index of dataframe?

Df.rename(index = {<labels dictionary>}, inplace = True)
OR
Df.rename(index  = {‘a’:’1’,’b’:2})

Q.45 If you write Df.iloc[1:3]=20, what will happen?

It will replace values all columns of 2nd and 3rd row with 20.

Q.46 How can we add new column in dataframe?

Df.<column name> = value
OR
Df[‘column name’] = value

Q.47 What method one can use to delete column or row of given dataframe?

For column

Del df[‘column name’]

Or

Df.drop([column label],axis = 1)

For row

Df.drop([row label])

Q.48 Expand CSV.

CSV – Comma Separated Values

Q49. Why CSV is popular to manage records?

  • CSV is faster to handle
  • CSV is smaller in size
  • CSV is easy to generate and import onto a spreadsheet or database
  • CSV is human readable and easy to edit manually
  • CSV is processed by almost all existing applications

Q.50 Which library is used to make chart in python?

Matplotlib

Q.51 Write code to make bar chart?

import matplotlib.pyplot as plt
clas = [6,7,8,9,10]
strength = [42,44,50,37,48]
plt.bar(clas, strength)
plt.show()

Q.52 Write code to make a line chart.

import matplotlib.pyplot as plt
Week = range(1,5)
temp = [40,42,50,44]
plt.plot(Week, temp)
plt.legend()
plt.show()

Q.53 What is the significance of Data Visualization?

Data visualization refers to graphical representation of information and data using various visual element like chart, graph and maps etc.
It helps business organization to

  • Analyze data
  • Understand data trend
  • Understand data patterns
  • Compare data

And helps in taking decision for their business growth.

Q.54 Bydefault, top() method display ____ top rows.

5 rows

Q.55 axis = 0 and axis = 1 refers to:

Axis 0 refers to rows and 1 refers to columns

Q.56 Is PyPlot is library?

No Pyplot is not a library, it’s a module.

Q.57 What is slicing?

  • Slicing refers to creating series or dataframe subset by extracting specific range of values.
  • Slicing is done position wise and not the index wise.
  • S[start:end:step]

Q.58 How to import Pyplot?

Import matplotlib.pyplot as plt

Q.59 What is bar chart?

Bar chart is used to compare data. All data series is represented in form of bars (columns) in it. We can use bar() of Pyplot to create it.

Q.60 When should we use line chart?

To get data trends or changes in data over a period of time we can use line chart.

Q.61 Can we have duplicate index in Series object?

Yes

Q.62 To get total number of elements we can use______

Size attribute

Q.63 To check whether Series object contains NaN values we can use ________

Hasnans attribute

Q.64 How can we add NaN value in our Series or Dataframe?

numpy.NaN

Q.65 What is full form of IDLE?

Integrated Learning Development Environment

MySQL Viva Questions with Answer

13 thoughts on “Class 12 IP Viva Questions | Important Python MySQL Viva Questions”

  1. Sir, I need the Viva questions pdf to prepare for my practical exam. Can you please send me the pdf to my mail?

Leave a Comment

Your email address will not be published. Required fields are marked *

error: Content is protected !!