0% found this document useful (0 votes)
45 views6 pages

MS - Pre Board - 1 - Class XII - CS

Mr

Uploaded by

arifiqbal8709
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)
45 views6 pages

MS - Pre Board - 1 - Class XII - CS

Mr

Uploaded by

arifiqbal8709
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/ 6

ADARSH VIDYA MANDIR ,CHAS

Marking Scheme
Pre- Board-1 Examination
________________________________________________________
1. State True or False:
While defining a function in Python, the positional parameters in the
function header must always be written after the default parameters.
Answer: False
(Positional parameters must come before default parameters in a
function definition.)
2. Identify the output of the code snippet:
text = "PYTHONPROGRAM"
text = text.replace("RAM", "##")
print(text)
Answer: (c) PYTHONPROG##
3. Which of the following expressions evaluates to True?
Answer: (a) not(True) or False
(Explanation: not(True) is False, so the overall expression evaluates to
False or False, which is False.)
4. What is the output of the expression?
C = "International"
print(C.split("n"))
Answer: (b) ['I', 'ter', 'atio', 'al']
(Explanation: The string is split wherever the letter 'n' occurs.)
5. What will be the output of the following code snippet?
S = "Adarsh Vidya Mandir"
print(S[-2::-2])
Answer: 'idniyVsrd'
(Explanation: S[-2::-2] starts from the second-to-last character and
slices the string in reverse, skipping one character each time.)
6. Which of the following will be the output of the statement given
below?
print([12, 34, 56, 78, 90].pop())
Answer: (b) 90
(Explanation: pop() removes and returns the last element of the list,
which is 90.)
7. If my_dict is a dictionary as defined below, then which of the
following statements will raise an exception?
my_dict = {'apple': 10, 'banana': 20, 'orange': 30}
Answer: (b) print(my_dict['apple', 'banana'])
(Explanation: A dictionary key lookup with multiple keys in a tuple
will raise a KeyError.)
8. What will be the output of the following code?
S = "ComputerExam"
print(S[2] + S[8] + S[1:5])
Answer: (a) mEOMPU
(Explanation: The slicing and indexing yield S[2] = 'm', S[8] = 'E',
and S[1:5] = 'OMPU'. Combined, the result is mEOMPU.)
9. If a table has one Primary key and two alternate keys, how many
Candidate keys will this table have? Answer: (d) 4
(Explanation: A table with one primary key and two alternate keys has
all three as candidate keys, but all of them count as candidate keys by
definition.)
10. Write the missing statement to complete the following code:
f = open("myfile.txt", "r")
f.____ # to place the file pointer 10 positions forward
data = f.read(20)
f.close()
Answer: f.seek(10)
(Explanation: The seek() method moves the file pointer to a specified
position.)
11. What is the output of the following Python statements?
b=1
for a in range(1, 10, 2):
b += a + 2
print(b)
Answer: (b) 33
(Explanation: The loop runs for values of a as 1, 3, 5, 7, and 9. The
cumulative value of b becomes 33.)
12. What will be the output of the following code snippet?
c = 10
def add():
global c
c=c+2
print(c, end='%')
add()
c = 10
print(c, end='#')
Answer: (d) 12%10#
(Explanation: The global variable c is updated to 12 in the function
add(). After the function call, c is reassigned to 10. Hence, the output
is 12%10#.)
13. FTP stands for ____.
Answer: (b) File Transfer Protocol
14. The ____ keyword sorts the records in ascending order by default.
Answer: (d) ORDER BY
15. In which data type the value stored is padded with spaces to fit the
specified length?
Answer: (d) CHAR
(Explanation: CHAR values are padded with spaces to ensure a fixed
length, unlike VARCHAR.)
16. What will be the output of the last print statement?
V = 25
def Fun(ch):
V = 50
print(V, end=" * ")
print(V * 2, end=" # ")
print(V, end="#")
Fun("#")
print(V)
Answer: (a) 25#50*100#25
(Explanation: The function uses a local variable V, so changes inside
the function don't affect the global V. The global V remains 25
throughout.)
17. Which protocol is used to transfer files over the Internet?
Answer: (b) FTP (File Transfer Protocol)
18. Which of the following is a category of SQL commands?
Answer: (d) All of these
(Explanation: DDL, TCL, and DML are categories of SQL
commands.)
19. Which network device is used to connect two networks that use
different protocols?
Answer: (b) Gateway
20. Assertion (A): To use the randint() function, the random module
needs to be included in the program.
Reason (R): Some functions are present in modules, and to use them,
the respective module needs to be imported.
Answer: (a) Both A and R are true, and R is the correct
explanation for A.
21. Assertion (A): The cardinality of a table can be increased by
adding fields to the table.
Reason (R): Cardinality is the number of records; adding fields will
increase the degree.
Answer: (d) A is False, but R is True.
(Explanation: Cardinality refers to the number of rows, not fields, so
A is false.)
22. How is an immutable object different from a mutable object in
Python? Identify one immutable and one mutable object from the
provided options.
Answer:
Immutable Object: "Adarsh" (strings are immutable).
Mutable Object: [1, 2, 3, 4, 5] (lists are mutable).
23. Give two examples of each of the following:
Logical operators: and, or
Comparison/Relational operators: >, ==
24. Which of the following can be the possible output of the given
code?
import random
VALUES = [10, 20, 30, 40, 50, 60, 70, 80]
BEGIN = random.randint(1, 3)
LAST = random.randint(BEGIN, 4)
for i in range(BEGIN, LAST + 1):
print(VALUES[i], end="#")
Answer: (c) 30#40#50#60#
(Explanation: BEGIN and LAST are generated randomly within the
specified ranges. A valid range of indices leads to output starting from
index BEGIN to LAST inclusive. Option (c) is one such valid case.)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy