[go: up one dir, main page]

0% found this document useful (0 votes)
63 views41 pages

12CS em MLM

The document is a study guide for Computer Science students, covering key concepts and important one-mark questions across various lessons. It includes topics such as functions, data abstraction, scoping, algorithmic strategies, Python variables, control structures, functions, string manipulation, and object-oriented programming. The guide is designed to assist students in their learning and preparation for exams.

Uploaded by

pavithradev2414
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views41 pages

12CS em MLM

The document is a study guide for Computer Science students, covering key concepts and important one-mark questions across various lessons. It includes topics such as functions, data abstraction, scoping, algorithmic strategies, Python variables, control structures, functions, string manipulation, and object-oriented programming. The guide is designed to assist students in their learning and preparation for exams.

Uploaded by

pavithradev2414
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 41

100%

Not Only Pass. More than that


என்றும் மாணவர்கள் நலனில்

COMPUTER SCIENCE
(Minimum learning material)

A. Prabhakar - 9442979144
12

ARUNA PUBLICATIONS

TECH EASY GUIDE


 11 & 12 – COMPUTER SCIENCE
 11 & 12 – COMPUTER APPLICATIONS
 11 & 12 – EMPLOYABILITY SKILLS

❖ TECH EASY PASS100%


❖ TECH EASY PUBLIC QUESTION PAPERS COLLECTIONS
❖ TECH EASY MODEL QUESTION PAPERS
❖ TECH EASY QR CODES FOR ACCESSING OUR CONTENTS

techeasyforstudents@gmail.com
Important One Marks

LESSON 1 - FUNCTIONS
1. The small sections of code that are used to perform a particular task is called
(A) Subroutines (B) Files (C) Pseudo code (D) Modules
2. Which of the following is a distinct syntactic block?
(A) Subroutines (B) Function (C) Definition (D) Modules
3. The variables in a function definition are called as
(A) Subroutines (B) Function (C) Definition (D) Parameters
4. The values which are passed to a function definition are called
(A) Arguments (B) Subroutines (C) Function (D) Definition
5. Which of the following defines what an object can do?
(A) Operating System (B) Compiler (C) Interface (D) Interpreter
6. The functions which will give exact result when same arguments are passed are called
(A) Impure functions (B) Partial Functions (C) Dynamic Functions (D) Pure functions
7. The functions which cause side effects to the arguments passed are called
(A) Impure function (B) Partial Functions (C) Dynamic Functions (D) Pure functions
LESSON 2 - DATA ABSTRACTION
8. Which of the following functions that build the abstract data type?
(A) Constructors (B) Destructors (C) recursive (D)Nested
9. Which of the following functions that retrieve information from the data type?
(A) Constructors (B) Selectors (C) recursive (D)Nested
10. The data structure which is a mutable ordered sequence of elements is called
(A) Built in (B) List (C) Tuple (D) Derived data
11. A sequence of immutable objects is called
(A) Built in (B) List (C) Tuple (D) Derived data
12. The data type whose representation is known are called
(A) Built in datatype (B) Derived datatype
(C) Concrete datatype (D) Abstract datatype
13. The data type whose representation is unknown are called
(A) Built in datatype (B) Derived datatype
(C) Concrete datatype (D) Abstract datatype
14. Bundling two values together into a compound structure
(A) Pair (B) Triplet (C) single (D) quadrat
15. Which of the following allow to name the various parts of a multi-item object?
(A) Tuples (B) Lists (C) Classes (D) quadrats
16. Which of the following is constructed by placing expressions within square brackets?
(A) Tuples (B) Lists (C) Classes (D) quadrats
LESSON 3 - SCOPING
17. Which of the following refers to the visibility of variables in one part of a program to another part of the
same program.
(A) Scope (B) Memory (C) Address (D) Accessibility
18. The process of binding a variable name with an object is called
(A) Scope (B) Mapping (C) late binding (D) early binding
19. Which of the following is used in programming languages to map the variable and object?
(A) :: (B) := (C) = (D) ==

..1.. A. Prabhakar - 9442979144


100% 12 – Computer Science
20. Containers for mapping names of variables to objects is called
(A) Scope (B) Mapping (C) Binding (D) Namespaces
21. Which scope refers to variables defined in current function?
(A) Local Scope (B) Global scope (C) Module scope (D) Function Scope
22. The process of subdividing a computer program into separate sub-programs is called
(A) Procedural Programming (B) Modular programming
(C) Event Driven Programming (D) Object oriented Programming
23. Which of the following security technique that regulates who can use resources in a computing environment?
(A) Password (B) Authentication (C) Access control (D) Certification
24. Which of the following members of a class can be handled only from within the class?
(A) Public members (B) Protected members (C) Secured members (D) Private members
25. Which members are accessible from outside the class?
(A) Public members (B) Protected members (C) Secured members (D) Private members
26. The members that are accessible from within the class and are also available to its subclasses is called
(A) Public members (B) Protected members (C) Secured members (D) Private members
LESSON 4 - ALGORITHMIC STRATEGIES
27. The word comes from the name of a Persian mathematician Abu Ja’far Mohammed ibn-i Musa al
Khowarizmi is called?
(A) Flowchart (B) Flow (C) Algorithm (D) Syntax
28. From the following sorting algorithms which algorithm needs the minimum number of swaps?
(A) Bubble sort (B) Quick sort (C) Merge sort (D) Selection sort
29. Two main measures for the efficiency of an algorithm are
(A) Processor and memory (B) Complexity and capacity (C) Time and space (D) Data and space
30. The algorithm that yields expected output for a valid input is called as
(A) Algorithmic solution (B) Algorithmic outcomes
(C) Algorithmic problem (D) Algorithmic coding
31. Which of the following is used to describe the worst case of an algorithm?
(A) Big A (B) Big S (C) Big W (D) Big O
32. Big  is the reverse of
(A) Big O (B) Big  (C) Big A (D) Big S
33. Binary search is also called as
(A) Linear search (B) Sequential search
(C) Random search (D) Half-interval search
34. The Θ notation in asymptotic evaluation represents
(A) Base case (B) Average case (C) Worst case (D) NULL case
35. In dynamic programming, the technique of storing the previously calculated values is called?
(A) Saving value property (B) Storing value property (C) Memoization (D) Mapping
LESSON 5 - PYTHON – VARIABLES AND OPERATORS
36. Who developed Python?
A) Ritche B) Guido Van Rossum C) Bill Gates D) Sunder Pitchai
37. The Python prompt indicates that Interpreter is ready to accept instruction.
A) >>> B) <<< C) # D) <<
38. Which of the following character is used to give comments in Python Program?
A) # B) & C) @ D) $
39. This symbol is used to print more than one item on a single line.
A) Semicolon(;) B) Dollor($) C) comma(,) D) Colon(:)

..2.. A. Prabhakar - 9442979144


100% 12 – Computer Science
40. Which of the following is not a token?
A) Interpreter B) Identifiers C) Keyword D) Operators
41. Which operator is also called as Comparative operator?
A) Arithmetic B) Relational C) Logical D) Assignment
42. Which operator is also called as Conditional operator?
A) Ternary B) Relational C) Logical D) Assignment
LESSON 6 - CONTROL STRUCTRES
43. How many important control structures are there in Python?
A) 3 B) 4 C) 5 D) 6
44. elif can be considered to be abbreviation of
A) nested if B) if..else C) else if D) if..elif
45. What plays a vital role in Python programming?
A) Statements B) Control C) Structure D) Indentation
46. Which statement is generally used as a placeholder?
A) continue B) break C) pass D) goto
47. The condition in the if statement should be in the form of
A) Arithmetic or Relational expression B) Arithmetic or Logical expression
C) Relational or Logical expression D) Arithmetic
48. Which of the following is known as definite loop?
A) do..while B) while C) for D) if..elif
49. What is the output of the following snippet?
i=1
while True:
if i%3 ==0:
break
print(i,end='')
i +=1
A) 12 B) 123 C) 1234 D) 124
50. Which amongst this is not a jump statement?
A) for B) pass C) continue D) break
51. Which punctuation should be used in the blank?
if <condition>_
statements-block 1
else:
statements-block 2
A) ; B) : C) :: D) !
LESSON 7 - PYTHON FUNCTIONS
52. A named blocks of code that are designed to do one specific job is called as
(A) Loop (B) Branching (c) Function (D) Block
53. A Function which calls itself is called as
(A) Built-in (B) Recursion (C) Lambda (D) return
54. Which function is called anonymous un-named function
(A) Lambda (B) Recursion (C) Function (D) define
55. Which of the following keyword is used to begin the function block?
(A) define (B) for (C) finally (D) def
56. Which of the following keyword is used to exit a function block?
(A) define (B) return (C) finally (D) def
..3.. A. Prabhakar - 9442979144
100% 12 – Computer Science
57. While defining a function which of the following symbol is used.
(A) ; (semicolon) (B) . (dot) (C) : (colon) (D) $ (dollar)
58. Which of the following keyword is used to define the function testpython(): ?
(A) define (B) pass (C) def (D) while
LESSON 8 - STRINGS AND STRING MANIPULATION
59. Which of the following operator is used for concatenation?
(A) + (B) & (C) * (D) =
60. Defining strings within triple quotes allows creating:
(A) Single line Strings (B) Multiline Strings (C) Double line Strings (D) Multiple Strings
61. Strings in python:
(A) Changeable (B) Mutable (C) Immutable (D) flexible
62. Which of the following is the slicing operator?
(A) { } (B) [ ] (C) < > (D) ( )
63. What is stride?
(A) index value of slide operation (B) first argument of slice operation
(C) second argument of slice operation (D) third argument of slice operation
64. Which of the following formatting character is used to print exponential notation in upper case?
(A) %e (B) %E (C) %g (D) %n
65. Which of the following is used as placeholders or replacement fields which get replaced along with format()
function?
(A) { } (B) < > (C) ++ (D) ^^
66. The subscript of a string may be:
(A) Positive (B) Negative (C) Both (A) and (B) (D) Either (A) or (B)
LESSON 9 - LISTS, TUPLES, SETS AND DICTIONARY
67. Let list1=[2,4,6,8,10], then print(List1[-2]) will result in
(A) 10 (B) 8 (C) 4 (D) 6
68. Which of the following function is used to count the number of elements in a list?
(A) count() (B) find() (C) len() (D) index()
69. If List=[10,20,30,40,50] then List[2]=35 will result
(A) [35,10,20,30,40,50] (B) [10,20,30,40,50,35] (C) [10,20,35,40,50] (D) [10,35,30,40,50]
70. If List=[17,23,41,10] then List.append(32) will result
(A) [32,17,23,41,10] (B) [17,23,41,10,32] (C) [10,17,23,32,41] (D) [41,32,23,17,10]
71. Which of the following Python function can be used to add more than one element within an existing list?
(A) append() (B) append_more() (C) extend() (D) more()
72. What will be the result of the following Python code?
S=[x**2 for x in range(5)]
print(S)
(A) [0,1,2,4,5] (B) [0,1,4,9,16] (C) [0,1,4,9,16,25] (D) [1,4,9,16,25]
73. Let setA={3,6,9}, setB={1,3,9}. What will be the result of the following snippet?
print(setA|setB)
(A) {3,6,9,1,3,9} (B) {3,9} (C) {1} (D) {1,3,6,9}
74. Which of the following set operation includes all the elements that are in two sets but not the one that are
common to two sets?
(A) Symmetric difference (B) Difference (C) Intersection (D) Union
75. The keys in Python, dictionary is specified by
(A) = (B) ; (C)+ (D) :

