0% found this document useful (0 votes)
31 views17 pages

Computer Science MCQ Xii

Uploaded by

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

Computer Science MCQ Xii

Uploaded by

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

QNO1. Which of the following symbols are used for comments in Python?

(A) //
(B) ''
(C) /**/
(D) #

QNO2 Which keyword is used to define methods in Python?

(A) function
(B) def
(C) method
(D) All of these

QNO3 Which of the following is correct way to declare string variable in Python?

(A) fruit = 'banana'


(B) fruit = "banana"

(C) fruit = banana

(D) (D) fruit = (banana)

QNO5 Syntax of constructor in Python?

(A) def init ()


(B) def _init_()
(C) _init_()
(D) All of these

QNO6 How to find the last element of list in Python? Assume `bikes` is the name of list.

(A) bikes[0]
(B) bikes[-1]
(C) bikes[lpos]
(D) bikes[:-1]

QNO7 If a='cpp', b='buzz' then which of the following operation would show 'cppbuzz' as
output?

(A) a+b
(B) a+''+b
(C) a+""+b
(D) All of the above
1
QNO8 If a='cpp', b='buzz' then what is the output of:
c = a-b
print(c)

(A) cpp-buzz
(B) cppbuzz
(C) TypeError: unsupported operand
(D) None of the above
QNO9 a = 8.6
b=2
print a//b
(A) 4.3
(B) 4.0
(C) 4
(D) compilation error
QNO 10
a = True
b = False
c = True

if not a or b:
print "a"
elif not a or not b and c:
print "b"
elif not a or b or not b and a:

MCQS CLASS 12

print "c"
else:
print "d"

(A) a
(B) b
(C) c
(D) d

1. Rearrange the following managerial functions in sequential


order. (Planning - Staffing - Organising - Controlling - Directing)
Ans. Planning – Organising- Staffing – Directing – Controlling.
2. Management is
a. Exact Science b. Pure Science c. In exact science d. None of these
Ans. Inexact science
3. Management should find the best way to perform a task'. Which technique
of management is referred here?
a. Time Study b. Motion Study c. method Study d. Fatigue Study

2
Ans. Method Study
4. A small packet of shampoo is given free along with the purchase of soap.
Name the sales promotion technique.
Ans. Free Samples
5. To measure the level of knowledge and proficiency in the area of
profession,..................test is conducted
a. Personality Test b. Aptitude Test c. Trade Test d. Intelligence Test
Ans.Trade Test
6. Find the odd one.
a. Leadership b. Communication c. Co-ordination d. Supervision
Ans. Co ordination
7. The role of subordinates of an organisation is enhanced by giving them
more autonomy. This refers to:
a. Delegation b. Decentralisation b. Span of control d. Departmentalisation
Ans. Decentralisation
8. In order to be successful, an organization must change itself according to
the needs of the environment. Which characteristic of management is
highlighted in the statement?
a) Group activity b) Pervasive c) Dynamic d) Multi
dimensional Ans. Dynamic
9. Your Grand Father has retired as the director of a manufacturing company.
At what level of management was he working?
Top level b) Middle Level c) Lower level d) None of these
Ans. Top level
10. Which element / dimension of business environment involve improvement
and innovations which provide new ways of producing goods and services
and new methods and techniques of operating a business?

a) Technological environment b) Social environment c) Economic


environment d) Political environment
Ans. Technological Environment

CLASS XII COMPUTER SCIENCE


1. For the following program answer the questions that follow (select any one of the choices):
def fun1(x,y):
returnx+y

a='2'
b='3'
c=fun1(a,b)
print(c)

(a) Variable x,y are known as:


(i) Empty parameters (ii) Special parameters (iii) parameters (iv) default parameters
(b) Variables a,b are known as:
3
(i) real argument (ii) argument (iii) default argument (iv) default variables

(c) The output of the program is:


(i) 5 (ii) 23 (iii) None (iv) Error in program

(d) What will be the output if a and b have values as a=[1,2] and b=[9,10]
(i) 22 (ii) 23 (iii) None (iv) [1,2,9,10]

(e) Which statement is the function call in the above program?


