Final 11th Important Questions

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 11

1.

List can contain values of these types:

(a) integers

(b) floats

(c) lists

(d) tuples

(e) all of these

2. If L = [1, 2] then L*2 will yield

(a) [1, 2] * 2

(b) [1, 2, 2]

(c) [1, 1, 2, 2]

(d) [1, 2, 1, 2)

3. 1. Which of the following statements will create a tuple ?

(a) tp1 = ("a", "b")

(b) tp1[2] = ("a", "b")

(c) tp1 = (3)*3

(d) None of these

4. Choose the correct statement(s).

(a) Both tuples and lists are immutable.

(b) Tuples are immutable while lists are mutable.

(c) Both tuples and lists are mutable.

(d) Tuples are mutable while lists are immutable.

5. Choose the correct statement(s).

(a) In Python, a tuple can contain only integers as its elements,


(b) In Python, a tuple can contain only strings as its elements.

(c) In Python, a tuple can contain elements of different types.

(d) In Python, a tuple can contain either string or integer but not both at a time.

6. State True or False:

List is an immutable date type. –False

7. The NOT gate takes only __Single____ input.

8.Which of the following function will return the key, value pairs of a dictionary?

(a) keys ( ) (b) values ( ) (c) items ( ) (d) All of these

9. The order of statement execution in the form of top to bottom is known as _________

Construct

(a) Selection (b) Repetition (c) Sequence (d) None

10. What is the output of the following:

l = [‘None’]*10

print(len(l))

(a) 10 (b) 0 (c) Syntax Error (d) None.

11. What is the name of programs that control the computer system?

(a) Hardware (b) Keyboard (c) Software (d) CPU

12. What shape represents a decision in a flow chart?

(a) A diamond (b) A rectangle (c) An Oval (d) None of these

13. Which of the following is not a legal String Operator?

(a) in (b) + (c) * (d) /

14. Select the reserved keyword in python.

(a) else (b) import (c) with (d) All of these


15. Which of the following will give an error if d1 is as shown below:

d1 = {“a” : 1, “b” : 2, “c”: 3}

(a) print(len (d1)) (b) print(d1.get(“b”)) (c) d1 [“a”] = 5 (d) None of these

16. What will be the output of the following python code?

tp = ( )

tp1 = tp * 2

print(len(tp1))

(a) 0 (b) 2 (c) 1 (d) Error

17. Which of the following can add a list of elements to a list?

(a) add ( ) (b) append ( ) (c) extend ( ) (d) None of these

18. Consider the following code segment:

for i in range(2,4):

print(i)

what value (s) are printed when it executes?

(a) 2 (b) 3 (c) 2 and 3 (d) 3 and 4

19. Which of the following are not valid symbols in hexadecimal number system?

(a) 2 (b) F (c) 9 (d) G

20. Which of the following statements will create a tuple?

(a) tp1 = (“a”, “b”) (b) tp1[2] = (“a”, “b”)

(c) tp1 = (3)*3 (d) None of these

21. Which of the following functions removes all leading and trailing spaces from a string?

(a) lstrip() (b) rstrip() (c) strip ( ) (d) All of these


(a) Both A and R are True and R is the correct explanation for A.

(b) Both A and R are True and R is not the correct explanation for A.

(c) A is True but R is False.

(d) A is False but R is True.

22) Assertion (A): The information which was posted by you in online can be seen by

everyone who are in online because internet is the world’s biggest

information exchange tool.

Reason (R): Don’t give or post any personal information like your name, address of the

school/office/home, phone number, age, sex, credit card details etc.,

23) Assertion (A): The digital footprint is created automatically when you work on

Internet and providing data in any form.

Reason (R): The active digital footprint is created unintentionally without the user’s

consents.

Questions and Answers:

1.How many types of strings are supported in Python? Mention it.

Python supports two types of strings — Single-line strings and Multi-line strings. Single line
strings are enclosed in single or double quotes and terminate in one line. Multi-line strings store
multiple lines of text and are enclosed in triple quotes.

2. What is the output of the following code?

if(4+5 == 10):

print(“TRUE”)

else:

print(“FALSE”)

print(“TRUE”)

o/p:
FALSE
TRUE

3. Predict the output:

