MCQ Rev

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

Vani Vidyalaya Sr. Sec. & Jr.

College
CSC Revision

Which of the following is correct way to define a function header? *


def function_name():
define funcion_name():
function function_name():
return function_name():

Which of the following is the correct way to call a function? *


def my_func()
my_func()
return my_func
call my_func()

Which of the following function header is correct? *


a. def cal_si(p=100, r, t=2):
b. def cal_si(p=100, r=8, t):
c. def cal_si(p, r=8, t):
d. def cal_si(p, r=8, t=2):

What will the following code display? *

50
None
none
20,30
What will the following code display? *

100,200
250 350
250 300
None
What will the following code display? *

5#8#
5#8#5#4
5#8#5
5#8#5#4#

What will the following code display? *


110
104
140

What will the following code display? *

355
553
353

What will the following code display? *


50#5
50#50
5#5
5#50

What will the following code display? *

15
8
(8, 7)
Syntax Error

What is the output of the following code snippet? *


A. HelloHelloHelloHelloHello
B. HelloHelloHelloHello
C. invalid call
D. infinite loop

What is the value of num after the function call? *

A. 4
B. 3
C. 0
D. 1

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.0
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*10


i. 18 ii. 80 iii. 44 iv. None of the above

8. Give the output of the following code:


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

9. Give the output of the following code:


>>> a,b = 4,2.5
>>> a-b//2**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,3
>>> a//b**c+a-c*a
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

21. Which of the following is not a decision making statement


i. if..else statement ii. for statement iii. if-elif statement iv. if statement

22. ............loop is the best choice when the number of iterations are known.
i. while ii. do-while iii. for iv. None of these

23. How many times will the following code be executed.


a=5
while a>0:
print(a)
print(“Bye”)
i. 5 times ii. Once iii. Infinite iv. None of these

24. What abandons the current iteration of the loop


i. continue ii. stop iii. infinite iv. Break

25. 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,13

26. ............loop is the best when the number of iterations are not known.
i. while ii. do-while iii. For iv. None of these
27. In the nested loop .................loop must be terminated before the outer loop.
i. Outer ii. Enclosing iii. inner iv. None of these

28. ..............statement is an empty statement in python.


i. pass ii. Break iii. Continue iv. if
29. 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

30. Symbol used to end the if statement:


i. Semicolon(;) ii. Hyphen(-) iii. Underscore( _ ) iv.
colon(:)
31. Which of the following is not a python legal string operation.
i. ‘abc’+’aba’ ii. ‘abc’*3 iii. ‘abc’+3 iv. ‘abc’.lower()

32. Which of the following is not a valid string operation.


i. Slicing ii. Concatenation iii. Repetition iv. floor

33. Which of the following is a mutable type.


i. string ii. tuple iii. Int iv. list

34. What will be the output of the following code


str1=”I love Python”
strlen=len(str1)+5
print(strlen)
i. 18 ii. 19 iii. 13 iv. 15

35. Which method removes all the leading whitespaces from the left of the string.
i. split() ii. remove() iii. lstrip() iv rstrip()

36. It returns True if the string contains only whitespace characters, otherwise returns
False.
i) isspace() ii. strip() iii. islower() iv. isupper()
37. It converts uppercase letter to lowercase and vice versa of the given string.
i. lstrip() ii. swapcase() iii. istitle() iv. count()

38. What will be the output of the following code.


Str=’Hello World! Hello Hello’
Str.count(‘Hello’,12,25)
i. 2 ii. 3 iii. 4 iv. 5
39. What will be the output of the following code.
Str=”123456”
print(Str.isdigit())
i. True ii. False iii. None iv. Error

40. What will be the output of the following code.


Str=”python 38”
print(Str.isalnum())
i. True ii. False iii. None iv. Error

41. What will be the output of the following code.


Str=”pyThOn”
print(Str.swapcase())
i. PYtHoN ii. python iii. python iv. PYTHON

42. What will be the output of the following code.


Str=”Computers”
print(Str.rstrip(“rs”))
i. Computer ii. Computers iii. Compute iv. compute

43. What will be the output of the following code.


Str=”This is Meera\’ pen”
print(Str.isdigit())
i. 21 ii. 20 iii. 18 iv. 19

44. How many times is the word ‘Python’ printed in the following statement.
s = ”I love Python”
for ch in s[3:8]:
print(‘Python’)
i. 11 times ii. 8 times iii. 3 times iv. 5 times

20 | P a g e
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:]
51. 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()
54. 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
55. 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==l2
i. b, c ii. a,b,c iii. a,c,d iv. a,d

56. >>>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]

57. >>>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
58. 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

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


>>>l=[1,2,3,4]
>>>m=l*2
>>>n=m*2
>>>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]

60. Match the columns: if


>>>l=list(‘computer’)
Column A Column B
1. L[1:4] a. [‘t’,’e’,’r’]
2. L[3:] b. [‘o’,’m’,’p’]
3. L[-3:] c. [‘c’,’o’,’m’,’p’,’u’,’t’]
4. L[:-2] d. [‘p’,’u’,’t’,’e’,’r’]
i. 1-b,2-d,3-a,4-c iii. 1-c,2-b,3-a,4-d
ii. 1-b,2-d,3-c,4-a iv. 1-d,2-a,3-c,4-b

61. If a list is created as


>>>l=[1,2,3,’a’,[‘apple’,’green’],5,6,7,[‘red’,’orange’]] then what will be the output of the
following statements:
>>>l[4][1]
i. ‘apple’ iii. ‘green’
ii. ‘red’ iv. ‘orange’

62. >>>l[8][0][2]
i. ‘d’ iii. ‘e’
ii. ‘r’ iv. ‘o’

63. >>>l[-1]
i. [‘apple’,’green’] iii. [‘red’,’orange’]
ii. [‘red’ ] iv. [’orange’]

64 >>>len(l)
i. 10 iii. 9
ii. 8 iv 11

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


>>>l1=[1,2,3]
>>>l1.append([5,6])
>>>l1
i. [1,2,3,5,6] ii. [1,2,3,[5,6]] iii. [[5,6]] iv. [1,2,3,[5,6]]

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


>>>l1=[1,2,3]
>>>l2=[5,6]
>>>l1.extend(l2)
>>>l1
i. [5,6,1,2,3] ii. [1,2,3,5,6] iii. [1,3,5] iv. [1,2,3,6]

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


>>>l1=[1,2,3]
>>>l1.insert(2,25)
>>>l1
i. [1,2,3,25] ii. [1,25,2,3] iii. [1,2,25,3] iv. [25,1,2,3,6]

68. >>>l1=[10,20,30,40,50,60,10,20,10]
>>>l1.count(‘10’)
i. 3 ii. 0 iii. 2 iv. 9
69. Which operators can be used with list?
i. in ii. not in iii. both (i)&(ii) iv. Arithmetic operator only

70. Which of the following function will return the first occurrence of the specified element
in a list.

i. sort() ii. value() iii. index() iv. sorted()

71. 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.

72. .........function is used to convert a sequence data type into tuple.


i. List() ii tuple() iii TUPLE iv. tup()
73. 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))
74. 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
75. Which function returns the number of elements in the tuple
i. len( ) ii. max( ) iii. min( ) iv. count( )

76. Which function is used to return a value for the given key.
i. len( ) ii. get( ) iii. keys( ) iv. None of these

77. Keys of the dictionary must be


i. similar ii. Unique iii. can be similar or unique iv. All of these
78. Which of the following is correct to insert a single element in a tuple .
i. T=4 ii. T=(4) iii. T(4,) iv. T=[4,]

79. Which of the following will delete key-value pair for key=’red’ form a dictionary D1
i. Delete D1(“red”) ii. del. D1(“red”) iii. del D1[“red”] iv. del D1
80. Which function is used to remove all items form a particular dictionary.
i. clear( ) ii. pop( ) iii. Delete iv. rem( )
81. In dictionary the elements are accessed through
i. key ii. Value iii. Index iv. None of these
82. Which function will return key-value pairs of the dictionary
i. key( ) ii. values( ) iii. items( ) iv. get( )

