You are on page 1of 24

1 1 Fundamentals

1 Fundamentals
1 Fundamentals
1 Fundamentals
1 Fundamentals
1 Fundamentals
1 Fundamentals
1 Fundamentals
1 Fundamentals
1 Fundamentals
1 Fundamentals
1 Fundamentals
1 Fundamentals
1 Fundamentals
1 Fundamentals
1 Fundamentals
1 Fundamentals
1 Fundamentals
1 Fundamentals
1 Fundamentals
1 Fundamentals
2 Strings

2 Strings
2 Strings
2 Strings

2 Strings
2 Strings
2 Strings
2 Strings
2 Strings
2 Strings
3 List
3 List
3 List
3 List
3 List

3 List
3 List
3 List
4 Tuples
4 Tuples
4 Tuples
5 Dictionary
5 Dictionary
5 Dictionary
5 Dictionary
5 Dictionary
5 Dictionary
5 Dictionary
5 Dictionary
5 Dictionary
5 Dictionary
5 Dictionary
6 Functions
6 Modules
6 Functions
6 Functions
6 Functions
6 Functions
6 Functions
6 Functions
6 Functions
6 Functions
6 Functions
6 Functions
6 Functions

6 Functions
6 Functions
6 Functions
7 Modules
7 Modules
8 Data File Handling
8 Data File Handling
8 Data File Handling
8 Data File Handling
8 Data File Handling

8 Data File Handling


8 Data File Handling
8 Data File Handling

8 Data File Handling


8 Data File Handling
8 Data File Handling
8 Data File Handling

8 Data File Handling


8 Data File Handling

8 Data File Handling


8 Data File Handling

8 Data File Handling


8 Data File Handling
8 Data File Handling
8 Data File Handling

8 Data File Handling


8 Data File Handling

8 Data File Handling


8 Data File Handling
8 Data File Handling
8 Data File Handling
9 Data Structures
9 Data Structures
9 Data Structures
9 Data Structures
9 Data Structures

10 SQL
10 SQL
10 SQL
10 SQL
10 SQL
10 SQL
10 SQL
10 SQL
10 SQL
10 SQL
10 SQL
10 SQL
10 SQL
10 SQL
10 SQL
10 SQL
10 SQL
10 SQL
10 SQL
10 SQL
10 SQL
10 SQL
10 SQL
10 SQL
10 SQL
10 SQL
What are the rules for naming a variable?
What is a keyword? Give examples.
How do you find x raise to power y?
What is 5//2 ? 5/2 ?
Which value type does input() return?
How do we write comments in Python?
With which statement of Python Else clause is written?
When else clause of for loop is executed
Whats the purpose of break statement?
Whats the purpose of continue statement?
In nested loops . Break statement will terminate inner loop or outer loop or all loop
can we have else with for loop? While loop?
What do you mean by mutable data type?
What do you mean by immutable data type?
Which operator is used to find if an element is present in the seqquence or not?
Which are mutable data types- List, Tuple, 2 Strings, dictionary?
How do you find square root of a number in python?
Whats the difference between compiler and interpreter?
List is mutable or immutable?
Tuple, 2 Strings is mutable or immutable?
Whats the difference between Lists and Tuples?
Which operators can be used on Strings + - * /

Which type of quotes are used for Strings= single, dounle or triple?
How do I print reverse of a string?
How do I count number of characters present in a string?

Whats the difference between capitalize() function and title() functions of string?
Whats the purpose of s.upper()?
Whats the purpose of split() function w,r,t 2 Strings?
Whats the purpose of partition () function w,r,t 2 Strings?
How do you find position of a particular charater in a string?
Which module is required for string functions like upper(), title()
How can I remove 3rd element from the list?
Which function is used to remove all elements of a list?
How do you find largest number in a list of numbers?
How do I print reverse of a List?
How do I reverse a list?

Whats the difference between append() and extend() functions of list.