..4.. A. Prabhakar - 9442979144


100% 12 – Computer Science
LESSON 10 - PYTHON CLASSES AND OBJECTS
76. Which of the following are the key features of an Object-Oriented Programming language?
(A) Constructor and Classes (B) Constructor and Object
(C) Classes and Objects (D) Constructor and Destructor
77. Functions defined inside a class:
(A) Functions (B) Module (C) Methods (D) section
78. Class members are accessed through which operator?
(A) & (B) . (C) # (D) %
79. Which of the following method is automatically executed when an object is created?
(A) __object__( ) (B) __del__( ) (C) __func__( ) (D) __init__( )
80. A private class variable is prefixed with
(A) __ (B) && (C) ## (D) **
81. Which of the following method is used as destructor?
(A) __init__( ) (B) __dest__( ) (C) __rem__( ) (D) __del__( )
82. Which of the following class declaration is correct?
(A) class class_name (B) class class_name<> (C) class class_name: (D) class class_name[]
83. Which of the following is the output of the following program?
class Student:
def __init__(self, name):
self.name=name
print (self.name)
S=Student(“Tamil”)
(A) Error (B) Tamil (C) name (D) self
84. Which of the following is the private class variable?
(A) __num (B) ##num (C) $$num (D) &&num
85. The process of creating an object is called as:
(A) Constructor (B) Destructor (C) Initialize (D) Instantiation
LESSON 11 - DATABASE CONCEPTS
86. What is the acronym of DBMS?
(A) DataBase Management Symbol (B) Database Managing System
(C) DataBase Management System (D) DataBasic Management System
87. A table is known as
(A) tuple (B) attribute (C) relation (D) entity
88. Which database model represents parent-child relationship?
(A) Relational (B) Network (C) Hierarchical (D) Object
89. Relational database model was first proposed by
(A) E F Codd (B) E E Codd (C) E F Cadd (D) E F Codder
90. What type of relationship does hierarchical model represents?
(A) one-to-one (B) one-to-many (C) many-to-one (D) many-to-many
91. Who is called Father of Relational Database from the following?
(A) Chris Date (B) Hugh Darween (C) Edgar Frank Codd (D) Edgar Frank Cadd
92. Which of the following is an RDBMS?
(A) Dbase (B) Foxpro (C) Microsoft Access (D) MS Excel
93. What symbol is used for SELECT statement?
(A) σ (B) Π (C) X (D) Ω
94. A tuple is also known as
(A) table (B) row (C) attribute (D) field

..5.. A. Prabhakar - 9442979144


100% 12 – Computer Science
95. Who developed ER model?
(A) Chen (B) EF Codd (C) Chend (D) Chand
LESSON 12 - STRUCTURED QUERY LANGUAGE (SQL)
96. Which commands provide definitions for creating table structure, deleting relations, and modifying relation
schemas.
(A) DDL (B) DML (C) DCL (D) DQL
97. Which command lets to change the structure of the table?
(A) SELECT (B) ORDER BY (C) MODIFY (D) ALTER
98. The command to delete a table is
(A) DROP (B) DELETE (C) DELETE ALL (D) ALTER TABLE
99. Queries can be generated using
(A) SELECT (B) ORDER BY (C) MODIFY (D) ALTER
100. The clause used to sort data in a database
(A) SORT BY (B) ORDER BY (C) GROUP BY (D) SELECT
LESSON 13 - PYTHON AND CSV FILES
101. A CSV file is also known as a ….
(A) Flat File (B) 3D File (C) String File (D) Random File
102. The expansion of CRLF is
(A) Control Return and Line Feed (B) Carriage Return and Form Feed
(C) Control Router and Line Feed (D) Carriage Return and Line Feed
103. Which of the following module is provided by Python to do several operations on the CSV files?
(A) py (B) xls (C) csv (D) os
104. Which of the following mode is used when dealing with non-text files like image or exe files?
(A) Text mode (B) Binary mode (C) xls mode (D) csv mode 5
105. The command used to skip a row in a CSV file is
(A) next() (B) skip() (C) omit() (D) bounce()
106. Which of the following is a string used to terminate lines produced by writer()method of csv module?
(A) Line Terminator (B) Enter key (C) Form feed (D) Data Terminator
107. What is the output of the following program? import csv
d=csv.reader(open('c:\PYPRG\ch13\city.csv'))
next(d)
for row in d:
print(row)
if the file called “city.csv” contain the following details
chennai, mylapore
mumbai, andheri
A) chennai,mylapore (B) mumbai,andheri (C) chennai (D) chennai,mylapore
mumba mumbai,andheri
108. Which of the following creates an object which maps data to a dictionary?
(A) listreader() (B) reader() (C) tuplereader() (D) DictReader ()

..6.. A. Prabhakar - 9442979144


100% 12 – Computer Science
LESSON 14 - IMPORTING C++ PROGRAMS IN PYTHON
109. Which of the following is not a scripting language?
(A) JavaScript (B) PHP (C) Perl (D) HTML
110. Importing C++ program in a Python program is called
(A) wrapping (B) Downloading (C) Interconnecting (D) Parsing
111. The expansion of API is
(A) Application Programming Interpreter (B) Application Programming Interface
(C) Application Performing Interface (D) Application Programming Interlink
112. A framework for interfacing Python and C++ is
(A) Ctypes (B) SWIG (C) Cython (D) Boost
113. Which of the following is a software design technique to split your code into separate parts?
(A) Object oriented Programming (B) Modular programming
(C) Low Level Programming (D) Procedure oriented Programming
114. The module which allows you to interface with the Windows operating system is
(A) OS module (B) sys module (c) csv module (d) getopt module
115. getopt() will return an empty array if there is no error in splitting strings to
(A) argv variable (B) opt variable (c) args variable (d) ifile variable
116. Which of the following can be used for processing text, numbers, images, and scientific data?
(A) HTML (B) C (C) C++ (D) PYTHON
LESSON 15 - DATA MANIPULATION THROUGH SQL
117. Which of the following is an organized collection of data?
(A) Database (B) DBMS (C) Information (D) Records
118. SQLite falls under which database system?
(A) Flat file database system (B) Relational Database system
(C) Hierarchical database system (D) Object oriented Database system
119. Which of the following is a control structure used to traverse and fetch the records of the database?
(A) Pointer (B) Key (C) Cursor (D) Insertion point
120. Any changes made in the values of the record should be saved by the command
(A) Save (B) Save As (C) Commit (D) Oblige
121. Which of the following executes the SQL command to perform some action?
(A) execute() (B) key() (C) cursor() (D) run()
122. Which of the following function retrieves the average of a selected column of rows in a table?
(A) Add() (B) SUM() (C) AVG() (D) AVERAGE()
123. The function that returns the largest value of the selected column is
(A) MAX() (B) LARGE() (C) HIGH() (D) MAXIMUM()
124. Which of the following is called the master table?
(A) sqlite_master (B) sql_master (C) main_master (D) master_main
125. The most commonly used statement in SQL is
(A) cursor (B) select (C) execute (D) commit
126. Which of the following keyword avoid the duplicate?
(A) Distinct (B) Remove (C) Where (D) GroupBy

..7.. A. Prabhakar - 9442979144


100% 12 – Computer Science
LESSON 16 - DATA VISUALIZATION USING PYTHON:
LINE CHART, PIE CHART AND BAR CHART
127. Which is a python package used for 2D charts?
(A) matplotlib.pyplot (B) matplotlib.pip (C) matplotlib.numpy (D) matplotlib.plt
128. Identify the package manager for Python packages, or modules.
(A) Matplotlib (B) PIP (C) plt.show() (D) python package
129. Which of the following feature is used to represent data and information graphically?
(A) Data List (B) Data Tuple (C) Classes and Objects (D) Data Visualization
130. ______ is the collection of resources assembled to create a single unified visual display.
(A) Interface (B) Dashboard (C) Objects (D) Graphics
131. Which of the following module should be imported to visualize data and information in Python?
(A) csv (B) Pie chart (C) mysql (D) matplotlib
132. _______ is a type of chart which displays information as a series of data points connected by straight line
segments.
(A) csv (B) Pie chart (C) Bar Chart (D) All the above
133. Identify the right type of chart using the following hints.
Hint 1: This chart is often used to visualize a trend in data over intervals of time.
Hint 2: The line in this type of chart is often drawn chronologically.
(A) Line chart (B) Bar chart (C) Pie chart (D) Scatter plot

