Docsity

CBSE class 12 computer science model paper for 2021, Exams of Computer science

Partial preview of the text

Download CBSE class 12 computer science model paper for 2021 and more Exams Computer science in PDF only on Docsity!

Computer Science [ 083 ]

Based on Latest CBSE Exam Pattern

for the Session 2021 - 22

Class - XII

Multiple Choice Question Bank

[MCQ ] Term – I & Term- II

QUESTION BANK

TABLE OF CONTENTS

S. No. TERM - 1 TERM - 2 (Click the LINK to directly reach the content) Page Number (Click the LINK to directly reach the content) Page Number 1 DISTRIBUTION OF MARKS 06 DISTRIBUTION OF MARKS 05 2 SYLLABUS 07-10 SYLLABUS 06- 3 COMPUTATIONAL THINKING AND PROGRAMMING - 2 12-57 COMPUTER NETWORKS 97- DATABASE MANAGEMENT 130- 4 MODEL QUESTION PAPER SET 1 SET 2 SET 3 58-92 MODEL QUESTION PAPER SET 1 SET 2 SET 3 159-

  • TERM-
  • Precedence of operators:

( ) Parentheses Highest

Low

** Exponentiation

~ x Bitwise nor

+x, - x Positive, Negative (Unary +, - )

*(multiply), / (divide),//(floor division), %(modulus)

+(add),-(subtract)

& Bitwise and

^ Bitwise XOR

| Bitwise OR

<(less than),<=(less than or equal),>(greater than), >=(greater than or

equal to), ==(equal),!=(not equal)

is , is not

not x Boolean NOT

and Boolean AND

or Boolean OR

Data type:

There are following basic types of variable in as explained in last chapter:

Type Description

bool Stores either value True or False.

int Stores whole number.

float Stores numbers with fractional part.

Complex Stores a number having real and imaginary part (a+bj)

String Stores text enclosed in single or double quote

List

Stores list of comma separated values of any data type

between square [ ] brackets.(mutable )

Tuple

Stores list of comma separated values of any data type

between parentheses ( ) (immutable)

Dictionary

Unordered set of comma-separated key:value pairs ,

within braces {}

All questions are of 1 mark.