What is the difference between del keyword and clear() function?
How to remove list elements lets say starting from 2 to 5th element
If I say x=1,2,3 what is the data type of x?
How can I remove 3rd element from the tuuple?
How do you find largest number in a tuple containg numbers?
Which function is used to remove all elements of a dictionary?
Keys of a dictionary van be mutable or immuable ?
Can a key be repeated in a dictionary?
List can be used as key in a dictionary?
Tuples can be used as key in a dictionary?
Dictionary is mutable or immutable?
How can we create an empty dictionary?
Which function is used to return a value for a given key ?
Which function is used to remove all items from a dictionary?
I want to print only keys of a dictionary?
I want to print both keys and values of a dictionary ?
What are formal and actual parameters in a function?
Why do we use math module?
Give me two examples of byuilt in functions?
Which module is required for len()
Which numbers are given by range(10)
Cana function return more than one value?
What are positional arguments in a function?
What are keyword arguments in a function?
Whats the advantage of default arguments in a function?
Whats the difference bettween local and global variables ina function?
Why do we craete user defined functions in Python?
How many times a function can be called in a program?
if we don’t write a return statement in a function, what value is returned by it?

What is LEGB rule wrt functions?


Tell me a command to generate a random number between 1 to 10
int, float- is mutable or immutable?
Which module is required to use sin() function?
Which module is required to use random() function?
Whats the difference between text files and binary files?
What happens to the previous data if I open the file in 'w' mode
Whats the difference between 'a' and 'w' mode in file handling?
If I want to read first 10 characters from a text file, what statement will I give?
To read entire text file in one go, what statement is given?

Whats the difference between readlines() and read()


f.readline()
Which function is used to read all characters in the file?

Which function is used to write data in text file?


Which function is used to write data inbinary file?
Which function is used to read data from a binary file?
Which module is required to read/write data from binary files.

Whats the difference between r+ and w+ modes?


How do we open a binary file in read only mode?

How do we open a binary file both in read and write mode?


Can we write a list in binary file? How?

what is full form of CSV?


Whatis default delimiter in CSV file?
Whats the purpose of seek() function?
How do I take file pointer to end of file?

Whats the purpose of tell() function?


Which module is required to work upon CSV files?

Whats the use of TRY: EXCEPT:


Whats the use of CSV files?
Which module is required to work upon text files in python?
Which module is required to work upon Binary files in python?
What is a stack?
How do you implement push operation in a stack using List.
How do you implement pop operation in a stack using List.
Stacks works on principle of LIFO or FIFO?
What are applications of stack?

What is a Primary key?


Full form of SQL
Difference between DDL and DML commands?
Full form of DDL
Full form of DML
Examples of DDL commands
Examples of DML commands
Which keyword is used to remove duplicate data in sql queries?
Which clause is used to sort results of a query in SQL?
How do you sort results of a query in descending order?
How do you display structure of a table in SQL
Slect id DDL or DML?
Can we find sum of a particular column in SQL table?
max
min
avg
How can we find total number of records in SQL table?
What is degree and cardinality of a table?
Suppose there is a field marks, how do you increase marks of every student by 5 Update student set marks=marks+5;
Which command is used to save changes in SQL?
How do you find highest salary in sql table?
Which Module is required for SQL python connectivity
How can we delete a table in MYSQL?
How can we delete a record in MYSQL? Lets say rno 10
How can we add a record in a table?
How can we adda column in a table?
String

if else, for, while


if for loop does not encounter a break

inner loop
yes

in
List, dictionary - mutable
x**0.5 math.sqrt(x)

List is mutable
Immutable

+*

All
s[::-1]
len(s)

s.capitalize() will change first letter of the string to uppercase.


