+2 CS One Mark RM
+2 CS One Mark RM
COMPUTER SCIENCE
CHAPTER 1
FUNCTION
PART – I
CHOOSE THE BEST ANSWER:
1. The small sections of code that are used to 6. Which of the following are mandatory to write the
perform a particular task is called type annotations in the function definition?
(A) Subroutines (B) Files (A) Curly braces (B) Parentheses
(C) Pseudo code (D) Modules (C) Square brackets (D) indentations
2. Which of the following is a unit of code that is 7. Which of the following defines what an object
often defined within a greater code structure? can do?
(A) Subroutines (B) Function (A) Operating System (B) Compiler
(C) Files (D) Modules (C) Interface (D) Interpreter
3. Which of the following is a distinct syntactic 8. Which of the following carries out the instructions
block? defined in the interface?
(A) Subroutines (B) Function (A) Operating System (B) Compiler
(C) Definition (D) Modules (C) Implementation (D) Interpreter
4. The variables in a function definition are called 9. The functions which will give exact result when
as same arguments are passed are called
(A) Subroutines (B) Function (A) Impure functions (B) Partial Functions
(C) Definition (D) Parameters (C) Dynamic Functions (D) Pure functions
5. The values which are passed to a function 10. The functions which cause side effects to the
definition are called arguments passed are called
(A) Arguments (B) Subroutines (A) Impure function (B) Partial Functions
(C) Function (D) Definition (C) Dynamic Functions (D) Pure functions
CHAPTER 2
DATA ABSTRACTION
1
8. Bundling two values together into one can be (A) Tuples (B) Lists
considered as (C) Classes (D) quadrats
(A) Pair (B) Triplet
(C) single (D) quadrat 10. Which of the following is constructed by placing
expressions within square brackets?
9. Which of the following allow to name the various (A) Tuples (B) Lists
parts of a multi-item object? (C) Classes (D) quadrats
CHAPTER 3
SCOPING
2. The process of binding a variable name with an 7. Which of the following security technique that
object is called regulates who can use resources in a
(A) Scope (B) Mapping computing environment?
(C) late binding (D) early binding (A) Password (B) Authentication
(C) Access control (D) Certification
3. Which of the following is used in programming
languages to map the variable and object? 8. Which of the following members of a class can
(A) :: (B) := (C) = (D) == be handled only from within the class?
(A) Public members (B) Protected members
4. Containers for mapping names of variables to (C) Secured members (D) Private members
objects is called
(A) Scope (B) Mapping 9. Which members are accessible from outside the
(C) Binding (D) Namespaces class?
(A) Public members (B) Protected members
5. Which scope refers to variables defined in (C) Secured members (D) Private members
current function?
(A) Local Scope (B) Global scope 10. The members that are accessible from within
(C) Module scope (D) Function Scope the class and are also available to its sub-
classes is called
(A) Public members (B) Protected members
(C) Secured members (D) Private members
CHAPTER 4
ALGORITHMIC STRATEGIES
1. The word comes from the name of a Persian 2. From the following sorting algorithms which
mathematician Abu Ja’far Mohammed ibn-i algorithm needs the minimum number of
Musa al Khowarizmi is called? swaps?
(A) Flowchart (B) Flow (A) Bubble sort (B) Insertion sort
(C) Algorithm (D) Syntax (C) Selection sort (D) All the above
2
3. Two main measures for the efficiency of an 7. Time complexity of bubble sort in best case is
algorithm are (A) θ (n) (B) θ (nlogn)
(A) Processor and memory (C) θ (n2) (D) θ (n(logn) 2)
(B) Complexity and capacity
(C) Time and space (D) Data and space 8. The Θ notation in asymptotic evaluation
represents
4. The complexity of linear search algorithm is (A) Base case (B) Average case
(A) O(n) (B) O(log n) (C) Worst case (D) NULL case
(C) O(n2) (D) O(n log n)
9. If a problem can be broken into subproblems
5. From the following sorting algorithms which has which are reused several times, the problem
the lowest worst case complexity? possesses which property?
(A) Bubble sort (B) Quick sort (A) Overlapping subproblems
(C) Merge sort (D) Selection sort (B) Optimal substructure
(C) Memoization (D) Greedy
6. Which of the following is not a stable sorting
algorithm? 10. In dynamic programming, the technique of
(A) Insertion sort (B) Selection sort storing the previously calculated values is
(C) Bubble sort (D) Quick sort called?
(A) Saving value property
(B) Storing value property
(C) Memoization (D) Mapping
Chapter - 5
PYTHON - VARIABLES AND OPERATORS
1. Who developed Python?
(A) Ritche (B) Guido Van Rossum 6. Which of the following is not a token?
(C) Bill Gates (D) Sunder Pitchai (A) Interpreter (B) Identifiers
(C) Keyword (D) Operators
2. The Python prompt indicates that Interpreter is
ready to accept instruction. 7. Which of the following is not a Keyword in
(A) >>> (B) <<< Python?
(C) # (D) << (A) break (B) while
(C) continue (D) operators
3. Which of the following shortcut is used to create
new Python Program? 8. Which operator is also called as Comparative
(A) Ctrl + C (B) Ctrl + F operator?
(C) Ctrl + B (D) Ctrl + N (A) Arithmetic (B) Relational
(C) Logical (D) Assignment
4. Which of the following character is used to give
comments in Python Program? 9. Which of the following is not logical operator?
(A) # (B) & (A) and (B) Or
(C) @ (D) $ (C) Not (D) Assignment
5. This symbol is used to print more than one item 10. Which operator is also called as Conditional
on a single line. operator?
(A) Semicolon(;) (B) Dollor($) (A) Ternary (B) Relational
(C) comma(,) (D) Colon(:) (C) Logical (D) Assignment
3
Chapter – 6
CONTROL STRUCTURES
1. How many important control structures are there 7. What is the output of the following snippet?
in Python? i=1
(A) 3 (B) 4 while True:
(C) 5 (D) 6 if i%3 ==0:
break
2. elif can be considered to be abbreviation of print(i,end='')
(A) nested if (B) if..else i +=1
(C) else if (D) if..elif (A) 12 (B) 123
(C) 1234 (D) 124
3. What plays a vital role in Python programming?
(A) Statements (B) Control 8. What is the output of the following snippet?
(C) Structure (D) Indentation T=1
while T:
4. Which statement is generally used as a print(True)
placeholder? break
(A) continue (B) break (A) False (B) True
(C) pass (D) goto (C) 0 (D) no output
5. The condition in the if statement should be in the 9. Which amongst is not a jump statement?
form of (A) for (B) goto
(A) Arithmetic or Relational expression (C) continue (D) break
(B) Arithmetic or Logical expression
(C) Relational or Logical expression 10. Which punctuation should be used in the block?
(D) Arithmetic if <condition>……..
statements-block 1
6. Which is the most comfortable loop? else:
(A) do..while (B) while statements-block 2
(C) for (D) if..elif (A) ; (B) :
(C) :: (D) !
Chapter – 7
PYTHON FUNCTIONS
1. A named blocks of code that are designed to do 3. Which function is called anonymous un-named
one specific job is called as function?
(A) Loop (B) Branching (A) Lambda (B) Recursion
(C) Function (D) Block (C) Function (D) define
2. A Function which calls itself is called as 4. Which of the following keyword is used to begin
(A) Built-in (B) Recursion the function block?
(C) Lambda (D) return (A) define (B) for
(C) finally (D) def
4
5. Which of the following keyword is used to exit a (II) Python keywords can be used as function
function block? name.
(A) define (B) return (A) I is correct and II is wrong
(C) finally (D) def (B) Both are correct
(C) I is wrong and II is correct
6. While defining a function which of the following (D) Both are wrong
symbol is used.
(A) ; (semicolon) (B) . (dot) 9. Pick the correct one to execute the given
(C) : (colon) (D) $ (dollar) statement successfully.
if : print(x, " is a leap year")
7. In which arguments the correct positional order is (A) x%2=0 (B) x%4==0
passed to a function? (C) x/4=0 (D) x%4=0
(A) Required (B) Keyword
(C) Default (D) Variable-length 10. Which of the following keyword is used to
define the function testpython()?
8. Read the following statement and choose the (A) define (B) pass
correct statement(s). (C) def (D) while
(I) In Python, you don’t have to mention the specific
data types while defining function.
Chapter – 8
STRINGS AND STRING MANIPULATION
1. Which of the following is the output of the
following python code? 6. Which of the following is the slicing operator?
str1="TamilNadu" (A) { } (B) [ ] (C) < > (D) ( )
print(str1[::-1])
(A) Tamilnadu (B) Tmlau
(C) udanlimaT (D) udaNlimaT 7. What is stride?
(A) index value of slide operation
2. What will be the output of the following code? (B) first argument of slice operation
str1 = "Chennai Schools" (C) second argument of slice operation
str1[7] = "-" (D) third argument of slice operation
(A) Chennai-Schools (B) Chenna-School
(C) Type error (D) Chennai
8. Which of the following formatting character is
3. Which of the following operator is used for used to print exponential notation in upper case?
concatenation? (A) %e (B) %E (C) %g (D) %n
(A) + (B) & (C) * (D) =
9. Which of the following is used as placeholders or
4. Defining strings within triple quotes allows replacement fields which get replaced along with
creating: format( ) function?
(A) Single line Strings (B) Multiline Strings
(A) { } (B) < > (C) ++ (D) ^^
(C) Double line Strings (D) Multiple Strings
5
Chapter – 9
LISTS, TUPLES, SETS AND DICTIONARY
5. If List=[17,23,41,10] then List.append(32) will 10. Let setA={3,6,9}, setB={1,3,9}. What will be the
result result of the following snippet?
(A) [32,17,23,41,10] (B) [17,23,41,10,32] print(setA|setB)
(C) [10,17,23,32,41] (D) [41,32,23,17,10] (A) {3,6,9,1,3,9} (B) {3,9}
(C) {1} (D) {1,3,6,9}
6. Which of the following Python function can be
used to add more than one element within an 11. Which of the following set operation includes all
existing list? the elements that are in two sets but not the
(A) append( ) (B) append_more( ) one that are common to two sets?
(C) extend( ) (D) more( ) (A) Symmetric difference (B) Difference
(C) Intersection (D) Union
7. What will be the result of the following Python
code? 12. The keys in Python, dictionary is specified by
S=[x**2 for x in range(5)] (A) = (B) ; (C)+ (D) :
Chapter – 10
CLASSES AND OBJECTS
1. Which of the following are the key features of an 3. Class members are accessed through which
Object Oriented Programming language? operator?
(A) Constructor and Classes (A) & (B) . (C) # (D) %
(B) Constructor and Object
(C) Classes and Objects 4. Which of the following method is automatically
(D) Constructor and Destructor executed when an object is created?
(A) object ( ) (B) del ( )
2. Functions defined inside a class: (C) func ( ) (D) init ( )
(A) Functions (B) Module
(C) Methods (D) section 5. A private class variable is prefixed with
(A) (B) && (C) ## (D) **
6
6. Which of the following method is used as self.name=name
destructor? print(name)
(A) init ( ) (B) dest ( ) S=Student(“Tamil”)
(C) rem ( ) (D)_ del_ ( )
(A) Error (B) Tamil
(C) name (D) self
7. Which of the following class declaration is
correct?
9. Which of the following is the private class
(A) class class_name
variable?
(B) class class_name<>
(A) num (B) ##num
(C) class class_name:
(C) $$num (D) &&num
(D) class class_name[ ]
CHAPTER 11
DATABASE CONCEPTS
Chapter 12
STRUCTURED QUERY LANGUAGE
7
1. Which commands provide definitions for creating (C) Create, Reset, Update, Download
table structure, deleting relations, and modifying (D) Create, Read, Update, Delete
relation schemas?
(A) DDL (B) DML 9. Expand: DDL
(C) DCL (D) DQL (A) Data Definition Language
(B) Data Delivery Language
2. Which command lets to change the structure of (C) Data Defined Link
the table? (D) Data Delivery Link
(A) SELECT (B) ORDER BY
(C) MODIFY (D) ALTER 10. Expand: DML
(A) Data Maintenance Link
3. The command to delete a table including the (B) Data Manipulation Link
structure is (C) Data Maintenance Language
(A) DROP (B) DELETE (D) Data Manipulation Language
(C) DELETE ALL (D) ALTER TABLE
11. Expand: EDML
4. Queries can be generated using (A) Export Data Maintenance Link
(A) SELECT (B) ORDER BY (B) Embedded Data Maintenance Link
(C) MODIFY (D) ALTER (C) Embedded Data Manipulation Language
(D) Export Data Manipulation Language
5. The clause used to sort data in a database
(A) SORT BY (B) ORDER BY 12. Expand: DCL
(C) GROUP BY (D) SELECT (A) Data Connect Language
(B) Data Connect Link
6. Expand: SQL (C) Data Control Link
(A) Structured Query Language . (D) Data Control Language
(B) Structured Question Language
(C) Sorted Query Language 13. Expand: TCL
(D) Sorted Question Language (A) Transfer Connect Link
(B) Transaction Connect Language
7. Expand: RDBMS (C) Transaction Control Language
(A) Regional Data Base Maintenance System (D) Transfer Control Link
(B) Relational Data Base Maintenance System
(C) Regional Data Base Management System 14. Expand: DQL
(D) Relational Data Base Management System (A) Data Question Language
(B) Data Query Language
8. CRUD means (C) Data Question Link
(A) Create, Retrieved, Upload, Delete (D) Data Query Link
(B) Change, Read, Upload, Delete
Chapter 13
PYTHON AND CSV FILES
1. A CSV file is also known as a
(A) Flat File (B) 3D File 3. Which of the following module is provided by
(C) String File (D) Random File Python to do several operations on the CSV
files?
2. The expansion of CRLF is (A) py (B) xls
(A) Control Return and Line Feed (C) csv (D) os
(B) Carriage Return and Form Feed
(C) Control Router and Line Feed
(D) Carriage Return and Line Feed
8
4. Which of the following mode is used when (D) chennai,mylapore
dealing with non-text files like image or exe mumbai,andheri
files?
(A) Text mode (B) Binary mode 8. Which of the following creates an object which
(C) xls mode (D) csv mode maps data to a dictionary?
(A) listreader( ) (B) reader( )
5. The command used to skip a row in a CSV file is (C) tuplereader( ) (D) DicReader( )
(A) next( ) (B) skip( )
(C) omit( ) (D) bounce( ) 9. Making some changes in the data of the existing
file or adding more data is called
6. Which of the following is a string used to (A) Editing (B) Appending
terminate lines produced by writer() method of (C) Modification (D) Alteration
csv module?
(A) Line Terminator (B) Enter key 10. What will be written inside the file test.csv using
(C) Form feed (D) Data Terminator the following program?
import csv
7. What is the output of the following program? D = [['Exam'],['Quarterly'],['Halfyearly']]
import csv csv.register_dialect('M',lineterminato
d=csv.reader(open('c:\......\ ...... \city.csv')) r = '\n')
next(d) with open('c:\pyprg\ch13\line2.csv',
for row in d: 'w') as f:
print(row) wr = csv.writer(f,dialect='M')
wr.writerows(D)
if the file called “city.csv” contain the following f.close()
details (A) Exam Quarterly Halfyearly
chennai,mylapore (B) Exam Halfyearly Quarterly
mumbai,andheri (C) E
Q
(A) chennai,mylapore H
(B) mumbai,andheri (D) Exam,
Quarterly
(C) chennai Halfyearly
mumbai
CHAPTER 14
IMPORTING C++ PROGRAMS IN PYTHON
9
(D) Procedure oriented Programming if name ==' main ':
main(sys.argv[1:])
6. The module which allows you to interface with (A) main(sys.argv[1:]) (B) name
the Windows operating system is (C) main (D) argv
(A) OS module (B) sys module
(C) csv module (D) getopt module 9. Which of the following can be used for
processing text, numbers, images, and
7. getopt( ) will return an empty array if there is no scientific data?
error in splitting strings to (A) HTML (B) C
(A) argv variable (B) opt variable (C) C++ (D) PYTHON
(C) args variable (D) ifile variable
10. What does name contains ?
8. Identify the function call statement in the (A) C++ filename (B) main( ) name
following snippet. (C) Python filename (D) OS module name
CHAPTER 15
DATA MANIPULATION THROUGH SQL
4. Any changes made in the values of the record 9. The most commonly used statement in SQL is
should be saved by the command (A) cursor (B) select
(A) Save (B) Save As (C) execute (D) commit
(C) Commit (D) Oblige
10. Which of the following clause avoid the
5. Which of the following executes the SQL duplicate?
command to perform some action? (A) Distinct (B) Remove
(A) Execute() (B) Key() (C) Where (D) GroupBy
(C) Cursor() (D) run()
Chapter 16
DATA VISUALIZATION USING PYPLOT:
LINE CHART, PIE CHART AND BAR CHART
10
1. Which is a python package used for 2D
graphics? 4. Read the following code: Identify the purpose of
(A) matplotlib.pyplot (B) matplotlib.pip this code and choose the right option from the
(C) matplotlib.numpy (D) matplotlib.plt following.
C:\Users\Your
2. Identify the package manager for Python Name\AppData\Local\Programs\Python\Pyt
packages, or modules. hon36-32\Scripts>pip list
(A) Matplotlib (B) PIP (A) List installed packages (B) list command
(C) plt.show( ) (D) python package (C) Install PIP (D) packages installed
3. Read the following code: Identify the purpose of 5. To install matplotlib, the following command will
this code and choose the right option from the be typed in your command prompt.
following. What does “-U”represents?
C:\Users\YourName\AppData\Local\Progra Python –m pip install –U matplotlib
ms\Python\Python36-32\Scripts>pip – (A) downloading pip to the latest version
version (B) upgrading pip to the latest version
(A) Check if PIP is Installed (B) Install PIP (C) removing pip
(C) Download a Package (D)Check PIP version (D) upgrading matplotlib to the latest version
6. Observe the output figure. Identify the coding for obtaining this output.
11
plt.show()
Identify the output for the above coding.
(A) (B)
(C) (D)
***************
12