(i) def fun1(x,y): (ii) return x+y (iii) c=fun1(a,b) (iv) None of these

2. Match the following terms with their definitions/descriptions:


A B
A local scope i value automatically assigned if parameter is not passed
B positional argument ii accessed within a function
C global scope iii specify parameter and its value in function call
D default argument iv accessed in all the functions
E named argument v function call must match number and order of arguments

Ans:
1
a- iii b-ii c-ii d-iv e-iv

2
A-ii B-v C-iv D-I E-iii

1 Suppose str=”computer science with python” .What will be the output of


print(type(str)) (a)int (b) bool (c) string (d)str
2 What will be the output of “Hello”.replace(‘l’,’e’)
(a)Heeeo (b) Heelo (c)Heleo (d) None
3 What is the output of math.ceil(4.4)?
(a) 5 (b) 4 (c)4.0 (d) 5.0
4 The RDBMS terminology for a row is
(a) Tuple (b) relation (c) attribute (d) degree
5 What arithmetic operators cannot be used with strings ?
a) +
b) *
c) –
d) All of the mentioned
9 The size of "reema\'s" is
a) 5 b) 7 c) 8 d) None of these
4
10 Which of the following is an immutable data type in Python
a) Lists b)Integer c)Dictionary d) All the above
11 What is the purpose of id()
a) to find value b) to find memory address
c) to find data type d)none of these
13 Different ways to create multi line strings are by giving triple
a) single quote b) double quotes

c) triple quotes d) All the above

15 Which of the following are valid string(s) in Python ?


a) "hello" b) 'Hello" c) { Hello} d) All the Above

Answers
1.d 2.a 3.a 4.a 5.b 6.c 7.b 8. C 9.b 10.b 11.b 12.b 13.d 14.d 15.c

MULTIPLE CHOICE QUESTIONS –COMPUTER SCIENCE

1. Which of the following is immutable ?


a) List b)Dictionary c)Tuple d)None of these Ans:c
2. Which of the following we can use as key in dictionary?
a) List b)Dictionary c)Tuple d)None of these Ans:c
3. Which of the following is a valid identifier in python?
a) _var b) 9pqr c)p@q d)P-QR Ans:a
4. Degree of AXB is
a) Degree(A)+Degree(B) b)Degree(A)*Degree(B) c)All of these d)None of these Ans:a
5. is the command for selecting a Database
a) USE b)SELECT c)CREATE d)None of These Ans:a
6. Which is the device that forwards packet by checking the IP address.
a) Bridge b)Modem c) )Router d)Switch Ans:c
7) Spans over less than a Kilometer
a) MAN b)LAN c)WAN d)All of the above Ans:b
8) FTP stand for
a) Foreign Transfer protocol b)Fiber Tech Protocol c)Fiber Transfer Protocol d)None Of These Ans:d
9) The fraudulent practice of sending emails purporting to be from reputable
companies in order to induce individuals to reveal personal information is called
a) Spams b)Phishing c)Cyber bullying d)None of these

10) The act which governs


the cyber transactions in India is
a) IT act 2000 b)IT act 2008 c)IT act 2003 d)None of these
Ans:a
5
1. in the given below statement from the
following options X=(20,3.14,”OK”,100)
i) List ii)Tuple iii)Dictionary iv)Array Answer: ii)Tuple
2. Which of the following is/are not a valid operator in python

i) += ii)import
iii)None iv)or
Answer:ii)import
3. Write the type of tokens of the following

i) _var ii)in

Answer:i)Identifier ii)Keyword

4. Write the names of the modules which are required to use these built-in
functions:- i)randrange() ii)abs()
Answer:i)random ii)math

5.------------------------------------command in SQL is used to change/modify data of a table

Answer:UPDATE

6. Which keyword in SQL is used to find unique values from various


duplicate values in a column.
Answer:DISTINCT

7.---------------------------------------------is a network device used to divide a single computer

network into various sub-networks.

i) router ii)switch ii)hub


iv)repeater Answer:switch