83 Elements in a tuple can be of .............type.


i. Dissimilar ii. Similar iii. both i & ii iv. None of these
84 To create a dictionary , key-value pairs are separated by................
i. (;) ii. ( , ) iii. (:) iv. ( / )
85 Which of the following statements are not correct:
a. An element in a dictionary is a combination of key-value pair
b. A tuple is a mutable data type
c. We can repeat a key in dictionary
d. clear( ) function is used to deleted the dictionary.
i. a,b,c ii. b,c,d iii. b,c,a iv. a,b,c,d
86 Which of the following statements are correct:
a. Lists can be used as keys in a dictionary
b. A tuple cannot store list as an element
c. We can use extend() function with tuple.
d. We cannot delete a dictionary once created.
i. a,b,c ii. b,c,d iii. b,c,a iv. None of these

87 Like lists, dictionaries are.................which mean they can be changed.


i. Mutable ii. Immutable iii. variable iv. None of these

88 To create an empty dictionary , we use


i. d=[ ] ii. d =( ) iii. d = {} iv. d= < >

89 To create dictionary with no items , we use


i. Dict ii. dict( ) iii. d = [ ] iv. None of these

90 What will be the output


>>>d1={‘rohit’:56,”Raina”:99}
>>>print(“Raina” in d1)
i. True ii. False iii. No output iv. Error
91 Rahul has created the a tuple containing some numbers as
>>>t=(10,20,30,40)
now he wants to do the following things help him
1. He want to add a new element 60 in the tuple, which statement he should use out of the
given four.
i. >>>t+(60)
ii. >>>t + 60
iii. >>>t + (60,)
iv. >>>t + (‘60’)

92 Rahul wants to delete all the elements from the tuple, which statement he should use
i. >>>del t
ii. >>>t.clear()
iii. >>>t.remove()
iv. >>>None of these

93 Rahul wants to display the last element of the tuple, which statement he should use

i. >>> t.display()
ii. >>>t.pop()
iii. >>>t[-1]
iv. >>>t.last()

94 Rahul wants to add a new tuple t1 to the tuple t, which statement he should use

i. >>>t+t1
ii. >>>t.add(t1)
iii. >>>t*t1
iv. None of these

95 Rahul has issued a statement after that the tuple t is replace with empty tuple, identify the
statement
he had issued out of the following:
i. >>> del t
ii. >>>t= tuple()
iii. >>>t=Tuple()
iv. >>>delete t

96 Rahul wants to count that how many times the number 10 has come:

i. >>>t.count(10)
ii. >>>t[10]
iii. >>>count.t(10)
iv. None of these

97 Rahul want to know that how many elements are there in the tuple t, which statement he
should use
out of the given four
i. >>>t.count()
ii. >>>len(t)
iii. >>>count(t)
iv. >>>t.sum()
98 >>>t=(1,2,3,4)
Write the statement should be used to print the first three elements 3 times
i. >>>print(t*3)
ii. >>>t*3
iii. >>>t[:3]*3
iv. >>>t+t

99 Match the output with the statement given in column A with Column B

1. >>>tuple([10,20,30]) a. >>> (10,20,30)


2. >>>(“Tea”,)* 3 b. >>> 2
3. >>>tuple(“Item”) c. >>> ('Tea', 'Tea', 'Tea')
4. >>>print(len(tuple([1,2]))) d. >>> ('I', 't', 'e', 'm')
i. 1-b,2-c,3-d,4-a
ii. 1-a,2-c,3-d,4-b
iii. 1-c,2-d,3-a,4-a
iv. 1-d,2-a,3-b,4-c

100 Write the output of the following code:


>>>d={‘name’:’rohan’,’dob’:’2002-03-11’,’Marks’:’98’}
>>>d1={‘name’:‘raj’)
>>>d1=d.copy()
>>>print(“d1 :”d1)
i. d1 : {'name': 'rohan', 'dob': '2002-03-11', 'Marks': '98'}
ii. d1 = {'name': 'rohan', 'dob': '2002-03-11', 'Marks': '98'}
iii. {'name': 'rohan', 'dob': '2002-03-11', 'Marks': '98'}
iv. (d1 : {'name': 'rohan', 'dob': '2002-03-11', 'Marks': '98'})
WORKING WITH FUNCTIONS

101 A function in python begins with which keyword?


i. void ii. return iii. int iv. Def
102 Name the statement that sends back a value from a function
i. print ii. Input iii. Return iv. None
103 What is the output of the program given below:
x=50
def func(x):
x=2
func(x)
print(‘x is now’,x)
i. x is now 50 iii. x is now 2
ii. x is now 100 iv. Error
104 What is the output of the program given below:
import random
x = random.random()
y= random.randint(0,4)
print(int(x),”:”, y+int(x))
i. 0: 0 iii. 2 : 4
ii. 1: 6 iv. 0 : 5

105
def cal(a,b,c):
return a*3,b*3,c*3
val=cal(10,12,14)
print(type(val))
print(val)
i. [30, 24, 28] iii. [30,36,42]
ii. [10, 20, 30] iv. [10,12,14]
106 What is the output of the expression:round(4.576)
i. 4.5 ii. 5 iii. 4 iv. 4.6
107 What is the output of the function shown below?
import math
abs(math.sqrt(25))
i. Error ii. -5 iii. 5 iv. 5.0
108 What is the output of the functions shown below?>>>min(max(False,-3,-4), 2,7)
i. 2 i i . False iii. -3 iv. -4
109 What are the outcomes of the function shown below?
>>> x=3
>>>eval('x**2')
i. Error ii. 1 iii. 9 iv. 6
110 Which of the following functions does not throw an error?
i. ord() ii. ord(‘ ‘) iii. ord(”) iv. ord(“”)
111 What is the output of below program?
def say(message, times = 1):
print(message * times , end =’ ‘)
say(‘Hello and’)
say('World', 5)
i. Hello and WorldWorldWorldWorldWorld
ii. Hello and World 5
iii. Hello and World,World,World,World,World
iv. Hello and HelloHelloHelloHelloHello

112 What is a variable defined inside a function referred to as?


i. A global variable ii. A volatile variable
iii. A local variable iv. An automatic variable
113 How many keyword arguments can be passed to a function in a single function call?
i. zero ii. One i i i . zero or more i v . one or more

114 How are required arguments specified in the functionheading?


i. identifier followed by an equal to sign and the default value
ii. identifier followed by the default value within backticks (“)
iii.identifier followed by the default value within squarebrackets ([ ])
iv. identifier
115 What is returned by
>>> math.ceil(3.4)?
i. 3 ii. 4 iii. 4.0 iv. 3.0

116 What is the value returned by


>>> math.floor(3.4)
i. 3 ii. 4 iii. 4.0 iv. 3.0

117 What is returned by


>>> math.ceil(-3.4)?
i. 3 ii. 4 iii. 4.0 iv. -3

118 What is the value returned by


>>> math.floor(-3.4)
i. 3 ii. -4 iii. 4.0 iv. 3.0
119 What is displayed on executing print(math.fabs(-3.4))?
i. -3.4 ii . 3.4 iii.3 i v . -3
120 What is output of print(math.pow(3, 2))?
i. 9 ii. 9.0 iii. None iv. None of these

121 What is the value of x if x = math.sqrt(4)?


i. 2 ii. 2.0 iii. (2, -2) iv. (2.0, -2.0)

122 To include the use of functions which are present in the random library, we must use the
option:
i. import random iii. random.h
ii. import.random iv. random.random
123 What is the output of the code shown below?
import random
random.choice(2,3,4)
i. An integer other than 2, 3 and 4 ii. Either 2, 3 or 4
iii. Error iv. 3 only
124 What is the output of the function shown below (random module has already been
imported)?
>>>random.choice('sun')
i. sun ii. u iii. either s, u or n iv. Error
125 What is the output of the function shown below if the random module has already been
imported?
>>>import random
>>>random.randint(3.5,7)
i. Error
ii. Any integer between 3.5 and 7, including 7
iii. Any integer between 3.5 and 7, excluding 7
iv. The integer closest to the mean of 3.5 and 7
126 Which type of elements are accepted by random.shuffle()?
i. strings ii. Lists iii. tuples iv. integers