S.title(0 willl change first letter of every word to uppercase()
all characters of string are changed to uppercase()

s.find(' char')
No module is required
L.pop(2) or del L[2]
clear()
max()
L[::-1]
L.reverse()

append(element) – adds the given element at the end of the list


• extend(another-list) – adds the elements of another list at the end
of the list
del keyword removes one element at a time, clear function removes all the elements
del L[2:6]
tuple
Not possible - tuple is immutable
max()
clear()
immutable
no
no
yes - immutable
Immutable
d={}
d.get(key)
d.clear()
d.keys()
print(d) d.items()

len(), range()

0-9
yes

To break a large program into small parts, code can be reused, increase readability.
asmany times as we wish
None

It specifies the order for resolving scope of a name in a python


program
- Local namesppace, enclosing, global , built in
random.randint(1,10)
Immutable
math
random

Its deleted

file.read(10) -- string type


file.read() --- string type
f.read()- reads entire file , string
f.readlines()- reads all lines , list of 2 Strings
returns a string
file.read()
Write() -Single line of text
writelines()- Multiple lines of text
pickle.dump(obj,file) DUMP
obj=pickle.load(file) LOAD
pickle
r+ Pointer is initially placed at the beginning of the file.
w+ Pointer is initially placed at the end of the file
f=open("stu.dat","rb")

f=open("stu.dat","r+b") or w+b
Yes. pickle.dump(list,file)

Comma separated values


comma
seek() function is used to change the position of the file handle (file pointer) to a given specific position
f.seek(0,2)

•tell() returns the current position of the file read/write pointer


within the file.
Returns an integer
csv

Try, except and finally blocks are used in Python error-handling


mechanism. Code is executed in the try block until an error occurs.
Except block is used to receive and handle all errors. Control is
transferred to the appropriate except block. In all cases, the finally
block is executed

No module is required
pickle
Stack is LIFO list in which insertion and deletion take place at one end?
L.append(x) - adds an element in the last.
L.pop()- removes from last
LIFO
reverse a string, infix to postfix, evaluation of postfix

Structured Query Language

Data Definition Langauge


Data Manipuation Language
create table,Alter, Drop table, truncate
Select, insert, update,
Distinct
Order by
Order by marks desc
Describe
DML
Select sum() from tablename;

Select count(*) from tablename;


degree - no of cols, cardinality - no of rows
dent by 5 Update student set marks=marks+5;
commit;l
max(salary)
import mysql.connector import MySQLdb
drop table student;
delete from student where rno=10;
insert into student values(
alter table
cific position
1 Fundamentals 1
1 Fundamentals 2
1 Fundamentals 3
1 Fundamentals 4
1 Fundamentals 5
1 Fundamentals 6
1 Fundamentals 7
1 Fundamentals 8
1 Fundamentals 9
1 Fundamentals 10
1 Fundamentals 11
1 Fundamentals 12
1 Fundamentals 13
1 Fundamentals 14
1 Fundamentals 15
1 Fundamentals 16
1 Fundamentals 17
1 Fundamentals 18
1 Fundamentals 19
1 Fundamentals 20
1 Fundamentals 21
2 Strings 22

2 Strings 23
2 Strings 24
2 Strings 25
2 Strings 26
2 Strings 27
2 Strings 28
2 Strings 29
2 Strings 30
2 Strings 31
3 List 32
3 List 33
3 List 34
3 List 35
3 List 36
3 List 37
3 List 38
3 List 39
4 Tuples 40
4 Tuples 41
4 Tuples 42
5 Dictionary 43
5 Dictionary 44
5 Dictionary 45
5 Dictionary 46
5 Dictionary 47
5 Dictionary 48
5 Dictionary 49
5 Dictionary 50
5 Dictionary 51
5 Dictionary 52
5 Dictionary 53
6 Functions 54
6 Modules 55
6 Functions 56
6 Functions 57
6 Functions 58
6 Functions 59
6 Functions 60
6 Functions 61
6 Functions 62
6 Functions 63
6 Functions 64
6 Functions 65
6 Functions 66
6 Functions 67
6 Functions 68
6 Functions 69
7 Modules 70
7 Modules 71
8 Data File Handling 72
8 Data File Handling 73
8 Data File Handling 74
8 Data File Handling 75
8 Data File Handling 76
8 Data File Handling 77
8 Data File Handling 78
8 Data File Handling 79
8 Data File Handling 80
8 Data File Handling 81
8 Data File Handling 82
8 Data File Handling 83
8 Data File Handling 84
8 Data File Handling 85

8 Data File Handling 86


8 Data File Handling 87
8 Data File Handling 88
8 Data File Handling 89
8 Data File Handling 90
8 Data File Handling 91
8 Data File Handling 92
8 Data File Handling 93
8 Data File Handling 94
8 Data File Handling 95
8 Data File Handling 96
8 Data File Handling 97
9 Data Structures 98
9 Data Structures 99
9 Data Structures 100
9 Data Structures 101
9 Data Structures 102
103
10 SQL 1
10 SQL 2
10 SQL 3
10 SQL 4
10 SQL 5
10 SQL 6
10 SQL 7
10 SQL 8
10 SQL 9
10 SQL 10
10 SQL 11
10 SQL 12
10 SQL 13
10 SQL 14
10 SQL 15
10 SQL 16
10 SQL 17
10 SQL 18

10 SQL 19
10 SQL 20
10 SQL 21
10 SQL 22
10 SQL 23
10 SQL 24
10 SQL 25
10 SQL 26
10 SQL 27
10 SQL
10 SQL
10 SQL
10 SQL
10 SQL
10 SQL
10 SQL
10 SQL 28
10 SQL 29
10 SQL 30
10 SQL 31
10 SQL 32
10 SQL 33
10 SQL 34
10 SQL 35

10 SQL 36

10 SQL 37

10 SQL 38

10 SQL 39
10 SQL 40
10 SQL 41
10 SQL
What are the rules for naming a variable?
What is a keyword? Give examples.
How do you find x raise to power y?
What is 5//2 ? 5/2 ?
Which value type does input() return?
How do we write comments in Python?
With which statement of Python Else clause is written?
When else clause of for loop is executed
Whats the purpose of break statement?
Whats the purpose of continue statement?
In nested loops . Break statement will terminate inner loop or outer loop or all loops,
can we have else with for loop? While loop?
What do you mean by mutable data type?
What do you mean by immutable data type?
Which operator is used to find if an element is present in the seqquence or not?
Which are mutable data types- List, Tuple, 2 Strings, dictionary?
How do you find square root of a number in python?
Whats the difference between compiler and interpreter?
List is mutable or immutable?
Tuple, 2 Strings is mutable or immutable?
Whats the difference between Lists and Tuples?
Which operators can be used on Strings + - * /

Which type of quotes are used for Strings= single, dounle or triple?
How do I print reverse of a string?
How do I count number of characters present in a string?
Whats the difference between capitalize() function and title() functions of string?
Whats the purpose of s.upper()?
Whats the purpose of split() function w,r,t 2 Strings?
Whats the purpose of partition () function w,r,t 2 Strings?
How do you find position of a particular charater in a string?
Which module is required for string functions like upper(), title()
How can I remove 3rd element from the list?
Which function is used to remove all elements of a list?
How do you find largest number in a list of numbers?
How do I print reverse of a List?
How do I reverse a list?
Whats the difference between append() and extend() functions of list.
What is the difference between del keyword and clear() function?
How to remove list elements lets say starting from 2 to 5th element
If I say x=1,2,3 what is the data type of x?
How can I remove 3rd element from the tuuple?
How do you find largest number in a tuple containg numbers?
Which function is used to remove all elements of a dictionary?
Keys of a dictionary van be mutable or immuable ?
Can a key be repeated in a dictionary?
List can be used as key in a dictionary?
Tuples can be used as key in a dictionary?
Dictionary is mutable or immutable?
How can we create an empty dictionary?
Which function is used to return a value for a given key ?
Which function is used to remove all items from a dictionary?
I want to print only keys of a dictionary?
I want to print both keys and values of a dictionary ?
What are formal and actual parameters in a function?
Why do we use math module?
Give me two examples of byuilt in functions?
Which module is required for len()
Which numbers are given by range(10)
Cana function return more than one value?
What are positional arguments in a function?
What are keyword arguments in a function?
Whats the advantage of default arguments in a function?
Whats the difference bettween local and global variables ina function?
Why do we craete user defined functions in Python?
How many times a function can be called in a program?
if we don’t write a return statement in a function, what value is returned by it?
What is LEGB rule wrt functions?
Tell me a command to generate a random number between 1 to 10
int, float- is mutable or immutable?
Which module is required to use sin() function?
Which module is required to use random() function?
Whats the difference between text files and binary files?
What happens to the previous data if I open the file in 'w' mode
Whats the difference between 'a' and 'w' mode in file handling?
If I want to read first 10 characters from a text file, what statement will I give?
To read entire text file in one go, what statement is given?
Whats the difference between readlines() and read()
f.readline()
Which function is used to read all characters in the file?
Which function is used to write data in text file?
Which function is used to write data inbinary file?
Which function is used to read data from a binary file?
Which module is required to read/write data from binary files.
Whats the difference between r+ and w+ modes?
How do we open a binary file in read only mode?

How do we open a binary file both in read and write mode?


Can we write a list in binary file? How?
what is full form of CSV?
Whatis default delimiter in CSV file?
Whats the purpose of seek() function?
How do I take file pointer to end of file?
Whats the purpose of tell() function?
Which module is required to work upon CSV files?
Whats the use of TRY: EXCEPT:
Whats the use of CSV files?
Which module is required to work upon text files in python?
Which module is required to work upon Binary files in python?
What is a stack?
How do you implement push operation in a stack using List.
How do you implement pop operation in a stack using List.
Stacks works on principle of LIFO or FIFO?
What are applications of stack?

What is a Primary key?


Full form of SQL
Difference between DDL and DML commands?
Full form of DDL
Full form of DML
Examples of DDL commands
Examples of DML commands
Which keyword is used to remove duplicate data in sql queries?
Which clause is used to sort results of a query in SQL?
How do you sort results of a query in descending order?
How do you display structure of a table in SQL
What are aggregate functions?
Can we find sum of a particular column in SQL table?
max
min
avg
How can we find total number of records in SQL table?
What is degree and cardinality of a table?
Suppose there is a field marks, how do you increase marks of every student
by 5 Update student set marks=marks+5;
Which command is used to save changes in SQL?
How do you find highest salary in sql table?
Which Module is required for SQL python connectivity
How can we delete a table in MYSQL?
How can we delete a record in MYSQL? Lets say rno 10
How can we add a record in a table?
How can we adda column in a table?
Identify the DDL and DML commands from the following.
1. Create
2. Alter
3. Insert
4. Update
5. Drop
6. Delete
7. Select
SQL is a case sensitive language(T/F)?
Write statement to open a database named “student”.
Which statement is used to show all existing table in database?
Which command is used to remove database completely.
What do you mean by Null in MySQL?
Display column name where name is not null?
Display all columns of student table where name has not been entered.
which Command is used to delete table completely/permanently.

Delete from emp;


The above command will delete all the records from table “emp”. (True/False)

Select count( * ) from student; return 5 and Select count(fee) from student; return 4
why different output is coming in above two queries?

Differentiate between Alter and Update command.

What is the difference between drop and delete command?


What is the purpose of connect function pyton mysql connectivity program?
What is the purpose of execute function pyton mysql connectivity program?
A function which work on multiple values and return a single value.

1. DDL
2. DDL
3. DML
4. DML
5. DDL
6. DML
7. DML
FALSE

Null means a value which is unavailable or in other words we can say Null means no value.
Select name from student where name IS NOT NULL;
Select * from student where name IS NULL;
Drop table

True. Structure of the table will not be deleted.

Different output shows that there must be one null value in column fee.
Count(*) counts null also.
Alter command is used to change the structure of table and Update
command is used to modify the data of table.
Drop command delete the data as well as structure of table permanently
from database while delete command delete only the data from the table.
1 Fundametals
Is Python case sensitive?
How do you write comments in python?
https://csiplearninghub.com/python-viva-questions-class-12/

You might also like