0% found this document useful (0 votes)
283 views3 pages

20.04.23 CS Question Paper MATH

..... Don't use it

Uploaded by

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

20.04.23 CS Question Paper MATH

..... Don't use it

Uploaded by

Joker 1N
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 3
oes VELAMMAL VIDHYASHRAM, Si As. jurapet se PERIODIC TEST - 1- 2023 - 2024 1 : ) Computer Science Time thr30 min Dat 10,04,2023 Max: 35 Marks General Instructions: © This question paper has 2 sections, Section A & B. All questions are compulsory. © Section A has 11 questions carrying 01 mark each. Section B has 12 questions carrying 2 marks each. * All programming questions are to be answered using Python Language only. SECTION-A 1, State True or False “The characters of string will have two-way indexing.” 2. Which of the following Is not a core data type in python? (a)list_ (b) Dictionary (c) Tuple (d) Class 3, Consider the given expression: not False or False and True Which of the following will be correct output if the given expression is evaluated? (a) True (b) False {c) NONE (d) NULL 4, Select the correct output of the code. a='assistance’ .partition('a') [O]+"_+alt]+"_'+al2] print(b) (a) _a_ssistance (b) -a-ssistance (c) -a-ssist-ance (d) a-ssist-nce 5. Which of the following statement(s) would give an error after executing the following code? list = (12,14,16,18,19,25,34) # statement 1 print(list{:}) # statement 2 list = list(4:]+list[:4] # statement 3 del list[3:6] # statement 4 print(list.count(23)) # statement 5 (a) statement 1, statement 2 & statement 3 (b) statement 3 (c) statement 4 (d) statement 4 & statement 5 6. Write the output of the following: print("! love my country".find('o',4)) 7. Select the correct output of the code: D[''stops"]= "overthinking" D["Overcome"]="negativity” print(D.get("Stops","discouraging”)) print(D.get("overcome', "obstacles")) (a) overthinking netativity (b) discouraging negativity (c) discouraging obstacles (d) overthinking obstacles 8. Select the correct output of the code: T= (12,10,13,11) x= sorted(T) print(x,Tsep=" &") {2) (10, 14, 12, 13) & (22, 10, 13,14] _ (b) [40, 14, 12, 13) & (12,20, 13, 11) (c) (10, 14, 12, 13) & (20, 14, 12, 13) (d) [10, 14, 12, 13] & (10, 11, 12, 13) 1 9, What will be the output of below python code? list1=["tom”, “mary’, “simon”] list4.Insert(5,8) print(list2) a) [‘tom”, “mary’, “simon”, 5] b) ["tom”, “mary”, “simon”, 8] )[8, “tom”, “marry”, “simon’] d) Error Q10 and Q 11 are ASSERTION (A) and REASONING (R) based questions. Mark the correct choice as (a) Both (A) and (R) are True and (R) is the correct explanation for (A). (b) Both (A) and (R) are True and (R) not is the correct explanation for (A). (c) (A)|s true but (R) Is false. (d) (A)is false but (R) Is true. 10. Assertion (A). Dictionaries are mutable but thelr keys are immutable. Reason(R). The values of a dictionary can change but keys of dictionary cannot be changed because through them data is hashed. @ 11. Assertion (A): Variables whose values can be changed after they are created and assigned are called immutable. Reason(R): When an attempt is made to update the value of ari immutable variable, the old variable is destroyed and a new variable Is created by the same name in memory SECTION -B 12. Rewrite the correct code and underline the corrections made in the following snippet. K=30 { For D in range(0,k): ifD<5 print(‘Got it”) Else Print(“Missed”) 13, What will the following expression be evaluated to In Python? print(16-(3+2)*5+2**3"4) 14, (a) Given Is a Python string declaration: s="Up Above The World So High” Write the output of print(st::~4]) (b)Write the output of the code given below: D={‘month’:/DECEMBER’,’exam’:’PREBOARD1’}. D[‘month’]="JANUARY’ D[‘EXAM’]=’PRE2’ print(D.items()) 15. a) What will be the output of the following string operation. str="PYHON@LANGUAGE" print(str[2:12:2]) b) Write the output of the following code. data = [1,2,4,5] for x in data: xextd 16. Predict the following output of the Python code given below: (11,22,33,44,55,66) ifi%2 ): new_list.append(i) new_tuple = tuple(new_list) print(new_tuple) 17. Why list cannot be used as keys in Python dictionaries? Justify with Example. 18. Differentiate between break and continue statement in Python. (oR) Differentiate between mutable and immutable types in Python. | 19, oo ‘the output of the code given below: 2750 n,m=len(s), "" for |in range(0, n): if si]islower(): m= msfl] elif s[I].isupper(): m=m +s[l+1] elif s[i].isdigit(): m= m*int(s{il) else: m='@'+m print(m) 20. Predict the output of the code given below: frult_list1 = ['Apple', 'Berry,, ‘Cherry’, 'Papaya’] fruit_list2 = frult_tist fruit_list3 = frult_list1{}) sum =0. for ($n (fruit_listt, fruit_list2, fruit_lst3): if Is{0] sum ifls{4] sum print (sum) 21, Create a dictionary whose keys are month name and whose values are number of days in the corresponding month: (a) Ask the user to enter the month name and use the dictionary to tell how many days are in month. 22. Difference between (10) and {10,) in Python. (oR) Look at the dictionary objects D1,D2 & D3 defined below. D1={("ONI }|E":1,"TWO":2,"THREE":3} D2=D1 3=D1.copy() What will happen if the statement D3 ['TWO'] =4 gets executed? 23. Write a program rotates the elements ofa list show that the element at the first Index moves to the second Index, the element in second index moves to the third index, ete., and the element in the last index moves to the first index. seaeencesenet

You might also like