1. Which SQL function is used to count the number of rows in a SQL query?
a) COUNT()
b) NUMBER()
c) SUM()
d) COUNT(*)
2. Which SQL keyword is used to retrieve a maximum value?
a) MOST()
b) TOP()
c) MAX()
d) UPPER()
3. With SQL, how do you select all the records from a table named “Persons”
where the value of the column “FirstName” ends with an “a”?
a) SELECT * FROM Persons WHERE FirstName=’a’
b) SELECT * FROM Persons WHERE FirstName LIKE ‘a%’
c) SELECT * FROM Persons WHERE FirstName LIKE ‘%a’
d) SELECT * FROM Persons WHERE FirstName=’%a%’
6
4. With SQL, how can you return all the records from a table named “Persons”
sorted descending by “FirstName”?
a) SELECT * FROM Persons SORT BY ‘FirstName’ DESC
b) SELECT * FROM Persons ORDER FirstName DESC
c) SELECT * FROM Persons SORT ‘FirstName’ DESC
d) SELECT * FROM Persons ORDER BY FirstName DESC
5. Which of the following is not a DDL command?
a) UPDATE
b) TRUNCATE
c) ALTER
d) None of the Mentioned

6. What does the ALTER TABLE clause do?


a) The SQL ALTER TABLE clause modifies a table definition by
altering, adding, or deleting table columns and/or constraints
b) The SQL ALTER TABLE clause is used to insert data into database table
c) THE SQL ALTER TABLE deletes data from database table
d) The SQL ALTER TABLE clause is used to delete a database table
7. If you don’t specify ASC or DESC after a SQL ORDER BY
clause, the following is used by default
a) ASC
b) DESC
c) There is no default value
d) None of the mentioned
8. To include the use of functions which are present in the random
library, we must use the option:
a) import random
b) random.h
c) import.random
d) random.random
9. What is the value returned by math.floor(3.4)?
a) 3
b) 4
c) 4.0
d) 3.0
10. What does 3 ^ 4 evaluate to in PYTHON?
a) 81
b) 12
c) 0.75
d) 7

1. d 2. c 3.c 4. d 5. a 6. a 7. a 8. a 9. a 10. a

1. How many values can be returned by a function in python?


a) 0 b) 1 c) more than one d) 2
2. library can be used for visualization of data
7
a) numpy b) pandas c) random d) pyplot
3. stack is a structure
a) LIFO b) FIFO c) Array d) String
4. Two types of files are and
5. Which method returns the current position within the file?
6. method is used to rename a file in Python
7. method of module can be used to
create a directory in the current directory.
1. How many values can be returned by a function in python?
a) 0 b) 1 c) more than one d) 2
2. library can be used for visualization of data
a) numpy b) pandas c) random d) pyplot
3. stack is a structure
a) LIFO b) FIFO c) Array d) String
4. Two types of files are and
5. Which method returns the current position within the file?
6. method is used to rename a file in Python

1. Statement : print (id(x)) will print .


1. Value of x
2. Datatype of x
3. Size of x
4. Memory address of x
Ans: 4.
2. Function returns multiple values in form of .
1. List
2. Tuple
3. String
4. Set
Ans: 2.

3. Which one of the following is an assignment operator in python?


1. //
2. %=
3. and
4. <=
Ans: 2.

4. ALTER is a command.
1. DDL
2. DML
3. TCL
4. DCL

Ans: 1.

5. Which of the following attribute can be taken as Primary key?


1. Name
2. street
3. studentid
8
4. department

Ans: 3.

6. Which of the following command is used to change the rows that already
exist in a table?
1. Insert.
2. Union.
3. Update.
4. Select
Ans: 3.

7. Give the output:


my_data = (1, 2, "Kevin",
8.9) print (my_data[-3])
1. 8.9
2. “Kevin”.
3. 1
4. 2
Ans: 4.

8. Which of the following is not a valid keyword in python?


1. def
2. return

3. for
4. While
Ans: 4.

9. Which of the following is a valid identifier in python?


1. *ab
2. 1ab
3. _ab
4. a*b
Ans: 3.

1. What is the output of the


following? x = ['ab', 'cd']
for i in x:
x.append(i.upper())
print(x)

a) [‘AB’, ‘CD’].
b) [‘ab’, ‘cd’, ‘AB’, ‘CD’].
c) [‘ab’, ‘cd’].
d) none of the mentioned