..8.. A. Prabhakar - 9442979144


Important Two & Three Marks

LESSON 1 - FUNCTIONS
1. What is a subroutine?
Subroutines are small sections of code that are used to perform a particular task that can be used
repeatedly. In Programming languages these subroutines are called as Functions.
2. Differentiate interface and implementation.
Interface Implementation
Interface just defines what an object can do, but Implementation carries out the instructions defined
won’t actually do it. in the interface.
3. Which of the following is a normal function definition and which is recursive function definition
i) let sum x y: return x + y Answers:
ii) let disp: (i) Recursive function
print ‘welcome’ ii) Normal Function
iii) let sum num: iii) Recursive Function
if (num!=0) then return num + sum
(num-1)
else
return num
4. Mention the characteristics of Interface.
➢ The class template specifies the interfaces to enable an object to be created and operated properly.
➢ An object's attributes and behaviour are controlled by sending functions to the object.
5. Why strlen is called pure function?
Each time you call the strlen() function with the same parameters, it always gives the same correct
answer. So, it is a pure function.
6. Differentiate pure and impure function.
Pure Function Impure Function

The return value of the pure functions solely The return value of the impure functions does not
depends on its arguments passed. solely depend on its arguments passed.
Hence, if you call the pure functions with the same Hence, if you call the impure functions with the
set of arguments, you will always get the same same set of arguments, you might get the different
return values. return values.
They do not have any side effects. They have side effects.

LESSON 2 - DATA ABSTRACTION


7. What is abstract data type?
Th e process of providing only the essentials and hiding the details is known as abstraction. Abstract
Data type (ADT) is a type (or class) for objects whose behavior is defined by a set of value and a set of
operations.
8. Differentiate constructors and selectors.
➢ Constructors are functions that build the abstract data type.
➢ Selectors are functions that retrieve information from the data type.
9. What is a Pair? Give an example.
Any way of bundling two values together into one can be considered as a pair. Some languages like
Python provides a compound structure called Pair which is made up of list or Tuple.
Example: lst := [5, 10, 20]
..9.. A. Prabhakar - 9442979144
100% 12 – Computer Science
10. What is a List? Give an example.
List is constructed by placing expressions within square brackets separated by commas. Such an
expression is called a list literal. The elements in the list can be of any type, and it can be changed.
Example:
lst := [105, ”Aakash”, 14]
11. What is a Tuple? Give an example.
A tuple is a comma-separated sequence of values surrounded with parentheses. The elements given in
the tuple cannot be changed.
Example:
t := (10, 12)
12. Differentiate Concrete data type and abstract datatype.
Concrete data type Abstract datatype
In concrete data representation, a definition for The definition of ADT only mentions what
each function is known. operations are to be performed but not how these
operations will be implemented.
13. Identify Which of the following are constructors and selectors?
(a) N1=number( ) - Constructor
(b) accetnum(n1) - Selectors
(c) displaynum(n1) - Selectors
(d) eval(a/b) - Selectors
(e) x,y= makeslope (m), makeslope(n) - Constructor
(f) display( ) - Selectors
14. Identify Which of the following are List, Tuple and class ?
(a) arr [1, 2, 34] - List
(b) arr (1, 2, 34) - Tuple
(c) student [rno, name, mark] - Class
(d) day= (‘sun’, ‘mon’, ‘tue’, ‘wed’) - Tuple
(e) x= [2, 5, 6.5, [5, 6], 8.2] - List
(f) employee [eno, ename, esal, eaddress] - Class
LESSON 3 - SCOPING
15. What is a scope?
Scope refers to the accessibility of a variable with in one part of a program to another part of the same
program.
16. Why scope should be used for variable. State the reason.
➢ The definition is used to indicate which part of the program the variable can be accessed or used.
➢ It is a good practice to limit a variable's scope to a single definition. This way, changes inside the
function can't affect the variable on the outside of the function in unexpected ways.
17. What is Mapping?
The process of binding a variable name with an object is called mapping. = (equal to sign) is used in
programming languages to map the variable and object.
18. What do you mean by Namespaces?
Namespaces are containers for mapping names of variables to objects.
19. Why access control is required?
Access control is a security technique that regulates who or what can view or use resources in a
computing environment. It is a fundamental concept in security that minimizes risk to the object. In other
words, access control is a selective restriction of access to data.

..10.. A. Prabhakar - 9442979144


100% 12 – Computer Science
20. Identify the scope of the variables in the following pseudo code and write its output.
color:= Red Scope of variables:
mycolor(): color → global scope
b:=Blue b → enclosed scope
myfavcolor(): g → local scope
g:=Green Output
print color, b, g Red Blue Green
myfavcolor() Red Blue
print color, b Red
mycolor()
print color
LESSON 4 - ALGORITHMIC STRATEGIES
21. What is an Algorithm?
An algorithm is a finite set of instructions to accomplish a particular task.
22. What is Sorting?
The process of arranging the list items in ascending or descending order is called sorting.
Example:
✓ Bubble Sorting ✓Selection sorting ✓ Insertion Sorting
23. What is searching? Write its types.
❖ Searching is the process of finding a particular value from the list.
❖ The different types are Linear search and Binary search.
24. List the characteristics of an algorithm.
i) Input ii) Output iii) Finiteness iv) Definiteness
v) Effectiveness vi) Correctness vii) Simplicity viii) Unambiguous
ix) Feasibility x) Portable xi) Independent
25. Write a note on Asymptotic notation.
Asymptotic Notations are languages that uses meaningful statements about time and space complexity.
The following three asymptotic notations are mostly used to represent time complexity of algorithms:
(i) Big O → worst-case
(ii) Big Ω → best-case
(iii) Big  → average-case
LESSON 5 - PYTHON – VARIABLES AND OPERATORS
26. Write short notes on Tokens.
Python breaks each logical line into a sequence of elementary lexical components known as Tokens.
The normal token types are
1) Identifiers 3) Operators 5) Literals
2) Keywords 4) Delimiters and
27. What are the different operators that can be used in Python ?
❖ Arithmetic operators ❖ Logical operators
❖ Relational or Comparative ❖ Assignment operators
operators ❖ Conditional Operator
28. What is a literal? Explain the types of literals?
Literal is a raw data given to a variable or constant. In Python, there are various types of literals are
Numeric, String and Boolean.

..11.. A. Prabhakar - 9442979144


100% 12 – Computer Science
29. Write short notes on Arithmetic operator with examples.
An arithmetic operator is a mathematical operator that takes two operands and performs a calculation
on them.
Arithmetic Operators:
+, -, *, /, % (modulus), ** (exponent) and // (integer division)
Example:
If the value is a=100 and b=10
(i) a + b = 110 (ii)a % 30 = 10
(iii) a // 30 = 3 (iv) a**2 = 10000
30. Explain Ternary operator with examples.
➢ Ternary operator is also known as conditional operator that evaluate something based on a condition
being true or false.
➢ It simply allows testing a condition in a single line replacing the multiline if-else making the code
compact.
Syntax:
Variable_Name = [on_true] if [Test expression] else [on_false]
Example:
min = 50 if 49<50 else 70
31. Write short notes on Escape sequences with examples.
➢ In Python strings, the backslash "\" is a special character, also called the "escape" character.
➢ It is used in representing certain whitespace characters: "\t" is a tab, "\n" is a newline, and "\r" is a
carriage return.
Escape Description Example Output
sequence
character
\\ Backslash >>> print("\\test") \test
\’ Single-quote >>> print("Doesn\'t") Doesn't
\” Double-quote >>> print("\"Python\"") "Python"
\n New line >>>print("Python\nLanguage") Python
Language
\t Tab >>>print("Hi \t Hello") Hi Hello
32. What are string literals? Explain.
➢ In Python a string literal is a sequence of characters surrounded by quotes.
➢ Python supports single, double and triple quotes for a string.
➢ A character literal is a single character surrounded by single or double quotes. The value with triple-
quote "' '" is used to give multi-line string literal.
Example:
s = ”Python”
c = “P”
m = ‘‘‘This is a multiline string with more than one lines’’’
LESSON 6 - CONTROL STRUCTRES
33. Write note on break statement.
➢ The break statement terminates the loop containing it.
➢ When the break statement is executed, the control flow of the program comes out of the loop and starts
executing the segment of code after the loop structure.
Syntax:
break

..12.. A. Prabhakar - 9442979144


100% 12 – Computer Science
34. Write is the syntax of if .. else statement.
Syntax:
if <condition>:
statements-block 1
else:
statements-block 2
35. Define control structure.
A program statement that causes a jump of control from one part of the program to another is called
control structure or control statement.
36. Write note on range () in loop.
range() generates a list of values starting from start till stop-1.
The syntax is
range (start, stop[,step])
Where, start – refers to the initial value
stop – refers to the final value
step – refers to increment value, this is optional part.
Example:
(i) range(1, 10) → start from 1 and end at 9
(ii) range(1, 10, 2) → returns 1 3 5 7 9
37. Write note on if .. else structure.
The if .. else statement is used to choose between two alternatives based on a condition.
Syntax:
if <condition>:
statements-block 1
else:
statements-block 2
Example: Output:
a = int(input("Enter any number :")) 1) Enter any number :56
if a%2==0: 56 is an even number
print (a, " is an even number") 2) Enter any number :67
else: 67 is an odd number
print (a, " is an odd number")