(i) tp1 = (“Karan”, "Zubin”, “Zara”, “Ana”)

print(min(tp1))

(ii) val = (27, 25, 34, 40)

print(sum(val))

(iii) t1 = tuple({1 : “1”, 2 : “2”})

print(t1)

o/p:

(i)Ana

(ii)126

(iii)(1,2)

4. Predict the Output:

n=6

if n == 5:

print(“Welcome Python”)

else:

print(“Is it correct?”)

print(“Not sure”)

o/p:

Is it correct

Not sure

5.for p in range(8):
print(p, end = ‘ ’)

O/p: No Output.

6. Jump Statement: As the name suggests, a jump statement is used to break the normal flow of
the program and jump onto a specific line of code in the program if the specific condition is true.
In simple words, it transfers the execution control of the program to another statement if a
specific condition associated becomes true.

7. string=input(“Enter a string:”)

count=3

while True:

if string[0]== ‘a’:

string=string[2:]

elif string[-1]== ‘b’:

string=string[:2]

else:

count+=1

break

print(string)

print(count)

What will be the output produced, if the input is:

(i) aabbcc
o/p: bbcc
4
(ii) aaccbb
o/p cc
4

8. Find the output:

(i) L1 = [‘e’, ‘i’, ‘q’, ‘a’, ‘q’, ‘p’]

L1.sort()
print(L1)

o/p:

['a', 'e', 'i', 'p', 'q', 'q']

(ii) L1= [1, 5, 5, 3, 7, 5, 9]

C=L1.count(5)

print(C)

o/p:

(iii) L1 = [‘a’, ‘e’, ‘i’, ‘o’, ‘u’]

L1.remove(‘o’)

L1.insert(1, ‘p’)

print(L1)

o/p:

['a', 'p', 'e', 'i', 'u']

9. Predict the output:

T1 = (1, 2, 3, 4, 5, 6, 7)

print((T1 [1:3]+T1 [3:6])*2)

o/p:

(2, 3, 4, 5, 6, 2, 3, 4, 5, 6)

10. Find the output:

old = {‘name’: ‘Vini’, ‘age’: 25}

new = old. copy( )

new [‘name’] = ‘Tony’

print(old)

print(new)
o/p:

{'name': 'vini', 'age': 25}

{'name': 'Tony', 'age': 25}

11.Find the Output

(i)x = 40

y=x+1

x = 20, y + x

print(x, y)

o/p:

(20, 81) 41

(ii) x, y = 20, 60

y, x, y = x, y- 10, x+10

print(x, y)

o/p:

50 30

(iii) a, b = 12, 13

c, b = a * 2, a/2

print(a, b, c)

o/p:

12 6.0 24

(iv) a, b = 12, 13

print(print(a +b))

o/p:

25
None

(v) a, b, c = 2, 3, 4

a, b, c = a * a, a * b, b * c

print(a, b, c)

o/p:

4 6 12

12. Assume the list letters=[“a”, “b”, “o”, “c”, “p”]

What would be displayed in python shell for each of the following expression?

(i) >>>letters[2 : 5: 2] (ii) >>>letters[2 : -5: -2]

(iii) >>>letters[len(letters)-2] (iv) >>>letters + [“x”]

(v) >>>letters

O/p: NO Output.

13. Expand the following terms.

(i) OSS-Open Source Software

(ii) FOSS-Free and Open Source Software

(iii) FSF-Free Software Foundation

(iv) OSI-Open Systems Interconnection

(v) GNU-GNU stands for Gnu's Not Unix.

14. Sita has written a code in python, but she is not able to get the desired output. Help Sita to

find the mistakes in the code and rectify it.

CODE:

x = “\t My digital world \t”

y = “The new and vibrant digital life.”

print(‘x’ + ‘y’) # line 1

print(x.rightStrip()) # line 2
for i in x:

if (x.CapitalLetter()): # line 3

print(i)

print(y[5:1:-1]) # line 4

(i) Sita is not getting the concatenated string in line 1, what should she change:

a. Change the single quotes to double quotes

b. Both x and y should be together in single quotes

c. There should not be any quotes for x and y

d. There is no error in the line

(ii) Help Sita to find the error on the line 2.

a. x.rightstrip() b. x.rStrip()

c. x.rstrip() d. x.RStrip()

(iii) What could be the possible mistake in line 3?

a. x.capitalletter() b. x.caps()

c. x.upper() d. No error.

(iv) Predict the output of the line 4.

a. It will give an empty string

b. It will give an error

c. The start and stop value should be changed.

d. It will run and give output without error

15. In python, the random ( ) functions is used to return a number randomly between the

range of two numbers. It’s a variable in the random module of the python. Based on the

above discussion, pick from the given options, the probable return value when the code

executes.
(i) random. randint (1, 15) function is used:

(a) 63 (b) 81 (c) 4 (d) 575

(ii) random. randrange (11, 45, 4) function is used:

(a) 15 (b) 45 (c) 20 (d) 30

(iii) random. random ( ) function is used:

(a) 10. 2346238756 (b) 8.235235232

(c) 1.34514523 (d) 0.231451235235

(iv) print(random.randint (1, 15) -3) function is used:

(a) -1 (b) 15 (c) 16 (d) -3

You might also like