Answer : d
9
Explanation: The loop does not terminate as new elements are being added to the list in each
iteration.
2. What arithmetic operators cannot be used with strings ?
a) +
b) *
c) –
d) All of the mentioned
Answer: c
3. Suppose list1 is [1, 3, 2], What is list1 * 2 ?
a) [2, 6, 4].
b) [1, 3, 2, 1, 3].
c) [1, 3, 2, 1, 3, 2] .

D) [1, 3, 2, 3, 2, 1].
Answer : c

4. What will be the output?


>>>t1 = (1, 2, 4, 3)
>>>t2 = (1, 2, 3, 4)
>>>t1 < t2
a) True
b) False
c) Error
d) None
Answer : b
5. What is the output of the below
program? def sayHello():
print('Hello World!')
sayHello()
sayHello()
a) Hello World!
Hello World!
b) ‘Hello World!’
‘Hello World!’
c) Hello
Hello
d) None of the mentioned

Answer: a
Explanation: Functions are defined using the def keyword. After this keyword comes an
identifier name for the function, followed by a pair of parentheses which may enclose some
names of variables, and by the final colon that ends the line. Next follows the block of
statements that are part of this function.
def sayHello():
print('Hello World!') # block belonging to the function
# End of function #
sayHello() # call the function
sayHello() # call the function again
6. The readlines() method returns
a) str
b) a list of lines
c) a list of single characters
10
d) a list of integers

Answer: b
Explanation: Every line is stored in a list and returned.

7. What is the output of the following line of code, if the sys module has already
been imported?
sys.stdout.write("hello world")
a) helloworld
b) hello world10
c) hello world11
d) error

Answer: c
Explanation: The function shown above prints the given string along with the length of the
string. Hence the output of the function shown above will be hello world11.
8. Which of the following cannot be returned by random.randrange(4)?
a) 0
b) 3
c) 2.3
d) none of the mentioned

Answer: c
Explanation: Only integers can be returned

9. What is the output of the following piece of code?


def test(i,j):
if(i==0):
return j
else:
return test(i-1,i+j)
print(test(4,7))
a) 13
b) 7
c) Infinite loop
d) 17

Answer: a
Explanation: The test(i-1,i+j) part of the function keeps calling the function until the base
condition of the function is satisfied.

1. A function which does not return any value is called a


a. void function b.fruitful function c.none function d.empty
function

2. The area in which a variable can be accessed is called its


a.activearea b.lifetime c.scope d. livearea
3. is an example for mutable data types in
Python a.List b.tuple c.
Dictionary d.Set
11
4. The condition which causes the exit from a recursive function is called case
a.recursive case b. exitcase c. base case d end case

5. The efficiency of binary search algorithm is of the order of


a. N b N2 c.log2N d.N/2

6. function is used to plot a bar


graph a.plot() b.bar() c.drawbar() d.
plotbar()

7. is a protocol used for remote


login a.FTP b. SSL c Telnet d.SMTP

8. is a LIFO data structure


a.Stack b. Array c.Queue d.
List

9. Each network device is assigned a unique address called


a.MAC address b. Host address c. IP address d. Network address

10. The number of columns in a table is called in relational algebra


a.Tuple b.Cardinality c. Degree d.Attributes

1 What is the output of this expression, 3*1**3?


a) 27
b) 9
c) 3
d) 1
Answer:
c
Explanation: First this expression will solve 1**3 because exponential has higher
precedence than multiplication, so 1**3 = 1 and 3*1 = 3. Final answer is 3.
2 What will be the output of the following Python code?