38. Using if .. else .. elif statement write a 39. Write the syntax of while loop.
suitable program to display largest of 3 Syntax:
numbers. while <condition>:
Program : statements block 1
a=int(input("Enter the first number:")) [else:
b=int(input("Enter the second number:")) statements block2]
c=int(input("Enter the third number:"))
if (a>b) and (a>c):
print(a, " is the largest number")
elif (b>c):
print(b, " is the largest number ")
else:
print(c, " is the largest number ")
40. List the differences between break and continue statements.
➢ The break statement terminates the loop when it is executed.
➢ Continue statement is used to skip the remaining part of a loop and start with next iteration.
..13.. A. Prabhakar - 9442979144
100% 12 – Computer Science
LESSON 7 - PYTHON FUNCTIONS
41. What is function?
Functions are named blocks of code that are designed to do specific job.
42. Write the different types of function.
❖ User-defined Functions ❖ Lambda Functions
❖ Built-in Functions ❖ Recursion Functions
43. What are the main advantages of function?
➢ It avoids repetition and makes high degree of code reusing.
➢ It provides better modularity for your application.
44. What is meant by scope of variable? Mention its types.
➢ Scope of variable refers to the part of the program, where it is accessible.
➢ i) local scope and ii) global scope are two types of scopes.
45. Define global scope.
A variable, with global scope can be used anywhere in the program. It can be created by defining a
variable outside the scope of any function/block.
46. Write the rules of local variable.
❖ A variable with local scope can be accessed only within the function/block that it is created in.
❖ When a variable is created inside the function/block, the variable becomes local to it.
❖ A local variable only exists while the function is executing.
❖ The format arguments are also local to function.
47. Write the basic rules for global keyword in python.
The basic rules for global keyword in Python are:
❖ When we define a variable outside a function, it’s global by default. You don’t have to use global
keyword.
❖ We use global keyword to read and write a global variable inside a function.
❖ Use of global keyword outside a function has no effect.
48. Differentiate ceil() and floor() function?
floor(): ceil():
It returns the largest integer less than or equal It returns the smallest integer greater than or
to x. equal to x.
Syntax: Syntax:
math.floor(x) math.ceil(x)
Example: Example:
x = 26.7 x = 26.7
print(math.floor(x)) print(math.ceil(x))
Output: Output:
26 27
49. Write a Python code to check whether a given year is leap year or not.
n=int(input("Enter a Year : "))
if n%4 == 0:
print(n," is a Leap Year")
else:
print(n," is not a Leap Year")
50. What is composition in functions?
The value returned by a function may be used as an argument for another function in a nested manner.
This is called composition.

..14.. A. Prabhakar - 9442979144


100% 12 – Computer Science
Example :
>>> n1 = eval (input ("Enter a number: "))
Enter an arithmetic expression: 234
>>> n1
234
In the above coding eval() function takes the returned value of string-based input from input() function.
51. What are the points to be noted while defining a function?
❖ Function blocks begin with the keyword “def” followed by function name and parenthesis ().
❖ Any input parameters or arguments should be placed within these parentheses when you define a
function.
❖ The code block always comes after a colon (:) and is indented.
❖ The statement “return [expression]” exits a function, optionally passing back an expression to the
caller.
LESSON 8 - STRINGS AND STRING MANIPULATION
52. What is String?
String is a sequence of Unicode characters that may be a combination of letters, numbers, or special
symbols enclosed within single, double or even triple quotes.
Example: (i) ‘School’ (ii) “School” (iii) ‘‘‘School’’’
53. Do you modify a string in Python?
No. Strings are immutable in python.
54. What will be the output of the following python code?
str1 = “School”
print(str1*3)
Output:
SchoolSchoolSchool
55. What is slicing?
Slice is a substring of a main string. A substring can be taken from the original string by using [ ] operator
and index or subscript values.
56. Write a Python program to display the given pattern
COMPUTER Program:
COMPUTE str="COMPUTER"
COMPUT i = len(str)
COMPU while (i > 0):
COMP print(str[:i])
COM i = i -1
CO
C
57. Write a short about the followings with suitable example:
(a) capitalize( ) (b) swapcase( )
(a) capitalize( ): (b) swapcase( )
It used to capitalize the first character of the It will change case of every character to its
string. opposite case vice-versa.
Example: Example:
>>> city="chennai" >>>str1="tamil NADU"
>>> print(city.capitalize()) >>> print(str1.swapcase())
Chennai TAMIL nadu

..15.. A. Prabhakar - 9442979144


100% 12 – Computer Science
58. What is the use of format()? Give an example.
The format() function used with strings is very versatile and powerful function used for formatting
strings. The curly braces {} are used as placeholders or replacement fields which get replaced along with
format() function.
Example:
a=2
b=4
print(“The product of {} and {} is {}”, format(a, b, ab))
Output:
The product of 2 and 4 is 8
59. Write a note about count() function in python.
count() function returns the number of substrings occurs within the given range. Remember that
substring may be a single character.
Syntax:
count(str[,beg, end])
Example
>>>str1="Raja Raja Chozhan"
>>>print(str1.count('Raja'))
2
>>>print(str1.count('a'))
5
LESSON 9 - LISTS, TUPLES, SETS AND DICTIONARY
60. What is List in Python?
A list in Python is known as a “sequence data type” like strings. It is an ordered collection of values
enclosed within square brackets []. Each value of a list is called as element.
61. What will be the value of x in following python code?
List1=[2,4,6,[1,3,5]]
x=len(List1)
The value of x is 4
62. Differentiate del with remove() function of List.
➢ del statement is used to delete known elements.
➢ remove() function is used to delete elements of a list if its index is unknown.
Example:
marks = [50, 63, 41, 75]
del marks[1] or marks.remove(63)
63. Write the syntax of creating a Tuple with n number of elements.
Syntax:
Tuple_Name = (E1, E2, E2 ……. En)
64. What is set in Python?
A Set is a mutable and an unordered collection of elements without duplicates. That means the
elements within a set cannot be repeated.

..16.. A. Prabhakar - 9442979144


100% 12 – Computer Science
65. What are the difference between list and of Tuples ot?
List Tuples
The elements of a list are changeable The elements of a tuple are unchangeable
(mutable) (immutable)
The elements are enclosed within square The elements are enclosed by parenthesis.
brackets.
Iteration is slow Iteration is faster

66. What will be the output of the following code?


list = [2x for x in range(5)]
print(list)
Output:
[1, 2, 4, 8, 16]
67. Explain the difference between del and clear() in dictionary with an example.
➢ In Python dictionary, del keyword is used to delete a particular element.
➢ The clear() function is used to delete all the elements in a dictionary.
➢ To remove the dictionary, you can use del keyword with dictionary name.
Example: Output:
Dict = {'Mark1' : 98, 'Marl2' : 86} {'Mark2': 86}
del Dict['Mark1'] {}
print(Dict) NameError: name 'Dict' is not defined
Dict.clear()
print(Dict)
del Dict
print(Dict)
68. List out the set operations supported by python.
Python supports the set operations such as
(i) Union (I) :
It includes all elements from two or more sets
(ii) Intersection (&):
It includes the common elements in two sets
(iii) Difference (-):
It includes all elements that are in fi rst set (say set A) but not in the second set (say set B)
(iv) Symmetric difference (^):
It includes all the elements that are in two sets (say sets A and B) but not the one that are common to
two sets.
69. What are the difference between List and Dictionary?
List Dictionary
List is an ordered set of elements. Dictionary is a data structure that is used for
matching one element (Key) with another (Value).
The index values can be used to access a particular In dictionary key represents index.
element.
Lists are used to look up a value. It is used to take one value and look up another
value.

..17.. A. Prabhakar - 9442979144


100% 12 – Computer Science
LESSON 10 - PYTHON CLASSES AND OBJECTS
70. What is class?
Class is a template for the object. It is the main building block in Python.
71. What is instantiation?
The process of creating object is called as “Class Instantiation”.
72. How will you create constructor in Python?
➢ In Python, Constructor is the special function called “init” that is automatically executed when an object
of a class is created.
➢ It must begin and end with double underscore.
Syntax:
def __init__(self, [args ……..]):
<statements>
Example:
class Sample:
def __init__(self):
print("Constructor of class Sample...")
S=Sample()
Output:
Constructor of class Sample...
73. What is the purpose of Destructor?
➢ Destructor is also a special method gets executed automatically when an object exit from the scope.
➢ It is just opposite to constructor.
➢ In Python, __del__( ) method is used as destructor.
74. What are class members? How do you define it?
➢ Variables and functions defined inside a class are called as “Class Variable” and “Methods” respectively.
➢ Class variable and methods are together known as members of the class.
Example:
class Sample:
x = 10 → class variable
def disp(self): → method
print(Sample.x)
s = Sample()
s.disp()
In the above code, name of the class is Sample and it has a variables x and method disp(self)
respectively. We can access the class members using the object s.
75. What is the output of the following program?
class Greeting:
def __init__(self, name):
self.__name = name
def display(self):
print("Good Morning ", self.__name)
obj=Greeting('Bindu Madhavan')
obj.display()
Output:
Good Morning Bindu Madhavan

..18.. A. Prabhakar - 9442979144


