{"id":1027,"date":"2021-07-08T10:43:27","date_gmt":"2021-07-08T05:13:27","guid":{"rendered":"https:\/\/cbsepython.in\/?p=1027"},"modified":"2021-07-14T23:20:10","modified_gmt":"2021-07-14T17:50:10","slug":"class-12-computer-science-unit-test-paper","status":"publish","type":"post","link":"https:\/\/cbsepython.in\/class-12-computer-science-unit-test-paper\/","title":{"rendered":"Class 12 Computer Science Unit Test Paper"},"content":{"rendered":"<p>Class 12 Computer Science Unit Test Paper<\/p>\n<p>Unit Test \u2013 I ( 2021-22)<\/p>\n<p>Q.1\u00a0 a) Name the Python Library modules which need to be imported to invoke the following functions :- (1)<\/p>\n<p>i) sqrt<\/p>\n<p>ii) random<\/p>\n<p>b) Rewrite the following code in python after removing all syntax error(s). Underline each corrections done in the code. (2)<\/p>\n<p>&nbsp;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">250 = Number\r\nWHILE Number &lt;=1000:\r\n    If Number=&gt;750:\r\n        print Number\r\n        Number =Number+100\r\n    elseif:\r\n        print Number * 2\r\n        Number = + 50<\/pre>\n<p>Answer:<\/p>\n<pre>Number =250\r\nwhile Number &lt;=1000:\r\n     if Number &lt;=750:\r\n       print (Number)\r\n       Number = Number+100\r\n     else:\r\n        print (Number * 2)\r\n        Number = + 50<\/pre>\n<p>&nbsp;<\/p>\n<p>c) Find and write the output of the following python code : (2 x 2 = 4)<br \/>\ni)<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">M1='CoMpUTER'\r\nM2='BUgS'\r\nM3=''\r\nfor I in range (0,len(M2)+1):\r\n    if M1[I]&gt;='A' and M1&lt;='M':\r\n        M3=M3+M1[I]\r\n    elif M1[I]&gt;='N' and M1&lt;='Z':\r\n        M3=M3+M2[I]\r\n    else:\r\n        M3=M3+'*'\r\nprint (M3)<\/pre>\n<p>&nbsp;<\/p>\n<p>Answer:<\/p>\n<pre>CoMpU<\/pre>\n<p>ii)<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">def Changer(P,Q=10):\r\n    P=P\/Q\r\n    Q=P%Q\r\n    print (P,'#',Q)\r\n    return P\r\nA=250\r\nB=25\r\nA=Changer(A,B)\r\nprint (A,\"$\",B)\r\nB=Changer(B)\r\nprint (A,\"$\",B)\r\nA=Changer(A)\r\nprint (A,'$',B)\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>Answer:<\/p>\n<pre>10.0 # 10.0\r\n10.0 $ 25\r\n2.5 # 2.5\r\n10.0 $ 2.5\r\n1.0 # 1.0\r\n1.0 $ 2.5<\/pre>\n<p>d) How many times will the following for loop execute and what\u2019s the output ? (1)<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Numbers = [9, 18, 27, 36]\r\nfor Num in Numbers:\r\n    for N in range (1, Num%8):\r\n        print (N,\"#\", end=\"\")\r\nprint()<\/pre>\n<p>&nbsp;<\/p>\n<p>Answer:<\/p>\n<pre>1 #1 #2 #1 #2 #3 #<\/pre>\n<p>Q. 2 Write the functions for the following :- (3 x 2 = 6)<\/p>\n<p>a) Swapper(Numbers) to swap the first half of the contents of a list Numbers with second half of the content of list Numbers and display the swapped values.<br \/>\nFor example:<br \/>\nNumbers=[35,67,89,23,12,45]<br \/>\nAfter swapping [23,12,45,35,67,89]<\/p>\n<p>b) How Many(ID,Val) to count and display number of times the value Val is present in the list ID.<br \/>\nFor example:<br \/>\nID contains [45,65,78,45,23,12,45] and Val contains 45<br \/>\nThe function should display<br \/>\n45 found 3 times<\/p>\n<p>c) Count 3 and 7 (N) to find and display the count of all those numbers which are between 1 and N, which are either divisible by 3 or by 7.<br \/>\nFor example:<br \/>\nIf the value of N is 15<br \/>\nThe sum is 7<br \/>\nAs (3,6,7,9,12,14,15 in between 1 to 15 either divisible of 3 or 7)<\/p>\n<p>&nbsp;<\/p>\n<p>Q. 3 Answer the following :- (2 x 3=6)<\/p>\n<p>a) Write the names of any four data types available in Python.<\/p>\n<p>b) What is the difference between <a href=\"https:\/\/cbsepython.in\/functions-in-python\/\">formal parameters and actual parameters<\/a>? What are there alternative names ? Also give a suitable python code to illustrate both.<\/p>\n<p>c) What is the difference between a local variable and a global variable ? Also, give a suitable code to illustrate both.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Class 12 Computer Science Unit Test Paper Unit Test \u2013 I ( 2021-22) Q.1\u00a0 a) Name the Python Library modules which need to be imported to invoke the following functions :- (1) i) sqrt ii) random b) Rewrite the following code in python after removing all syntax error(s). Underline each corrections done in the code. [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[],"class_list":["post-1027","post","type-post","status-publish","format-standard","hentry","category-cbse-computer-science-with-python-class-12"],"_links":{"self":[{"href":"https:\/\/cbsepython.in\/wp-json\/wp\/v2\/posts\/1027","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cbsepython.in\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cbsepython.in\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cbsepython.in\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/cbsepython.in\/wp-json\/wp\/v2\/comments?post=1027"}],"version-history":[{"count":0,"href":"https:\/\/cbsepython.in\/wp-json\/wp\/v2\/posts\/1027\/revisions"}],"wp:attachment":[{"href":"https:\/\/cbsepython.in\/wp-json\/wp\/v2\/media?parent=1027"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cbsepython.in\/wp-json\/wp\/v2\/categories?post=1027"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cbsepython.in\/wp-json\/wp\/v2\/tags?post=1027"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}