x = ['ab', 'cd']
for i in x:
i.upper()
print(x)
a)[‘ab’,‘cd’]
b)[‘AB’,‘CD’]
c)[None,None]
d) none of the mentioned
Answer: a
Explanation: The function upper() does not modify a string in place, it returns a new
string which isn’t being stored anywhere.
3 Is Python case sensitive when dealing with identifiers?
a) yes
b) no
c) machine dependent
d) none of the
mentioned Ans Answer:a
4 What is the maximum possible length of an identifier?
12
a) 31 characters
b) 63 characters
c) 79 characters
d) none of the
mentioned Ans Answer: d
Explanation: Identifiers can be of any length.
5 Which of the following is invalid?
a) _a = 1
b)___a = 1
c) str___= 1
d) none of the
mentioned Answer: d
Explanation: All the statements will execute successfully but at the cost of reduced
readability.
6 Which of the following is not a keyword?
a) eval
b) assert
c) nonlocal
d) pass
Answer:
a
Explanation: eval can be used as a variable.
7 Which of the following is an invalid statement?
a) abc = 1,000,000
b) a b c = 1000 2000 3000
c) a,b,c = 1000, 2000, 3000
d) a_b_c =
1,000,000 Answer: b
Explanation: Spaces are not allowed in variable names.
8 Which of the following cannot be a variable?
a) init
b) in
c) it
d) on
Answer:
b
Explanation: in is a keyword.
9 Which is the correct operator for power(xy)?
a) X^y
b) X**y
c) X^^y
d) None of the
mentioned Answer: b
Explanation: In python, power operator is x**y i.e. 2**3=8.
10 What is the answer to this expression, 22 % 3 is?
a) 7
b) 1
c) 0
d) 5
Answer:
b

13
Explanation: Modulus operator gives the remainder. So, 22%3 gives the remainder, that
is, 1.

14
1. What is the output of the
following? x = ['ab', 'cd']
for i in x: i.upper()
print(x)
a) [‘ab’, ‘cd’].
b) [‘AB’, ‘CD’].
c) [None, None].
d) none of the mentioned
2. What is the output of the following?
i = 1 while True:
if i%2 == 0: break
print(i) i += 2
a) 1
b) 1 2
c) 1 2 3 4 5 6 …
d) 1 3 5 7 9 11 …
3. What is the output of the
following? x = "abcdef"
while i in x:
print(i,
end=" ")
a) a b c d e f
b) abcdef
c) i i i i i i …
d) error
4. Which of the following is the use of
function in python?
a) Functions are reusable pieces of programs
b) Functions don’t provide better modularity for your application
c) you can’t also create your own functions
d) All of the
mentioned Answer:
a
5. To open a file c:\scores.txt for reading, we use
a) infile = open(“c:\scores.txt”, “r”)
b) infile = open(“c:\\scores.txt”, “r”)
c) infile = open(file = “c:\scores.txt”, “r”)
d) infile = open(file = “c:\\
scores.txt”, “r”)
Answer: b
6. Which is the most appropriate definition for recursion?
a) A function that calls itself
b) A function execution instance that calls another execution
instance of the same function
c) A class method that calls another class method
d) An in-built method that is automatically called
7. Process of inserting an element in stack is called
a) Create

15
b) Push
c) Evaluation
d) Pop
8. What is a Firewall in Computer Network?
A. The physical boundary of Network
B. An operating System of Computer Network
C. A system designed to prevent unauthorized access
D. A web browsing Software
9. Following set of commands are executed in shell, what will be the
output?
>>>str="hello"
>>>str[:2]
>>>
a) he
b) lo
c) olleh
d) hello
10.What is the output of the following? x
= 123 for i in x:
print(i)
a) 1 2 3
b) 123
c) error
d) none of the mentioned

CLASS XII COMPUTER SCIENCE –PYTHON

1 Name the python module need to be imported the following function


a)floor() b)randint()
2 Expand the term
a) IoT b)CSMA/CD
3 Name two server side scripting language?
4 Write the names of two identity Theft?
5 What is Degree of a Table
6 Which device is used to connect two different types of network?
7 What is primary key
8 Which are the membership operator in Python
9 Which device is used to connect different computers in a room?
10 What is the purpose of Repater?
Multiple Choice Questions
Answers
1 a)math b)random
2 a)Internet of Things b)Carrier Sense Multiple Access/Collision Detection
3 PHP ,Perl
4 True Name, Account Take Over
5 Number of attributes
6 Gateway
7 Unique key used to identify tuple in a table
16
8 in, not in
9 Switch/Hub
10 Amplify and boost up the signals in long transmission

17

You might also like