100% 12 – Computer Science
LESSON 11 - DATABASE CONCEPTS
76. Mention few examples of a database.
➢ dBase
➢ FoxPro
77. List some examples of RDBMS.
➢ SQL Server ➢ MS-Access
➢ Oracle ➢ MariaDB
➢ MySQL
78. What is data consistency?
Data Consistency means that data values are the same at all instances of a database.
79. What is the difference between Hierarchical and Network data model?
❖ In hierarchical model, a child record has only one parent node.
❖ In a Network model, a child may have many parent nodes. It represents the data in many-to-many
relationships.
❖ This model is easier and faster to access the data.
80. What is normalization?
Database normalization was first proposed by Dr. Edgar F Codd as an integral part of RDBMS in order to
reduce data redundancy and improve data integrity. These rules are known as E F Codd Rules.
81. What is the difference between Select and Project command?
Select Project
The SELECT operation is used for selecting a subset The projection eliminates all attributes of the
with tuples according to a given condition. input relation but those mentioned in the
projection list.
Select filters out all tuples that do not satisfy the The projection method defines a relation that
condition. contains a vertical subset of Relation.
symbol : σ symbol : ∏
82. What is the role of DBA?
Database Administrator or DBA is the one who manages the complete database management system.
DBA takes care of the security of the DBMS, managing the license keys, managing user accounts and access
etc.
83. Explain Cartesian product with a suitable example.
❖ Cross product is a way of combining two relations. The resulting relation contains, both relations being
combined.
❖ A x B means A times B, where the relation A and B have different attributes.
Table A Table B
RollNo Name SubCode Subject
1051 Aakash 041 Maths
1052 Subitha 019 Computer Science
Cartesian product : Table A x Table B
RollNo Name SubCode Subject
1051 Aakash 041 Maths
1051 Aakash 019 Computer Science
1052 Subitha 041 Maths
1052 Subitha 019 Computer Science

..19.. A. Prabhakar - 9442979144


100% 12 – Computer Science
LESSON 12 - STRUCTURED QUERY LANGUAGE (SQL)
84. Write a query that selects all students whose age is less than 18 in order wise.
SELECT NAME FROM STUDENT WHERE AGE<18 ORDER BY AGE;
85. Differentiate Unique and Primary Key constraint.
Unique Constraint Primary Key Constraint
It ensures that no two rows have the same value in It declares a field as a Primary key which helps to
the specified columns. uniquely identify a record.
More than one fields of a table can be set as primary Only one field of a table can be set as primary key.
key.
86. Write the difference between table constraint and column constraint?
➢ Table constraint: Table constraint apply to a group of one or more columns.
➢ Column constraint: Column constraint apply only to individual column.
87. Which component of SQL lets insert values in tables and which lets to create a table?
➢ DDL (Data Definition Language) – to create tables
➢ DML (Data Manipulation Language) – to insert values
88. What is the difference between SQL and MySQL?
❖ SQL : Structured Query Language is a language used for accessing database.
❖ MySQL : MySQL is a Database Management System like SQL Server, Oracle. MySQL is a RDBMS.
89. What is a constraint? Write short note on Primary key constraint.
➢ Constraint is a condition applicable on a field or set of fields.
➢ Primary Key Constraint:
This constraint declares a field as a Primary key which helps to uniquely identify a record. The
primary key does not allow NULL values and therefore a field declared as primary key must have the
NOT NULL constraint.
90. Write a SQL statement to modify the student table structure by adding a new field.
ALTER TABLE student add address char(20);
91. Write any three DDL commands.
➢ 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, also release the space occupied by those records.
92. Write a SQL statement using DISTINCT keyword.
➢ The DISTINCT keyword is used along with the SELECT command to eliminate duplicate rows in the table.
➢ This helps to eliminate redundant data.
For Example: SELECT DISTINCT Place FROM Student;
Admno Name Age Place will display the following data:
105 Sumitha 21 Madurai Place
106 Selvam 48 Chennai Madurai
107 Aakash 14 Chennai Chennai
108 Aruna 36 Coimbatore Coimbatore
109 Madhan 19 Madurai

..20.. A. Prabhakar - 9442979144


100% 12 – Computer Science
LESSON 13 - PYTHON AND CSV FILES
93. What is CSV File?
A CSV file is a human readable text file where each line has a number of fields, separated by commas or
some other delimiter.
94. Mention the two ways to read a CSV file using Python.
1. Use the csv module’s reader function
2. Use the DictReader class.
95. Mention the default modes of the File.
The following are the default modes of the file.
(i) 'r' Open a file for reading. (default)
(ii) 't' Open in text mode. (default)
96. What is use of next() function?
The next() function returns the next item from the iterator. It can also be used to skip a row of the csv file.
97. Write a note on open() function of python. What is the difference between the two methods?
Python has a built-in function open() to open a file. This function returns a file object, also called a
handle, as it is used to read or modify the file accordingly.
The two different methods are
(i) open("sample.txt") as f:
(ii) with open()
The open() method is not entirely safe. If an exception occurs when you are performing some operation
with the file, the code exits without closing the file.
But “with open” statement ensures that the file is closed when the block inside with is exited.
98. What is the difference between the write mode and append mode.
‘w’ - write mode:
Open a file for writing. Creates a new file if it does not exist or truncates the file if it exists.
‘a’ – append mode:
Open for appending at the end of the file without truncating it. Creates a new file if it does not exist.
99. What is the difference between reader() method and DictReader() class?
reader() DictReader()
The reader function is designed to take each line of DictReader() creates an object which maps data
the file and make a list of all columns. to a dictionary.
csv.reader() works with list/tuple. csv.DictReader() works with dictionary
LESSON 14 - IMPORTING C++ PROGRAMS IN PYTHON
100. What is the theoretical difference between Scripting language and other programming
language?
➢ The theoretical difference between the two is that scripting languages do not require the compilation
step and are rather interpreted.
➢ A scripting language requires an interpreter while a programming language requires a compiler.
101. Differentiate compiler and interpreter.
Compiler Interpreter
Scans the entire program and translates it as a Translates program one statement at a time.
whole into machine code.
It generates the error message only after It continues translating the program until the first
scanning the whole program. error is met, in which case it stops.
Debugging is comparatively hard. Debugging is easy.

..21.. A. Prabhakar - 9442979144


100% 12 – Computer Science
102. Write the expansion of (i) SWIG (ii)MinGW
(i) SWIG - Simplified Wrapper Interface Generator
(ii) MinGW - Minimalist GNU for Windows
103. What is the use of modules?
➢ We use modules to break down large programs into small manageable and organized files.
➢ Modules provide reusability of code.
➢ We can define our most used functions in a module and import it, instead of copying their definitions
into different programs.
104. Differentiate PYTHON and C++
PYTHON C++
Python is typically an "interpreted" language. C++ is typically a "compiled" language.
Python is a dynamic-typed language. C++ is compiled statically typed language.
Data type is not required while declaring variable. Data type is required while declaring variable.
It can act both as scripting and general purpose It is a general purpose language
language.
105. What are the applications of scripting language?
1. To automate certain tasks in a program
2. Extracting information from a data set
3. Less code intensive as compared to traditional programming language
4. can bring new functions to applications and glue complex systems together
106. What is MinGW? What is its use?
➢ MinGW refers to a set of runtime header files, used in compiling and linking the code of C, C++ and
FORTRAN to be run on Windows Operating System.
➢ MinGW allows to compile and execute C++ program dynamically through Python program using g++.
107. Identify the module, operator, definition name for the following
welcome.display()
welcome - Module Name
. - Dot operator
display() - Function call
LESSON 15 - DATA MANIPULATION THROUGH SQL
108. Mention the users who uses the Database.
Users of database can be human users, other programs or applications.
109. Which method is used to connect a database? Give an example.
connect() is used to connect/open the existing databases.
Example:
connection = sqlite3.connect ("Academy.db")
110. What is the advantage of declaring a column as “INTEGER PRIMARY KEY”?
If a column of a table is declared to be an INTEGER PRIMARY KEY, then
✓ whenever a NULL will be used as an input for this column, the NULL will be automatically converted
into an integer which will one larger than the highest value so far used in that column.
✓ If the table is empty, the value 1 will be used.
111. Which method is used to fetch all rows from the database table?
➢ cursor.fetchall() -fetchall () method is to fetch all rows from the database table.
Example:
import sqlite3
connection = sqlite3.connect("Academy.db")

..22.. A. Prabhakar - 9442979144


100% 12 – Computer Science
cursor = connection.cursor()
cursor.execute("SELECT * FROM student")
print("fetchall:")
result = cursor.fetchall()
print(result)
112. What is SQLite? What is it advantage?
➢ SQLite is a simple relational database system, which saves its data in regular data files or even in the
internal memory of the computer.
Advantages:
➢ It is designed to be embedded in applications, instead of using a separate database server program such
as MySQL or Oracle.
➢ SQLite is fast, rigorously tested, and flexible, making it easier to work.
➢ Python has a native library for SQLite.
113. Mention the difference between fetchone() and fetchmany()
fetchone() fetchmany()
This method returns the next row of a query result This method returns the next number of rows
set or None in case there is no row left. (n) of the result set. (Displaying specified
number of records)
It takes no argument. It takes one argument.
Example: Example:
res = cursor.fetchone() res = cursor.fetchmany(3)
LESSON 16 - DATA VISUALIZATION USING PYTHON:
LINE CHART, PIE CHART AND BAR CHART
114. What is Data Visualization.
Data Visualization is the graphical representation of information and data. The objective of Data
Visualization is to communicate information visually to users.
115. List the general types of data visualization.
➢Charts ➢ Maps
➢Tables ➢ Infographics
➢Graphs ➢ Dashboards
116. List the types of Visualizations in Matplotlib.
➢Line plot ➢ Box plot
➢Scatter plot ➢ Bar chart and
➢Histogram ➢ Pie chart
117. How will you install Matplotlib?
✓ To install matplotlib, type the following in your command prompt:
python –m pip install –U matplotlib
118. Write any three uses of data visualization.
❖ Data Visualization help users to analyze and interpret the data easily.
❖ It makes complex data understandable and usable.
❖ Various Charts in Data Visualization helps to show relationship in the data for one or more variables.