127 ............keyword is used to define a function.


i. Void ii. Func iii. def iv. None

128 Which of the following statements are True out of the given below:
1. More than one value(s) can be returned by a function
2. The variable declared inside a function is a Global variable.
3. Once the function is defined , it may be called only once
4. A function is used by invoking it
i. 1 & 2 ii. 1 & 4 iii. 2 & 3 iv. 2 & 4

129 Match the columns:


1. max() a. will compute x**y
2. sqrt(x) b. will select a option randomly
3. choice() c. will return the largest value
4. pow(x,y) d. will compute (x)1/2
i. 1-a,2-b,3-c,4-d iii. 1-c,2-d,3-b,4-a
ii. 1-d,2-a,3-c,4-b iv. 1-b,2-c,3-d,4-a
130 What will be the output of the following code:
A=1
def f ():
A=10
print(A)
i. 1 ii. 10 iii. Error iv. None

131 >>>def Interest(p,c,t=2,r=0.09):


return p*t*r
Considering the above defined function which of following function call are legal.
1. Interest(p=1000,c=5)
2. Interest(r=0.05,5000,3)
3. Interest(500,t=2,r=0.05)
4. Interest(c=4,r=0.12,p=5000)
i. 1 , 2 and 4 ii. 2 & 3 iii. 1 &4 iv. 3 & 4

133 Consider the program given in question no.132 and answer the question from 133 to 138
given
below:
What will come in place of statement 2:
i. upper() ii. Isupper iii. isupper() iv is_upper()

134 What will come in place of statement 3:

i. [digits] ii. [“digits”] iii. d[“digits”] iv. d[“Digits”]

135 What will come in place of statement 4:


i. [“Special_chr”] iii. “Special_chr”
ii. D[“Special_chr”] iv. d(“Special_chr”)

136 What will come in place of statement 5:


i. s ii. S iii. d[“s”] iv. d[s]

137 What will come in place of statement 6:


i. d[“Upper_case”] iii. [“Upper_case”]
ii. d[“s”] iv. d[s]
138 What will come in place of statement 7:
i. d[“Digits”] iii. d[“digits”]
ii. d[“Digit”] iv. d[s]

139 The built-in function sin() belongs to which module:


i. random ii. pandas iii. Math iv. numpy

140 ..............function returns the smallest integer greater than the given floating point
number.

i. floor() ii. ceil() iii. sqrt() iv CEIL()

141 ............function will return the largest integer less than the given floating point number.

i. floor() ii. ceil() iii. sqrt() iv CEIL()


142 ...........function returns the length of the object being passed.
i. Length() ii. Len() iii. len() iv. count()

143 ...........function returns the absolute value.

i. Abs( ) ii. abs( ) iii. absolute( ) iv. None of these


144 The range(x) function will generate the series of numbers from :
i. Min to max ii. o to x-1 iii. o to x iv. x
145 ........... function can identify the whitespace in a given string.
i. Space( ) ii. isspace( ) iii. Isspace( ) iv. is_space( )
146 Consider the statement given below and answer the question:
>>>S=’My name is Ravindra’
Which statement will print “True” out of the given :
i. print(S.isspace( ))
ii. print (s.isspace( ))
iii. print(S[2].isspace)
iv. print(S[2].isspace( ))

147 A variable declared outside all the functions in a python program, then mention the
statements
which are True in the context of the variable.
1. This variable will have global scope.
2. This variable will not be accessible from anywhere in the prog.
3. This variable will have a large lifetime than local variable.
4. This variable will be referred as Local variable.
i. Only 1&2 ii. Only 1 iii. Only 1&3 iv. Only 3
CASE STUDY QUESTIONS

You might also like