Q.No. Question

  1. Which of the following is a valid identifier: i. 9type ii. _type iii. Same-type iv. True
  2. Which of the following is a relational operator: i. > ii. // iii. or iv. **
  3. Which of the following is a logical operator: i. + ii. /= iii. and iv. in
  4. Identify the membership operator from the following: i. in ii. not in iii. both i & ii iv. Only i
  5. Which one is a arithmetic operator: i. not ii. ** iii. both i & ii iv. Only ii
  6. What will be the correct output of the statement : >>>4//3. i. 1 ii. 1.0 iii 1.3333 iv. None of the above
  7. What will be the correct output of the statement : >>> 4+2*2 i. 18 ii. 80 iii. 44 iv. None of the above
  8. Give the output of the following code:

    a,b=4, a+b*2 i. 44 ii. 48 iii. 40 iv. 88

  9. Give the output of the following code:

    a,b = 4,2. a-b//2** i. 4.0 ii. 4 iii. 0 iv. None of the above

  10. Give the output of the following code:

    a,b,c=1,2, a//b*c+a-ca i. - 2 ii. - 2.0 iii. 2.0 iv. None of the above

  11. If a=1,b=2 and c= 3 then which statement will give the output as : 2.0 from the following: i. >>>a%b%c+1 ii. >>>a%b%c+1.0 iii. >>>a%b%c iv. a%b%c- 1
  12. Which statement will give the output as : True from the following : i. >>>not - 5 ii. >>>not 5 iii. >>>not 0 iv. >>>not(5-1)
  13. Give the output of the following code:

    7*(8/(5//2)) i. 28 ii. 28.0 iii. 20 iv. 60

  14. Give the output of the following code:

    import math math.ceil(1.03)+math.floor(1.03) i. 3 ii. - 3 .0 iii. 3 .0 iv. None of the above

  15. What will be the output of the following code:

    import math math.fabs(-5.03) i. 5.0 ii. 5.03 iii. - 5.03 iv. None of the above

  16. Single line comments in python begin with……………….. symbol. i. # ii. “ iii. % iv. _
  17. Which of the following are the fundamental building block of a python program. i. Identifier ii. Constant iii. Punctuators iv. Tokens
  18. The input() function always returns a value of ……………..type. i. Integer ii. float iii. string iv. Complex
  19. ……….. function is used to determine the data type of a variable. i. type( ) ii. id( ) iii. print( ) iv. str( )
  20. The smallest individual unit in a program is known as a…………… i. Token ii. keyword iii. punctuator iv. identifier
  1. Which of the following is not a decision making statement i. if..else statement ii. for statement iii. if-elif statement iv. if statement
  2. …………loop is the best choice when the number of iterations are known. i. while ii. do-while iii. for iv. None of these
  3. How many times will the following code be executed. a= while a>0: print(a) print(“Bye”) i. 5 times ii. Once iii. Infinite iv. None of these
  4. What abandons the current iteration of the loop i. continue ii. stop iii. infinite iv. Break
  5. Find the output of the following python program for i in range(1,15,4): print(i, end=’,’) i. 1,20,3 ii. 2,3,4 iii. 1,5,10,14 iv. 1,5,9,
  6. …………loop is the best when the number of iterations are not known. i. while ii. do-while iii. for iv. None of these
  7. In the nested loop ……………..loop must be terminated before the outer loop. i. Outer ii. enclosing iii. inner iv. None of these
  8. …………..statement is an empty statement in python. i. pass ii. break iii. continue iv. if
  9. How many times will the following code be executed for i in range(1,15,5): print(i,end=’,’) i. 3 ii. 4 iii. 1 iv. infinite
  10. Symbol used to end the if statement: i. Semicolon(;) ii. Hyphen(-) iii. Underscore( _ ) iv. colon(:)

String: Text enclosed inside the single or double quotes referred as String.

String Operations: String can be manipulated using operators like concatenation (+),

repetition (*) and membership operator like in and not in.

Operation Description

Concatenation Str1 + Str

Repetition Str * x

Membership in , not in

Comparison str1 > str

Slicing String[range]

String Methods and Built-in functions:

Function Description

len() Returns the length of the string.

capitalize() Converts the first letter of the string in uppercase

split() Breaks up a string at the specified separator and returns a list of substrings.

replace() It replaces all the occurrences of the old string with the new string.

find() It is used to search the first occurrence of the substring in the given string.

index()

It also searches the first occurrence and returns the lowest index of the

substring.

isalpha()

It checks for alphabets in an inputted string and returns True in string

contains only letters.

isalnum() It returns True if all the characters are alphanumeric.

isdigit() It returns True if the string contains only digits.

title()

It returns the string with first letter of every word in the string in uppercase

and rest in lowercase.

count() It returns number of times substring str occurs in the given string.

lower() It converts the string into lowercase

islower() It returns True if all the letters in the string are in lowercase.

upper() It converts the string into uppercase

isupper() It returns True if all the letters in the string are in uppercase.

lstrip() It returns the string after removing the space from the left of the string

rstrip() It returns the string after removing the space from the right of the string

strip()

It returns the string after removing the space from the both side of the

string

isspace()

It returns True if the string contains only whitespace characters, otherwise

returns False.

istitle() It returns True if the string is properly title-cased.

swapcase() It converts uppercase letter to lowercase and vice versa of the given string.

ord() It returns the ASCII/Unicode of the character.

chr()

It returns the character represented by the imputed Unicode /ASCII

number

45. Which of the following is the correct syntax of string slicing:

i. str_name[start:end] iii. str_name[start:step]

ii. str_name[step:end] iv. str_name[step:start]

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

A=”Virtual Reality”

print(A.replace(‘Virtual’,’Augmented’))

i. Virtual Augmented iii. Reality Augmented

ii. Augmented Virtual iv. Augmented Reality

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

print(“ComputerScience”.split(“er”,2))

i. [“Computer”,”Science”] iii. [“Comput”,”Science”]

ii. [“Comput”,”erScience”] iv. [“Comput”,”er”,”Science”]

48. Following set of commands are executed in shell, what will be the output?

>>>str="hello"

>>>str[:2]

i. he ii. lo iii. olleh iv. hello

49. ………..function will always return tuple of 3 elements.

i. index() ii. split() iii. partition() iv. strip()

50. What is the correct python code to display the last four characters of “Digital India”

i. str[-4:] ii. str[4:] iii. str[*str] iv. str[/4:]

LIST: A list is a collection of comma-separated values (items) of same or different type

within square brackets. List types can be of three types:

1. Empty list 2. Long List 3. Nested List

Built-in Function (Manipulating Lists)

Function Description

append() It adds a single item to the end of the list.

extend() It adds one list at the end of another list

insert() It adds an element at a specified index.

reverse() It reverses the order of the elements in a list.

index() It returns the index of first matched item from the list.

len() Returns the length of the list i.e. number of elements in a list

sort() This function sorts the items of the list.

clear() It removes all the elements from the list.

count() It counts how many times an element has occurred in a list and returns it.

pop()

It removes the element from the end of the list or from the specified index

and also returns it.

del Statement

It removes the specified element from the list

remove()

It is used when we know the element to be deleted, not the index of the

element.

max() Returns the element with the maximum value from the list.

min() Returns the element with the minimum value from the list.

  1. Given the list L=[11,22,33,44,55], write the output of print(L[: :-1]). i. [1,2,3,4,5] ii. [22,33,44,55] iii. [55,44,33,22,11] iv. Error in code

52. Which^ of^ the^ following^ can add^ an^ element^ at^ any^ index^ in^ the^ list?

i. insert( ) ii. append( ) iii. extend() iv. all of these

53 Which^ of^ the^ following^ function^ will^ return^ a^ list^ containing^ all^ the^ words^ of^ the^ given^ string?

i. split() ii. index() i i i. count() iv. list()

  1. Which of the following statements are True. a. [1,2,3,4]>[4,5,6] b. [1,2,3,4]<[1,5,2,3] c. [1,2,3,4]>[1,2,0,3] d. [1,2,3,4]<[1,2,3,2] i. a,b,d ii. a,c,d iii. a,b,c iv. Only d
  2. If l1=[20,30] l2=[20,30] l3=[‘20’,’30’] l4=[20.0,30.0] then which of the following statements will not return ‘False’: a. >>>l1==l2 b. >>>l4>l1 c. >>>l1>l2 d. >>> l2==l i. b, c ii. a,b,c iii. a,c,d iv. a,d
  3. l1=[10,20,30,40,50] l2=l1[1:4] What will be the elements of list l2: i. [10,30,50] ii. [20,30,40,50] iii. [10,20,30] iv. [20,30,40]

  4. l=[‘red’,’blue’] l = l + ‘yellow’ What will be the elements of list l: i. [‘red’,’blue’,’yellow’] ii. [‘red’,’yellow’] iii. [‘red’,’blue’,’yellow’] iv. Error

  5. What will be the output of the following code:

    l=[1,2,3,4] m=[5,6,7,8] n=m+l print(n) i. [1,2,3,5,6,7,8] ii. [1,2,3,4,5,6,7,8] iii. [1,2,3,4][5,6,7,8] iv. Error

  6. What will be the output of the following code:

    l=[1,2,3,4] m=l* n=m* print(n) i [1,2,3,4,1,2,3,4,1,2,3,4] ii. [1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4] iii. [1,2,3,4][4,5,6,7]

    iv. [1,2,3,4]
  7. Match the columns: if

    l=list(‘computer’) Column A Column B

Operation Description

Concatenation Tuple1 + Tuple

Repetition Tuple * x

Index Tuple.index(ele)

Count Tuple.count(ele)

Slicing Tuple[range]

Membership in and not in

Tuple Functions:

Function Description

del statement It is used to delete the tuple.

index( )

It returns the index of first matched item from the

tuple.

len( )

Returns the length of the tuple i.e. number of

elements in a tuple

count( )

It counts how many times an element has occurred

in a tuple and returns it.

any ( )

It returns True if a tuple is having at least one item

otherwise False.

sorted( )

It is used to sort the elements of a tuple. It returns

a list after sorting.

sum( ) It returns sum of the elements of the tuple.

max( )

Returns the element with the maximum value

from the tuple.

min( )

Returns the element with the minimum value from

the tuple.

Dictionary: Python Dictionaries are a collection of some key-value pairs .Dictionaries are

mutable unordered collections with elements in the form of a key:value pairs that associate

keys to values. Dictionaries are enclosed within braces {}

Function Description

items( )

It returns the content of dictionary as a list of

tuples having key-value pairs.

keys( ) It returns a list of the key values in a dictionary

values( )

It returns a list of values from key-value pairs in a

dictionary

get( )

It returns the value for the given key ,if key is not

available then it returns None

copy( ) It creates the copy of the dictionary.

len( )

Returns the length of the Dictionary i.e. number

of key:value pairs in a Dictionary

fromkeys( )

It is used to create dictionary from a collection of

keys(tuple/list)

clear( ) It removes all the elements from the Dictionary.

sorted( )

It sorts the elements of a dictionary by its key or

values.

popitem( )

It removes the last item from dictionary and also

returns the deleted item.

max( )

Returns the key having maximum value in the

Dictionary.

min( )

Returns the key having minimum value in the

Dictionary.

  1. Which of the statement(s) is/are correct. i. Python dictionary is an ordered collection of items. ii. Python dictionary is a mapping of unique keys to values iii. Dictionary is mutable. iv. All of these.
  2. ………function is used to convert a sequence data type into tuple. i. List() ii tuple() iii TUPLE iv. tup()
  3. It tup=(20,30,40,50), which of the following is incorrect i. print(tup[3]) ii. tup[2]=55 iii. print(max(tup)) iv. print(len(tup))
  4. Consider two tuples given below:

    tup1=(1,2,4,3) tup2=(1,2,3,4) What will the following statement print(tup1<tup2) i. True ii. False iii. Error iv. None of these

  5. Which function returns the number of elements in the tuple i. len( ) ii. max( ) iii. min( ) iv. count( )