..23.. A. Prabhakar - 9442979144


Important Five Marks
LESSON 1 - FUNCTIONS
1. What are called Parameters and write a note on
(i) Parameter without Type
(ii) Parameter with Type
Parameters are the variables in a function definition and arguments are the values which are
passed to a function definition through the function definition.
(i) Parameter without Type
In the above function definition, the variables 'a' and 'b'
let rec pow a b:=
are parameters and the value which is passed to the variables
'a' and 'b' are arguments. We have also not specified the if b=0 then 1
datatype for 'a' and 'b'. This is an example of parameters else a * pow a (b-1)
without type.
(ii) Parameter with Type
The parameters 'a' and 'b' are specified in the data type
brackets () in the above function definition. This is an let rec pow (a:int) (b:int) : int :=
example of parameters with type. if b=0 then 1
2. Identify in the following program else a * pow a (b-1)
let rec gcd a b :=
if b <> 0 then gcd b (a mod b) else return a Answers:
i) Name of the function i) gcd
ii) Identify the statement which tells it is a ii) let rec gcd a b
recursive function iii) a, b
iii) Name of the argument variable iv) if b <> 0 then gcd b (a mod b)
iv) Statement which invoke the function v) return a
recursively
v) Statement which terminates the recursion
LESSON 3 - SCOPING
3. Explain the types of scopes for variable or LEGB rule with example.
The LEGB rule is used to decide the order in which the scopes are to be searched for scope resolution.

Local (L) Defined inside function/class.


Enclosed (E) Defined inside enclosing functions.
Global (G) Defined at the uppermost level.
Built-in (B) Reserved names in built-in functions (modules).

BUILT-IN
GLOBAL
ENCLOSED
LOCAL

Local scope:
➢ Local scope refers to variables defined in current function.
➢ Always, a function will first look up for a variable name in its local scope. Only if it does not find it there,
the outer scopes are checked.

..24.. A. Prabhakar - 9442979144


100% 12 – Computer Science
Enclosed scope:
➢ A function (method) with in another function is called nested function.
➢ A variable which is declared inside a function which contains another function definition with in it, the
inner function can also access the variable of the outer function. This scope is called enclosed scope.
Global scope:
➢ A variable which is declared outside of all the functions in a program is known as global variable.
➢ This means, global variable can be accessed inside or outside of all the functions in a program.
Built-in scope:
➢ The built-in scope has all the names that are pre-loaded into the program scope when we start the
compiler or interpreter.
➢ Any variable or module which is defined in the library functions of a programming language has Built-in
or module scope.
Example
Built-in/module scope → library files
a := 10 → global scope
Disp():
b := 7 → enclosed scope
Disp1()
c := 5 → local scope
print a, b, c
Disp1()
Disp()
Output
10
7
5
LESSON 4 - ALGORITHMIC STRATEGIES
4. Explain the characteristics of an algorithm.
❖ Input: Zero or more quantities to be supplied.
❖ Output: At least one quantity is produced.
❖ Finiteness: Algorithms must terminate after finite number of steps.
❖ Definiteness: All operations should be well defined.
❖ Effectiveness: Every instruction must be carried out effectively.
❖ Correctness: The algorithms should be error free.
❖ Simplicity: Easy to implement.
❖ Unambiguous: Algorithm should be clear and unambiguous
❖ Independent: An algorithm should have step-by-step directions, which should be independent of any
programming code.
5. Discuss about Linear search algorithm.
Linear search also called sequential search is a sequential method for finding a particular value in a list.
This method checks the search element with each element in sequence until the desired element is found
or the list is exhausted. In this searching algorithm, list need not be ordered.
Pseudo code
1. Traverse the array using for loop
2. In every iteration, compare the target search key value with the current value of the list.
✓ If the values match, display the current index and value of the array.
✓ If the values do not match, move on to the next array element.

..25.. A. Prabhakar - 9442979144


100% 12 – Computer Science
3. If no match is found, display the search element not found.
For example
Consider the following array
a[] = {10, 12, 20, 25, 30} will be as follows,
a
Index 0 1 2 3 4
Values 10 12 20 25 30

If you search for the number 25, the index will return to 3. If the searchable number is not in the array,
for example, if you search for the number 70, it will return -1.
LESSON 5 - PYTHON – VARIABLES AND OPERATORS
6. Explain input() and print() functions with examples.
input( ) function:
In Python, input( ) function is used to accept data as input at run time.
The syntax is,
Variable = input (“prompt string”)
✓ Where, prompt string is a statement or message to the user, to know what input can be given.
Example 1: input( ) with prompt string
>>> city=input (“Enter Your City: ”)
Enter Your City: Madurai
✓ If prompt string is not given in input( ) no message is displayed on the screen, thus, the user will not
know what is to be typed as input.
Example 2:input( ) without prompt string
>>> city=input()
Rajarajan
>>> print (“I am from”, city)
I am from Rajarajan
Note that in the above example, the user will not know what is to be typed as input.
❖ input() accepts all data as string or characters but not as numbers. The int( ) function is used to
convert string data as integer data explicitly.
print() function:
❖ In Python, the print() function is used to display result on the screen.
❖ It displays an entire statement which is specified within print ( ).
The syntax is,
print( “String’’ )
print( “string”, variable )
Examples:
(1) >>>print(“Welcome’’)
Welcome
(2) >>>x = 5
>>>print( “The value of x = ”,x)
The value of x = 5
7. Discuss in detail about Tokens in Python.
Tokens:
❖ Python breaks each logical line into a sequence of elementary lexical components known as Tokens.
❖ The normal token types are 1) Identifiers 2) Keywords 3) Operators 4) Delimiters and 5) Literals.
❖ Whitespace separation is necessary between tokens.

..26.. A. Prabhakar - 9442979144


100% 12 – Computer Science
1) Identifiers:
An Identifier is a name used to identify a variable, function, class, module or object.
➢ An identifier must start with an alphabet (A..Z or a..z) or underscore ( _ ).
➢ Identifiers may contain digits (0 .. 9)
➢ Python identifiers are case sensitive i.e. uppercase and lowercase letters are distinct.
➢ Identifiers must not be a python keyword.
➢ Python does not allow punctuation character such as %,$, @ etc., within identifiers.
Examples : Sum, total_marks, regno, num1
2) Keywords:
➢ Keywords are special words used by Python interpreter to recognize the structure of program.
➢ As these words have specific meaning for interpreter, they cannot be used for any other purpose.
Few python’s keywords are for, while, lamba, del, if, and, or,…
3) Operators:
➢ In computer programming languages operators are special symbols which represent computations,
conditional matching etc.
➢ Operators are categorized as Arithmetic, Relational, Logical, Assignment etc.
➢ Value and variables when used with operator are known as operands.
4) Delimiters:
➢ Python uses the symbols and symbol combinations as delimiters in expressions, lists, dictionaries
and strings.
➢ The following are few delimiters:
( ) [ ] { }
, : . ; ; “
5) Literals:
➢ Literal is a raw data given to a variable or constant.
➢ In Python, there are various types of literals.
1) Numeric 2) String 3) Boolean
LESSON 6 - CONTROL STRUCTRES
8. Write a detail note on for loop.
➢ for loop is the most comfortable loop. It is also an entry check loop.
➢ The condition is checked in the beginning of the loop and if it is True then the body of the loop is
executed, otherwise the loop is not executed.
Syntax:
for counter_variable in sequence:
statements-block 1
[else:
statements-block 2]
✓ The counter_variable mentioned in the syntax is similar to the control variable.
✓ The sequence refers to the initial, final and increment value.
✓ Usually in Python, for loop uses the range() function in the sequence to specify the initial, final and
increment values.
The syntax of range() is
range (start, stop[,step])
where,
start – refers to the initial value
stop – refers to the final value
step – refers to increment value
..27.. A. Prabhakar - 9442979144
100% 12 – Computer Science
Example :
for i in range(2, 10, 2):
print (i, end=' ')
Output:
2468
9. Write a detail note on if .. else .. elif statement with suitable example.
When we need to construct a chain of if statement(s) then ‘elif’ clause can be used instead of ‘else’.
Syntax:
if <condition-1>:
statements-block 1
elif <condition-2>:
statements-block 2
else:
statements-block n
✓ condition-1 is tested if it is true then statements-block1 is executed, otherwise the control checks
condition-2,
✓ if it is true statements-block2 is executed and even if it fails statements-block n mentioned in else
part is executed.
Example:
a=int(input("Enter the first number: "))
b=int(input("Enter the second number: "))
c=int(input("Enter the third number: "))

if (a>b) and (a>c):


print(a, " is the largest number")
elif (b>c):
print(b, " is the largest number ")
else:
print(c, " is the largest number ")
Output:
Enter the first number: 7
Enter the second number: 22
Enter the third number: 15
22 is the largest number
10. Write a program to display all 3 digit odd numbers.
Program:
for i in range(101,1000,2):
print(i, end='\t')
11. Write a program to display multiplication table for a given number.
Program:
n = int(input("Enter a Number :"))
x = int(input("Enter number of terms :"))
for i in range(1, x+1):
print(i, " x ", n, " = ", i*n)

..28.. A. Prabhakar - 9442979144


