12csc Minimized Material
12csc Minimized Material
Ch7:
1. What is function?
Functions are nothing but a group of related statements that perform a specific task
2. Write the different types of function
User-defined Functions-functions defined by the users themselves
Built-in Functions- functions that is inbuilt within python
Lambda Functions- functions that are anonymous unnamed function
Recursion Functions- functions that calls itself
3. What are the main advantages of function?
It avoids repetition and makes high degree of code reusing.
It provides better modularity for your application.
4. What is base condition in recursive function?
The condition that is given in any recursive function is known as base condition.
5. Differentiate ceil() and floor() function?
ceil() floor()
Returnsthe smallest integer greater than or equal to x Returns the largest integer less than or equal to x
math.ceil (x) math.floor (x)
>>>math.ceil(26.7) >>>math.floor(26.7)
Output: Output:
27 26
Ch -12
1.What is the difference between SQL and MySQL?
SQL MySQL
Structured query language is a language to It is database management system/RDBMS
access the database
2.Write any three DDL commands.(any three)
Create To create tables in the database.
Alter Alters the structure of the database.
Drop Delete tables from database.
Truncate Remove all records from a table,
3. Write the use of Savepoint command with an example.
used to save a transaction temporarily
Syntax SAVEPOINT savepoint_name;
Eg SAVEPOINT A;
4. Write a SQL statement using DISTINCT keyword.
Select distinct place from Student;
Ch:13
1.What is CSV File?
CSV (Comma Separated Values) files.
A CSV file is a human readable text file where each line has a number of fields, separated by commas or some other
delimiter.
2.Mention the two ways to read a CSV file using Python.
i)reader function
ii) DictReader class.
3.What is use of next() function?
used to skip the first row while sorting.
4.What is the difference between reader() and DictReader() function?
csv.reader Dict reader
It works with list/tuple It works with dictionary
It does not take additional arguements It take additional arguments
It is a function It is a class
Ch 14:
1.What is the theoretical difference between Scripting language and other programming language?
Scripting language Programming language
It require interpreter It require compiler
Ex.java script ,vb script,php Ex.c++
2.Differentiate Compiler and Interpreter.
Interpreter Compiler
Translates program one statement at a Translates it as a whole into machine
time. code.
Python,ruby. C,C++
3.Write the expansion of
(i) SWIG-Simplified Wrapper Interface Generator
(ii) MinGW-Minimalist GNU for Windows
4.What is the use of cd command. Give an example.
cd command refers to change directory
Ex: cd python
Ch -15
1.Which method is used to connect a database? Give an example.
connect() method is used to connect a database
cn= sqlite3.connect ("Academy.db")
2.Write the command to populate record in a table. Give an example.
insert command to populate record in a table
Ex. c.execute(“insert into employee values(101,’jaya’)”)
3.Which method is used to fetch all rows from the database table?
The fetchall() method is used to fetch all rows from the database table
4.Mention the difference between fetchone() and fetchmany()
Fetchone Fetchmany
Returns the next row of a query result set none in Returns the next number of rows of the query
a case no row left result set