CBSE COMPUTER SCIENCE
الذهاب إلى القناة على Telegram
QUESTION BANK, REFERENCE BOOK, LAB MANUAL , WORKSHEET ETC., PYTHON TEXT BOOK AND REFERENCE BOOKS, 01. ASK QUESTIONS AT https://t.me/joinchat/FJ1noGs-64I0OWI1
إظهار المزيد549
المشتركون
لا توجد بيانات24 ساعات
لا توجد بيانات7 أيام
لا توجد بيانات30 أيام
أرشيف المشاركات
Which of the following is a logical operator:
a) + c) /=
b) and d) in
Which one is an arithmetic operator:
a) not c) **
b) both a & b d) Only b
What will be the correct output of the statement :
>>> 4+2**2*10
a) 18 c) 80
b) 44 d) None of the above
Give the output of the following code:
>>> a,b = 4,2.5
>>> a-b//2**2
a) 4.0 c) 4
b) 0 d) None of the above
If a=1,b=2 and c= 3 then which statement will give the output as : 2.0 from the following:
a) >>>a%b%c+1 c) >>>a%b%c+1.0
b) >>>a%b%c d) >>>a%b%c-1
Give the output of the following code:
>>>7*(8/(5//2))
a) 28 c) 28.0
b) 20 d) 60
What will be the output of the following code:
>>>import math
>>>math.fabs(-5.03)
a) 5.0 c) 5.03
b) -5.03 d) None of the above
Which of the following are the fundamental building block of a python program.
a) Identifier c) Constant
b) Punctuators d) Tokens
……….. function is used to determine the data type of a variable.
a) type( ) c) id( )
b) print( ) d) str( )
Which of the following is not a decision making statement
a) if..else statement c) for statement
b) if-elif statement d) if statement
How many times will the following code be executed.
a=5
while a>0:
print(a)
print(“Bye”)
a) 5 times c) Once
b) Infinite d) None of these
Find the output of the following python program
for i in range(1,15,4):
print(i, end=’,’)
a) 1,20,3, c) 2,3,4,
b) 1,5,10,14, d) 1,5,9,13,
In the nested loop ……………..loop must be terminated before the outer loop.
a) Outer c) enclosing
b) inner d) None of these
How many times will the following code be executed
for i in range(1,15,5):
print(i,end=’,’)
a) 3 c) 4
b) 1 d) infinite
Which of the following creates an object which maps data to a dictionary?
a) listreader() b) reader()
c) tuplereader() d) DicReader ()
Mention the default modes of the File.
a) Read b) Write
c) Append d) Join
To read 4th line from text file, which of the following statement is true?
a) dt = f.readlines();print(dt[3]) b) dt=f.read(4) ;print(dt[3])
c) dt=f.readline(4);print(dt[3]) d) All of these
Which of the following file types can be opened with notepad as well as ms excel?
a) Text Files b) Binary Files
c) CSV Files d) None of these
Which of the following is not a known file type?
a) .pdf b) .jpg
c) .mp3 d) .txp
In f=open(“data.txt”, “r”), f refers to __________.
a) File handle b) File object
c) File Mode d) Buffer
Which of the following not a token?
a) Comments c) Identifiers
b) Literals d) Operators
To include non-graphic characters in python, which of the following is used?
a) Special Literals c) Boolean Literals
b) Escape Sequence Characters d) Special Literal – None
Which of the is a correct statement?
a) xyz = 10 100 1000 c) x y z = 10 100 1000
b) x, y, z = 10, 100, 1000 d) x y z= 10, 100, 1000
Evaluate x % y // x, if x = 5, y = 4
a) 1.0 c) 0.0
b) 0 d) 1
If n=”Hello” and user wants to assign n[0]=’F’ what will be the result?
a) It will replace the first character
b) It’s not allowed in Python to assign a value to an individual character using index
c) It will replace the entire word Hello into F
d) It will remove H and keep rest of the characters
Ms. Hetvee is working on a string program. She wants to display last four characters of a string object named s. Which of the following is statement is true?
a) s[4:] c) s[:4]
b) s[-4:] d) s[:-4]
Which of the following statement creates a tuple?
a) t=[1,,2,3,4]
b) t={1,2,3,4}
c) t=<1,2,3,4>
d) t=(1,2,3,4)
Which one of the following is the correct statement for creating a dictionary for assigning a day number to weekdays using short names?
a) d ={1:Mon,2:Tue,3:Wed,4:Thur}
b) d ={1:’Mon’,2:’Tue’,3:’Wed’,4:’Thur’}
c) d ={1;’Mon’,2;’Tue’,3;’Wed’,4;’Thur’}
d) d ={1-‘Mon’,2-‘Tue’,3-‘Wed’,4-‘Thur’}
import math
def area(r):
return math.pi*r*r
a=int(area(10))
print(a)
a) 314
b) 3.14
c) 31.45
d) None of them
Write the output for the given snippet
def Fun1():
print(‘Python, let\’s fun with functions’)
Fun1()
a) Python, lets fun with functions
b) Python, let-s fun with functions
c) Python, let's fun with functions
d) None of them
input() function always return a value of __________ type.
a) Integer c) String
b) Float d) Error
In python one line can be of maximum ___________ characters.
a) 79 c) 80
b) 77 d) None of them
a = [1,5,7,5]
b = a.index(5)
print(b)
Write the output of above code.
a) 3
b) 4
c) 1
d) None of them
Write the output of the following:
>>> d = “a*hj?”
>>> list(d)
a) ['a', '*', 'h', 'j', '?']
b) [“a”, “*”, “h”, “j”, “?”]
c) {'a', '*', 'h', 'j', '?'}
d) ('a', '*', 'h', 'j', '?')
To add data into an existing file ________ mode is used.
Ans : Append
___________ is a process of storing data into files and allows to perform various tasks such as read, write, append, search and modify in files.
Ans : File Handling
Which of the following is an invalid mode of file opening?
a) read only mode
b) write only mode
c) read and write mode
d) write and append mode
Which of the following error is returned when we try to open a file in write mode which does not exist?
a) FileNotFoundError
b) FileFoundError
c) FileNotExistError
d) None of the above
To open file data.txt for reading, open function will be written as f = _______.
Ans : open(‘data.txt’) or f=open(‘data.txt’,’r’)
A __________ function reads first 15 characters of file.
Ans : read(15)
S SHUNMUGA SUNDARAM, M.E, A.M.I.E, MISTE,. IAENGG, [27-07-2022 19:43]
[ Photo ]
S SHUNMUGA SUNDARAM, M.E, A.M.I.E, MISTE,. IAENGG, [27-07-2022 19:44]
[ Photo ]
S SHUNMUGA SUNDARAM, M.E, A.M.I.E, MISTE,. IAENGG, [27-07-2022 19:45]
[ Photo ]
S SHUNMUGA SUNDARAM, M.E, A.M.I.E, MISTE,. IAENGG, [27-07-2022 19:46]
[ Photo ]
S SHUNMUGA SUNDARAM, M.E, A.M.I.E, MISTE,. IAENGG, [27-07-2022 19:47]
[ Photo ]
S SHUNMUGA SUNDARAM, M.E, A.M.I.E, MISTE,. IAENGG, [27-07-2022 19:49]
[ Photo ]
7 Explain List Comprehension and Elegant way to create new List:
Ans:
1. List comprehension is an elegant and concise way to create new list from an existing list in Python.
2. List comprehension consists of an expression followed by for statement inside square brackets.
3. Here is an example to make a list with each item being increasing power of 2.
pow2 = [2 x for x in range(10)]
# Output: [1, 2, 4, 8, 16, 32, 64, 128, 256, 512] print(pow2)
This code is equivalent to:
pow2 = []
for x in range(10): pow2.append(2 x)
8 What will be the output of following program: theList=[1, 2, [1.1, 2.2]]
len(theList)
Ans:
3
9 What will be the output of following program: my_list = ['p', 'r', 'o', 'b', 'l', 'e', 'm']
print('p' in my_list) print('a' in my_list) print('c' not in my_list) Ans:
True False True
10 What will be the output of following program: for fruit in ['apple','banana','mango']:
print("I like",fruit)
Ans:
I like apple
1 What will be the output of following code-
list1=[1, 3, 2]
list1 * 2
Ans:
[1, 3, 2, 1, 3, 2]
2 What will be the output of following code-
l="Welcome to Python".split()
l
Ans:
['Welcome', 'to', 'Python']
3 What will be the output of following code-
print([i.lower() for i in "HELLO"])
Ans:
['h', 'e', 'l', 'l', 'o']
4 What will be the output of following code-
a=[[[1,2],[3,4],5],[6,7]]
a[0][1][1]
Ans:
4
5 What will be the output of following code-
a,b=[3,1,2],[5,4,6]
a+b
Ans:
[3, 1, 2, 5, 4, 6]
6 What will be the output of following program:
a=[2,1,3,5,2,4]
a.remove(2)
a
Ans:
[1, 3, 5, 2, 4]
1. https://t.me/askpythonquestions
2. https://t.me/cbsecomputerscience
3. https://t.me/todayweareaslearners
4. Python Basics-1 t.me/QuizBot?start=ayrNqFKS
5. Python List-1 t.me/QuizBot?start=eowBkzeL
6. Python List-2 t.me/QuizBot?start=k8DYZ3Oa
7. Python List-3 t.me/QuizBot?start=Smn9ThxH
8. Python FILE HANDLING -1 t.me/QuizBot?start=nQD1Q3kG
9. Python FILE HANDLING -2 t.me/QuizBot?start=vx12PVG3
10. Python FILE HANDLING -3 t.me/QuizBot?start=7VvdcQtz
11. Python FILE HANDLING -4 t.me/QuizBot?start=MnPrt2v4
12. Python FILE HANDLING -5 t.me/QuizBot?start=ohtwqD6S
Model Set t.me/QuizBot?start=mr6DO8hs
MEMORY UNITS: Memory is used to store the data for later
reference. The smallest unit is bit, which mean either 0 or 1.
❑ 1 bit = 0 or 1
❑ 1 Byte = 8 bits
❑ 1 Nibble = 4 bits
❑ 1 Kilo Byte = 1024 Byte= 210 Byte
❑ 1 Mega Byte = 1024 KB= 210 KB
❑ 1 Giga Byte = 1024 MB= 210 MB
❑ 1 Tera Byte = 1024 GB= 210 GB
❑ 1 Peta Byte =1024 TB= 210 TB
❑ 1 Exa Byte =1024 PB= 210 PB
❑ 1 Zetta Byte = 1024 EB= 210 EB
❑ 1 Yotta Byte = 1024 ZB= 210 ZB
11CSWS0101 : Computer System and Organization : https://docs.google.com/forms/d/e/1FAIpQLSc4JP77T5JZKhKRL6F4l1jE7-W-HBIlKtNu6hrQNHfqQi4xZQ/viewform?usp=sf_link
S SHUNMUGA SUNDARAM, M.E, A.M.I.E, MISTE,. IAENGG, [06/01/2022 10:17 PM]
PYTHON : LIST-1 t.me/QuizBot?start=eowBkzeL
S SHUNMUGA SUNDARAM, M.E, A.M.I.E, MISTE,. IAENGG, [06/01/2022 10:18 PM]
PYTHON : LIST-2 t.me/QuizBot?start=k8DYZ3Oa
S SHUNMUGA SUNDARAM, M.E, A.M.I.E, MISTE,. IAENGG, [06/01/2022 10:18 PM]
PYTHON : LIST-3 t.me/QuizBot?start=Smn9ThxH
S SHUNMUGA SUNDARAM, M.E, A.M.I.E, MISTE,. IAENGG, [06/01/2022 10:38 PM]
List object-001 : https://forms.gle/ejQRg25vVc4ALRaX6
S SHUNMUGA SUNDARAM, M.E, A.M.I.E, MISTE,. IAENGG, [06/01/2022 10:38 PM]
Tuple Object-001 : https://forms.gle/Ku6mSpzqTXhRVJBo8
S SHUNMUGA SUNDARAM, M.E, A.M.I.E, MISTE,. IAENGG, [06/01/2022 10:38 PM]
String Object-001 : https://forms.gle/Yv6jhEF78TjAg5R59
S SHUNMUGA SUNDARAM, M.E, A.M.I.E, MISTE,. IAENGG, [06/01/2022 10:39 PM]
Do the above and send your score....
S SHUNMUGA SUNDARAM, M.E, A.M.I.E, MISTE,. IAENGG, [06/01/2022 10:45 PM]
Python Function-001 : https://forms.gle/jBRCbLw8bukPhzQy9
S SHUNMUGA SUNDARAM, M.E, A.M.I.E, MISTE,. IAENGG, [06/01/2022 10:45 PM]
Python Function-002 : https://forms.gle/tvu3GM6THFp5kU7w7
Refer Cryptographic projects : https://www.tutorialspoint.com/cryptography_with_python/cryptography_with_python_quick_guide.htm
Tutorialspoint
Cryptography with Python - Quick Guide
Cryptography with Python - Quick Guide, Cryptography is the art of communication between two users via coded messages. The science of cryptography emerged with the basic motive of providing security t
S SHUNMUGA SUNDARAM, M.E, A.M.I.E, MISTE,. IAENGG, [10/07/2022 10:34 AM]
#FILE HANDLING : SEEK() AND TELL()in BINARY file
'''
tell() : Used to get the actual position of file object
seek() : Used to shift/change the position of file object
to required position.
Syntax :
f.seek(offset, [start_from])
offset tells how may number of bytes to move forward and start_from is optional, it tells from which place we want to start.
There are three possible values for start_from --
0 :beginning of file
1 :current position of file
2 :end of file
* If the argument start_from is not specified, by default it is 0
* The second parameter of the seek method is by default 0
* Reference point(start_from) at current position / end of file
cannot be set in text mode except when offset is equal to 0.
* Possitive index supported for only TEXT files...
Eg. seek(0,0)=seek(0), seek(0,1) = move to current position,
seek(0,2) = move to last position
* Negative index supported for only BINARY files...
'''
f1 = open ("demo.DAT", "rb")
# the user is setting the reference point to thirtieth position to the left from
# end
f1.seek (0, 2)
# now print the current position
print (f1.tell())
# now the user will Convert the binary to string
print (f1.read(5))
# the user is setting the reference point to thirtieth position to the left from
# end
f1.seek (-10, 2)
# now print the current position
print (f1.tell())
# now the user will Convert the binary to string
print (f1.read(5))
# the user is setting the reference point to thirtieth position to the left from
# end
f1.seek (-5, 2)
# now print the current position
print (f1.tell())
# now the user will Convert the binary to string
print (f1.readline().decode('utf-8'))
f1.close()
S SHUNMUGA SUNDARAM, M.E, A.M.I.E, MISTE,. IAENGG, [10/07/2022 10:34 AM]
53
b''
43
b'main '
48
so...
>>>
S SHUNMUGA SUNDARAM, M.E, A.M.I.E, MISTE,. IAENGG, [10/07/2022 10:34 AM]
[ File : demo.dat ]
Quiz Bot, [09/07/2022 9:38 PM]
Your quizzes
1. PYTHON BASICS - 1 220 people answered
🖊 10 questions · ⏱ 1 min · 🔀 all
/view_ayrNqFKS
2. PYTHON : LIST-1 136 people answered
🖊 10 questions · ⏱ 1 min · 🔀 answers
/view_eowBkzeL
3. PYTHON : LIST-2 96 people answered
🖊 10 questions · ⏱ 1 min · 🔀 all
/view_k8DYZ3Oa
4. PYTHON : LIST-3 76 people answered
🖊 10 questions · ⏱ 2 min · 🔀 answers
/view_Smn9ThxH
5. PYTHON : FILE HANDLING -1 97 people answered
🖊 10 questions · ⏱ 2 min · 🔀 answers
/view_nQD1Q3kG
6. PYTHON : FILE HANDLING - 2 65 people answered
🖊 10 questions · ⏱ 1 min · 🔀 answers
/view_vx12PVG3
7. PYTHON : FILE HANDLING - 3 18 people answered
🖊 10 questions · ⏱ 2 min · 🔀 answers
/view_7VvdcQtz
8. PYTHON : FILE HANDLING - 4 55 people answered
🖊 10 questions · ⏱ 2 min · 🔀 answers
/view_MnPrt2v4
9. PYTHON : FILE HANDLING - 5 65 people answered
🖊 10 questions · ⏱ 2 min · 🔀 answers
/view_ohtwqD6S
10. SSJ/2- SET-$ Tentative Answer 10 people answered
🖊 55 questions · ⏱ 1 min · ⏬ no shuffle
/view_mr6DO8hs