100% 12 – Computer Science
LESSON 7 - PYTHON FUNCTIONS
12. Explain the different types of function with an example.
Basically, we can divide functions into the following types:
❖ User-defined Functions ❖ Lambda Functions
❖ Built-in Functions ❖ Recursion Functions
User-defined Functions:
We can define our own function. These are called used defined functions. Functions must be defined,
to create and use certain functionality.
Syntax:
def <function_name ([parameter1, parameter2…] )> :
<Block of Statements>
return <expression / None>
Example:
def hello():
print (“hello - Python”) function definition
return
hello() → function calling
Output:
hello – Python
Built-in Functions :
➢ The built-in functions are pre-defined by the python interpreter.
➢ These functions perform a specific task and can be used in any program, depending on the requirement
of the user.
Few functions are
(i) abs() - Returns an absolute value of a number
(ii) max() - Return the maximum value in the list.
Lambda or Anonymous Functions:
➢ In Python, anonymous function is a function that is defined without a name.
➢ While normal functions are defined using the def keyword, in Python anonymous functions are defined
using the lambda keyword. Hence, anonymous functions are also called as lambda functions.
Syntax:
lambda [argument(s)] : expression
Example: Output:
sum = lambda arg1, arg2: arg1 + arg2 The Sum is : 70
print ('The Sum is :', sum(30,40)) The Sum is : 10
print ('The Sum is :', sum(-30,40))
The above lambda function that adds argument arg1 with argument arg2 and stores the result in the
variable sum. The result is displayed using the print().
Recursion Functions:
➢ When a function calls itself is known as recursion.
➢ The condition that is applied in any recursive function is known as base condition.
Example: Output:
def fact(n): 1
if n == 0: 120
return 1
else:
return n * fact (n-1)
print (fact (0))
print (fact (5))

..29.. A. Prabhakar - 9442979144


100% 12 – Computer Science
13. Explain the scope of variables with an example.
Scope of variable refers to the part of the program, where it is accessible.
There are two types of scopes:
i) local scope and
ii) global scope.
Local Scope:
A variable declared inside the function's body or in the local scope is known as local variable.
Rules of local variable
❖ A variable with local scope can be accessed only within the function/block that it is created in.
❖ When a variable is created inside the function/block, the variable becomes local to it.
❖ A local variable only exists while the function is executing.
❖ The format arguments are also local to function.
Example:
def loc():
y = 0 → local scope
print(y)
loc()
Output:
0
Global Scope:
A variable, with global scope can be used anywhere in the program. It can be created by defining a
variable outside the scope of any function/block.
Rules of global Keyword
The basic rules for global keyword in Python are:
❖ When we define a variable outside a function, it’s global by default. You don’t have to use global
keyword.
❖ We use global keyword to read and write a global variable inside a function.
❖ Use of global keyword outside a function has no effect
Example:
c=1 → global variable
def add():
print(c)
add()
Output:
1
14. Explain the following built-in functions.
(a) id() (b) chr() (c) round() (d) type() (e) pow()
(a) id() : (b) chr() :
id( ) Return the “identity” of an object. It returns the Unicode character for the
i.e. the address of the object in memory. given ASCII value.
Syntax: Syntax:
id (object) chr (i)
Example: Example:
x=15 c=65
print ('address of x is :',id (x)) print (chr (c))
Output: Output:
address of x is : 1357486752 A

..30.. A. Prabhakar - 9442979144


100% 12 – Computer Science
(c) round()
It returns the nearest integer to its input. First argument (number) is used to specify the value to be
rounded. Second argument (n digits) is used to specify the number of decimal digits desired after
rounding.
Syntax:
round (number [,ndigits])
Example:
n1=17.89
print (round (n1,1))
Output:
17.9
(d) type() : (e) pow() :
It returns the type of object for the given It returns the computation of ab i.e. (ab ) a
single object. raised to the power of b.
Syntax: Syntax:
type (object) pow (a,b)
Example: Example:
x= 15.2 a= 5
print (type (x)) b= 2
Output: print (pow (a,b))
<class 'float'> Output:
25
LESSON 8 - STRINGS AND STRING MANIPULATION
15. Explain about string operators in python with suitable example.
String Operators
Python provides the following operators for string operations. These operators are useful to manipulate
string.
(i) Concatenation (+)
Joining of two or more strings is called as Concatenation. The plus (+) operator is used to
concatenate strings in python.
Example
>>> "welcome to " + "Python"
welcome to Python'
(ii) Append (+=)
Adding more strings at the end of an existing string is known as append. The operator += is used to
append a new string with an existing string.
Example
>>> str1="Welcome to "
>>> str1+="Learn Python"
>>> print (str1)
Welcome to Learn Python
(iii) Repeating ()
The multiplication operator () is used to display a string in multiple number of times.
Example
>>> str1="Welcome "
>>> print (str14)
Welcome Welcome Welcome Welcome

..31.. A. Prabhakar - 9442979144


100% 12 – Computer Science
(iv) String slicing
Slice is a substring of a main string. A substring can be taken from the original string by using []
operator and index or subscript values.
Syntax:
str[start:end]
Where start is the beginning index and end is the last index value of a character in the string. Python
takes the end value less than one from the actual index specified.
Example:
>>> str1="THIRUKKURAL"
>>> print (str1[0])
T
>>> print (str1[0:5])
THIRU
(v) Stride when slicing string
When the slicing operation, you can specify a third argument as the stride, which refers to the
number of characters to move forward after the first character is retrieved from the string. The default
value of stride is 1.
Example:
>>> str1 = "Welcome to learn Python"
>>> print (str1[10:16])
learn
>>> print (str1[10:16:4])
r
>>> print (str1[10:16:2])
er
LESSON 9 - LISTS, TUPLES, SETS AND DICTIONARY
16. What the different ways to insert an element in a list. Explain with suitable example.
There are three methods are used to insert the elements in a list.
(i) append(): (ii) extend():
In Python, append( ) function is used to add a In python, extend( ) function is used to add
single element to an existing list. more than one element to an existing list.
Syntax: Syntax:
List.append(element to be added) List.extend([elements to be added])
Example: Example:
>>>Marks = [10, 23, 41, 75] >>>Marks = [10, 23, 41, 75]
>>>Marks.append(60) >>>Marks.extend([60,80,55])
>>>print(Marks) >>>print(Marks)
[10, 23, 41, 75, 60] [10, 23, 41, 75, 60,80,55]
(iii) insert():
The insert( ) function is used to insert an element at any position of a list.
Syntax:
List.insert (position index, element)
Example:
>>>Marks = [10, 23, 41, 75]
>>>Marks.insert(2,60)
>>>print(Marks)
[10, 23, 60, 41, 75]
While inserting a new element in between the existing elements, at a particular location, the existing
elements shifts one position to the right.
..32.. A. Prabhakar - 9442979144
100% 12 – Computer Science
17. Explain the different set operations supported by python with suitable example.
Python supports the set operations such as Union, Intersection, Difference and Symmetric difference.
(i) Union:
➢ It includes all elements from two or more sets.
➢ In python, the operator | and the function union( ) are used to join two sets in python.
Example:
set_A = {2,4,6,8}
set_B = {'A', 'B', 'C', 'D'}
print(set_A|set_B) (OR) print(set_A.union(set_B)
Output:
{2, 4, 6, 8, 'A', 'D', 'C', 'B'}
(ii) Intersection:
➢ It includes the common elements in two sets.
➢ The operator & and the function intersection( ) are used to intersect two sets in python.
Example:
set_A={'A', 2, 4, 'D'}
set_B={'A', 'B', 'C', 'D'}
print(set_A & set_B) (OR) print(set_A.intersection(set_B))
Output:
{'A', 'D'}
(iii) Difference:
➢ It includes all elements that are in first set but not in the second set.
➢ The minus (-) operator and the function difference( ) are used to difference operation.
Example:
set_A={'A', 2, 4, 'D'} .
set_B={'A', 'B', 'C', 'D'}
print(set_A - set_B) (OR) print(set_A.diff erence(set_B))
Output:
{2, 4}
(iv) Symmetric difference:
➢ It includes all the elements that are in two sets but not the one that are common to two sets.
➢ The caret (^) operator and the function symmetric_difference() are used to symmetric difference
set operation in python.
Example:
set_A={'A', 2, 4, 'D'}
set_B={'A', 'B', 'C', 'D'}
print(set_A ^ set_B) (OR) print(set_A.symmetric_difference(set_B))
Output:
{2, 4, 'B', 'C'}

..33.. A. Prabhakar - 9442979144


100% 12 – Computer Science
LESSON 10 - PYTHON CLASSES AND OBJECTS
18. Explain about constructor and destructor with suitable example.
Constructor:
Constructor is the special function that is automatically executed when an object of a class is created. In
Python, there is a special function called “init” which act as a Constructor. It must begin and end with double
underscore.
Syntax:
def __init__(self, [args ……..]):
<statements>
Example:
def __init__(self, [args ……..]):
<statements>
class Sample:
def __init__(self, num):
print("Constructor of class Sample...")
self.num=num
print("The value is :", num)
S=Sample(10)
✓ The above constructor gets executed automatically, when an object S is created with actual parameter
10.
Thus, the Python display the following output.
Constructor of class Sample...
The value is : 10
Destructor:
Destructor is also a special method gets executed automatically when an object exit from the scope. It
is just opposite to constructor. In Python, __del__( ) method is used as destructor.
Syntax:
def __del__(self):
<statements>
Example:
class sample:
def __del__(self):
print("Destructor of class Sample...")
s=sample(5)
✓ In the example above, when the accessibility of the object S goes out of scope, the destructor is executed
automatically.
✓ Thus, the Python display the following output.
Destructor of class Sample...

..34.. A. Prabhakar - 9442979144


100% 12 – Computer Science
LESSON 11 - DATABASE CONCEPTS
19. Explain the different types of data model.
1. Hierarchical Model:
➢ Hierarchical model was developed by IBM. School
➢ In Hierarchical model, data is represented as a simple
tree like structure form. This model represents a
one-to-many relationshipi.e., parent-child Course Resources
relationship.
➢ One child can have only one parent but one parent
can have many children. Theory Lab
➢ This model is mainly used in IBM Main Frame
computers.
2. Relational Model:
➢ The Relational Database model was first proposed by E.F. Codd in 1970.
➢ Nowadays, it is the most widespread data model used for database applications around the world.
➢ The basic structure of data in relational model is tables (relations).
➢ All the information’s related to a particular type is stored in rows of that table.
➢ A relation key is an attribute which uniquely identifies a particular tuple.

Stu_id Name Age Sub_id Subject Teacher


1 Aruna 17 1 Tamil Jegan
2 Prabhakar 16 2 Maths Veni
3 Aakash 15 3 Science Jeya

Stu_id Sub_id Marks


1 1 98
2 2 87
3 2 75
3. Network Model:
➢ Network database model is an extended form of hierarchical data model.
➢ The difference between hierarchical and Network data model is:
❖ In hierarchical model, a child record has only one parent node.
❖ In a Network model, a child may have many parent nodes. It represents the data in many-
to-many relationships.
❖ This model is easier and faster to access the data.

School Parent Node

Library Office Staff Room Child to School (Parent Node)

Student has 3 Parents


Student (one to many relationship)

..35.. A. Prabhakar - 9442979144


100% 12 – Computer Science
4. Entity Relationship Model (ER model):
➢ In this database model, relationships are created by dividing the object into entity and its
characteristics into attributes.
➢ It was developed by Chen in 1976.
➢ This model is useful in developing a conceptual design for the database.
➢ It is very simple and easy to design logical view of data.
➢ The different shapes used in ER diagram is
✓ Rectangle represents the entities.
Example: Doctor and Patient
✓ Ellipse represents the attributes.
Example: D-id, D-Name, P-id and P-Name
✓ Diamond represents the relationships.
Example: Doctor diagnosis the Patient

Doctor Patient
Diagnosis

D-id D-Name P-id P-Name

5. Object Model:
➢ Object model stores the data in the form of objects, attributes and methods, classes and Inheritance.
➢ This model handles more complex applications, such as Geographic information System (GIS),
scientific experiments, engineering design and manufacturing.
➢ It is used in file Management System.
➢ It represents real world objects, attributes and behaviours.
Example:

Shape
get_area()
get_perimeter(
)

Circle Rectangle Triangle


radius length base
breadth height

where,
✓ Shape is the class.
✓ Circle, Rectangle and Triangle are objects of class Shape.
✓ radius, length, breadth, base and height are attributes.
✓ get_area() and get_perimeter() are the methods.

..36.. A. Prabhakar - 9442979144


100% 12 – Computer Science
20. Explain the different types of relationship mapping
Student Exam No
1. One-to-One Relationship:
➢ In One-to-One Relationship, one entity is related with only
one other entity. Ram 1001

➢ One row in a table is linked with only one row in another Vignesh 1002
table and vice versa.
Anand 1003
For example:
A student can have only one exam number.

Staff
2. One-to-Many Relationship: Department

➢ In One-to-Many relationship, one entity is related to many Jiya

other entities. Tamil Aruna


➢ One row in a table A is linked to many rows in a table B, but
one row in a table B is linked to only one row in table A. Maths Prabhu

For example:
Comput Anand
One Department has many staff members. er
Raj
a
3. Many-to-One Relationship:
Staff Department
➢ In Many-to-One Relationship, many entities can be related
with only one in the other entity.
➢ Multiple rows in staff members table is related with only one Rifaya Maths

row in Department table. h


Vignes Computer
For example: h
A number of staff members working in one Department. Anand

Book Student
4. Many-to-Many Relationship:
➢ A many-to-many relationship occurs when multiple records in
a table are associated with multiple records in another table. Python Sumitha
For example:
Many Books in a Library are issued to many students. SQL Jino

C++ Anbu

..37.. A. Prabhakar - 9442979144


100% 12 – Computer Science
LESSON 12 - STRUCTURED QUERY LANGUAGE (SQL)
21. Write the different types of constraints and their functions.
Constraints ensure database integrity, therefore known as database integrity constraints. The different
types of constraints are as follows
(i) Unique Constraint:
➢ This constraint ensures that no two rows have the same value in the specified columns.
➢ For example, UNIQUE constraint applied on Admno of student table ensures that no two students
have the same admission number and the constraint can be used as:
CREATE TABLE Student
(
Admno integer NOT NULL UNIQUE, → Unique constraint
Name char (20) NOT NULL
);
(ii) Primary Key Constraint:
➢ It is similar to unique constraint except that only one field of a table can be set as primary key which
helps to uniquely identify a record.
➢ The primary key does not allow NULL values and therefore a field declared as primary key must
have the NOT NULL constraint.
➢ Example,
CREATE TABLE Student
(
Admno integer NOT NULL PRIMARY KEY, → Primary Key constraint
Name char(20)NOT NULL
);
(iii) DEFAULT Constraint:
➢ The DEFAULT constraint is used to assign a default value for the field.
➢ When no value is given for the specified field having DEFAULT constraint, automatically the default
value will be assigned to the field.
(iv) CHECK Constraint:
➢ This constraint helps to set a limit value placed for a field. When we define a check constraint on a
single column, it allows only the restricted values on that field.
(v) TABLE Constraint:
➢ When the constraint is applied to a group of fields of the table, it is known as Table constraint. The
table constraint is normally given at the end of the table definition.
CREATE TABLE Student
(
Admno integer NOT NULL,
Firstname char(20),
Lastname char(20),
Gender char(1) DEFAULT=’M’, → Default constraint
Age integer CHECK (Age <= 19), → Check constraint
PRIMARY KEY (Firstname, Lastname) → Table constraint
);

..38.. A. Prabhakar - 9442979144


100% 12 – Computer Science
22. Consider the following employee table. Write SQL commands for the questions. (i) to (v).

EMP CODE NAME DESIG PAY ALLO WANCE


S1001 Hariharan Supervisor 29000 12000
P1002 Shaji Operator 10000 5500
P1003 Prasad Operator 12000 6500
C1004 Manjima Clerk 8000 4500
M1005 Ratheesh Mechanic 20000 7000
(i) To display the details of all employees in descending order of pay.
(ii) To display all employees whose allowance is between 5000 and 7000.
(iii) To remove the employees who are mechanic.
(iv) To add a new row.
(v) To display the details of all employees who are operators.
SQL COMMANDS:
i) SELECT * FROM EMPLOYEE ORDER BY PAY DESC;
ii) SELECT * FROM EMPLOYEE WHERE ALLOWANCE BETWEEN 5000 AND 7000;
iii) DELETE FROM EMPLOYEE WHERE DESIG='MECHANIC';
iv) INSERT INTO EMPLOYEE VALUES ('S1006', 'RAJESH', 'MECHANIC', 20000, 7000);
v) SELECT * FROM EMPLOYEE WHERE DESIG='OPERATOR';
23. Write a SQL statement to create a table for employee having any five fields and create a table
constraint for the employee table.
CREATE TABLE EMPLOYEE
(
EMPCODE CHAR(20),
NAME CHAR(20),
DESIG VARCHAR(20),
PAY INTEGER,
ALLOWANCE INTEGER,
PRIMARY KEY(EMPCODE) → Table constraint
);
LESSON 13 - PYTHON AND CSV FILES
24. Differentiate Excel file and CSV file.
Excel CSV
Excel is a binary file that holds information about all CSV format is a plain text format with a series of
the worksheets in a file, including both content and values separated by commas.
formatting.
XLS files can only be read by applications that have CSV can be opened with any text editor in
been especially written to read their format, and can Windows like notepad, MS Excel, OpenOffice,
only be written in the same way. etc.
Excel is a spreadsheet that saves files with the CSV is a format for saving tabular information
extension “.xls” or “.xlsx” into a delimited text file with extension “.csv”
Excel consumes more memory while importing data. Importing CSV files can be much faster, and it also
consumes less memory.

..39.. A. Prabhakar - 9442979144


100% 12 – Computer Science
LESSON 14 - IMPORTING C++ PROGRAMS IN PYTHON
25. Write any 5 features of Python.
❖ Python uses Automatic Garbage Collection whereas C++ does not.
❖ C++ is a statically typed language, while Python is a dynamically typed language.
❖ Python runs through an interpreter, while C++ is pre-compiled.
❖ Python code tends to be 5 to 10 times shorter than that written in C++.
❖ In Python, there is no need to declare types explicitly where as it should be done in C++.
❖ In Python, a function may accept an argument of any type, and return multiple values without any kind
of declaration beforehand. Whereas in C++ return statement can return only one value.
❖ LESSON 16 - DATA VISUALIZATION USING PYTHON:
❖ LINE CHART, PIE CHART AND BAR CHART
26. Explain the various buttons in a matplotlib window.

➢ Home Button → The Home Button will help to return back to the original view.
➢ Forward/Back buttons → These buttons can be used to move back to the previous point you were at,
or forward again.
➢ Pan Axis → This cross-looking button allows you to click it, and then click and drag your graph around.
➢ Zoom → The Zoom button lets you click on it, then click and drag a square that you would like to zoom
into specifically. Zooming in will require a left click and drag. You can alternatively zoom out with a right
click and drag.
➢ Configure Subplots → This button allows you to configure various spacing options with your figure and
plot.
➢ Save Figure → This button will allow you to save your figure in various forms.
27. Explain the purpose of the following functions:
a. plt.xlabel
It is used to assign label for X-axis.
b. plt.ylabel
It is used to assign label for Y-axis.
c. plt.title
It is used to assign title for the chart.
d. plt.legend()
It is used to add legend for the data plotted. It is needed when more data are plotted in
the chart.
e. plt.show()
It is used to display our plot.

வாழ்த்துகளுடன்
அருணா பப்ளிககஷன்ஸ்

..40.. A. Prabhakar - 9442979144

You might also like