Idea of Algorithm Efficiency in Python Class 12 Solutions

Teachers and Examiners (CBSESkillEduction) collaborated to create the Idea of Algorithm Efficiency in Python Class 12 Solutions. All the important Information are taken from the NCERT Textbook Computer Science (083) class 12.

Idea of Algorithm Efficiency in Python Class 12 Solutions

1. An ___________ is a sufficiently precise method or procedur for accomplishing a specific tast, which can be programmed on computer.
a. Algorithm 
b. Complexity
c. Big-O
d. None of the above

Show Answer ⟶
a. Algorithm

2. ________ referes to the measure of the performace of an algorithm.
a. Algorithm
b. Complexity 
c. Big-O
d. None of the above

Show Answer ⟶
b. Complexity

3. __________ can be related to time (temporal complexity) or to space (space complexity).
a. Algorithm
b. Complexity 
c. Big-O
d. None of the abve

Show Answer ⟶
b. Complexity

4. ________ notation is used to depict an algorithm’s growth rate i.e. change in algorithm performance when its input size grows.
a. Algorithm
b. Complexity
c. Big-O 
d. None of the abve

Show Answer ⟶
c. Big-O

5. __________ term is the one which affects the most, an algorithm’s performance.
a. Algorithm
b. Complexity
c. Big-O
d. Dominant 

Show Answer ⟶
d. Dominant

6. Only the ________ term is inclued in Big-O notation.
a. Algorithm
b. Complexity
c. Big-O
d. Dominant 

Show Answer ⟶
d. Dominant

7. The Worst case complexity provides an _________ on running time.
a. Upper-bound 
b. Lower-bound
c. Middle-bound
d. All of the above

Show Answer ⟶
a. Upper-bound

8. ___________ complexity provieds expected running time.
a. Algorithm
b. Complexity
c. Best-Case
d. Average-Case 

Show Answer ⟶
d. Average-Case

9. _________ complxity provides the time of optimal performace.
a. Algorithm
b. Complexity
c. Best-Case 
d. Average-Case

Show Answer ⟶
c. Best-Case

10. Define Big ‘O’ notation. State the two factors which determine the complexity of an algorithm.
Answer – Big O notation, which provides the measurement of the time while an algorithm operates with the worst input it can receive, typically specifies the worst case complexity. The two factors that affect an algorithm’s complexity are time and space.

11. Distinguish between worst-case and best-case complexity of an algorithm.
Answer – The function with the fewest steps taken on input data with n elements is the best case. The worst-case scenario is the function that goes through the most steps with input data of size n. The function that goes through the most steps on input data with n elements is called the average case.

12. What is an algorithm? What do you understand by alogrithm performance?
Answer – A set of instructions called an algorithm is what a computer must follow in order to conduct calculations or other problem-solving tasks. A formal definition of an algorithm is that it is a finite set of instructions that are carried out in a particular order to complete a specified task.

13. What is computationl complexity?
Answer – The task is to determine how many times each letter appears in an N-letter string. The entire string is iterated over by a crude algorithm once for each potential letter. The procedure is linear in N since the size of the alphabet is fixed

14. Is linear search or binary search faster?
Answer – When compared to a linear search, a binary search is faster in finding an element. In contrast to linear search, which works with both sorted and unsorted arrays, binary search just requires that an array be in sorted order.

15. Which factors affect an algorithm’s performance?
Answer – One of the most important factors in assessing an algorithm’s potential is speed. The effectiveness of an algorithm is also affected by other elements including usability, security, maintainability, and utilisation space. Complexity measures for space and time are used to assess parameters.

16. Which complexity is more O(n) or O(log n)?
Answer – An algorithm of O(n) will execute steps proportional to n for an input of size n, while an algorithm of O(log(n)) will execute steps roughly log(n). Since log(n) is obviously smaller than n, an algorithm with an O(log(n)) complexity is preferable.

17. What are different types of complexities that are considered?
Answer – The complexity can take on any shape, including linear, n*log(n), quadratic, cubic, exponential, and more. It is nothing more than the number of steps necessary to complete a specific algorithm, whether they are constant, logarithmic, linear, or another type.

18. What do you understand by Big-O notation? What is its significance?
Answer – Big O Notation is a technique for expressing how time-consuming an algorithm is. As the input increases, it calculates how long it will take to perform an algorithm. In other words, it determines an algorithm’s worst-case time complexity. The maximum runtime of an algorithm is expressed using the Big O Notation in data structures.

19. What do you understand by best-case, worst-case and average-case complexitites? When are they considered?
Answer – The function with the fewest steps taken on input data with n elements is the best case. The worst-case scenario is the function that goes through the most steps with input data of size n. The function that goes through the most steps on input data with n elements is called the average case.

Computer Science Class 12 Notes

  1. Python Revision tour – 1 Class 12 Notes
  2. Python Revision tour – 2 Class 12 Notes Notes
  3. Working with Functions Class 12 Notes
  4. Using Python Libraries Class 12 Notes
  5. File Handling Class 12 Notes
  6. Recursion Class 12 Notes
  7. Idea of Algorithmic Efficiency Class 12 Notes
  8. Data Visualization using Pyplot Class 12 Notes
  9. Data Structure Class 12 Notes
  10. Computer Network Class 12 Notes
  11. More on MySQL Class 12 Notes

MCQ for Class 12 Computer Science Python

  1. Python Revision tour – 1 Class 12 MCQs
  2. Python Revision tour – 2 Class 12 MCQs
  3. Working with Functions Class 12 MCQs
  4. Using Python Libraries Class 12 MCQs
  5. File Handling Class 12 MCQs
  6. Recursion Class 12 MCQs
  7. Data Visualization using Pyplot Class 12 MCQs
  8. Data Structure Class 12 MCQs
  9. Computer Network Class 12 MCQs
  10. More on MySQL Class 12 MCQs

Computer Science Class 12 Questions and Answers

  1. Python Revision tour – 1 Class 12 Questions and Answers
  2. Working with Functions Class 12 Questions and Answers
  3. Using Python Libraries Class 12 Questions and Answers
  4. File Handling Class 12 Questions and Answers
  5. Recursion Class 12 Questions and Answers
  6. Idea of Algorithmic Efficiency Class 12 Questions and Answers
  7. Data Structure Class 12 Questions and Answers
  8. More on MySQL Class 12 Questions and Answers
  9. Computer Network Class 12 Questions and Answers
  10. More on MySQL Class 12 Questions and Answers 

Recursion in Python Class 12 Questions and Answers

Teachers and Examiners (CBSESkillEduction) collaborated to create the Recursion in Python Class 12 Questions and Answers. All the important Information are taken from the NCERT Textbook Computer Science (083) class 12.

Recursion in Python Class 12 Questions and Answers

1. What is recursion?
Answer – Python also permits function recursion, allowing defined functions to call one another. A frequent idea in math and programming is recursion. It denotes that a function makes a call to itself. This has the advantage of allowing you to loop through data to arrive at a conclusion.

2. What are base case and recursive case?
Answer – Recursive functions are ones that make calls to themselves. The base case and the recursive case are its two main components. The prerequisite for stopping the recursion is the base case. When a function calls on itself, it is said to be in a recursive case.

3. Why is base case so important in a recursive function?
Answer – The basic case of a suitable recursive function must always exist: A method of returning without performing a recursive call is the basic case. In other words, it is the mechanism that puts an end to this cycle of recursive calls that keep getting bigger and bigger while a stack of function calls waits for other function calls to return.

4. When does infinite recursion occur?
Answer – A recursion will continue to make recursive calls indefinitely if it never hits a base case, and the programme will never come to an end. This is referred to as infinite recursion, and it is typically not recommended. A programme with infinite recursion won’t typically run forever in most programming environments.

5. Compare iteration and recursion.
Answer – Iteration and recursion are two alternative approaches to repeatedly carrying out a set of instructions. The key distinction between the two is that whereas in iteration we use loops like “for” and “while,” in recursion we utilise function calls to continually execute the statements inside the function body.

Computer Science Class 12 Notes

  1. Python Revision tour – 1 Class 12 Notes
  2. Python Revision tour – 2 Class 12 Notes Notes
  3. Working with Functions Class 12 Notes
  4. Using Python Libraries Class 12 Notes
  5. File Handling Class 12 Notes
  6. Recursion Class 12 Notes
  7. Idea of Algorithmic Efficiency Class 12 Notes
  8. Data Visualization using Pyplot Class 12 Notes
  9. Data Structure Class 12 Notes
  10. Computer Network Class 12 Notes
  11. More on MySQL Class 12 Notes

MCQ for Class 12 Computer Science Python

  1. Python Revision tour – 1 Class 12 MCQs
  2. Python Revision tour – 2 Class 12 MCQs
  3. Working with Functions Class 12 MCQs
  4. Using Python Libraries Class 12 MCQs
  5. File Handling Class 12 MCQs
  6. Recursion Class 12 MCQs
  7. Data Visualization using Pyplot Class 12 MCQs
  8. Data Structure Class 12 MCQs
  9. Computer Network Class 12 MCQs
  10. More on MySQL Class 12 MCQs

Computer Science Class 12 Questions and Answers

  1. Python Revision tour – 1 Class 12 Questions and Answers
  2. Working with Functions Class 12 Questions and Answers
  3. Using Python Libraries Class 12 Questions and Answers
  4. File Handling Class 12 Questions and Answers
  5. Recursion Class 12 Questions and Answers
  6. Idea of Algorithmic Efficiency Class 12 Questions and Answers
  7. Data Structure Class 12 Questions and Answers
  8. More on MySQL Class 12 Questions and Answers
  9. Computer Network Class 12 Questions and Answers
  10. More on MySQL Class 12 Questions and Answers 

Recursion in Python Class 12 MCQ

Teachers and Examiners (CBSESkillEduction) collaborated to create the Recursion in Python Class 12 MCQ. All the important Information are taken from the NCERT Textbook Computer Science (083) class 12.

Recursion in Python Class 12 MCQ

1. A function is said to be __________ if it calls itself.
a. Recursive
b. Calling function
c. Default function
d. None of the above

Show Answer ⟶
a. Recursive

2. There are two cases in each recursive functions – the __________ case and the ________ case.
a. Recursive case and base case
b. Default case and Recursive case
c. Base case and Default case
d. None of the above

Show Answer ⟶
a. Recursive case and base case

3. The _________ case is the case whose solution is pre-known and is used without computation.
a. Default case
b. Recursive case
c. Base case
d. None of the above

Show Answer ⟶
c. Base case

4. The ___________ case is more general case of problem, which is being solved.
a. Default case
b. Recursive case
c. Base case
d. None of the above

Show Answer ⟶
b. Recursive case

5. An __________ recursion is when a recursive function calls its self endlessly.
a. Default case
b. Recursive case
c. Base case
d. Infinite Recursive

Show Answer ⟶
d. Infinite Recursive

6. If there is no __________, or if the _________ is never executed, infinite recursion occurs.
a. Default case
b. Recursive case
c. Base case
d. Infinite Recursive

Show Answer ⟶
c. Base case

7. ____________ uses some memory space for each pass contrary to recursion where fresh memory is allocated for each successive call.
a. Iteration
b. Recursive case
c. Base case
d. Infinite Recursive

Show Answer ⟶
a. Iteration

8. ________ function are relatively slower than theier eterative counterparts.
a. Iteration
b. Recursive
c. Successive
d. None of the above

Show Answer ⟶
b. Recursive

9. Some commonly used recursive algorithms are _________ .
a. Factorial & GCD
b. Fibonacci Series
c. Binary Search
d. All of the above

Show Answer ⟶
d. All of the above

Computer Science Class 12 Notes

  1. Python Revision tour – 1 Class 12 Notes
  2. Python Revision tour – 2 Class 12 Notes Notes
  3. Working with Functions Class 12 Notes
  4. Using Python Libraries Class 12 Notes
  5. File Handling Class 12 Notes
  6. Recursion Class 12 Notes
  7. Idea of Algorithmic Efficiency Class 12 Notes
  8. Data Visualization using Pyplot Class 12 Notes
  9. Data Structure Class 12 Notes
  10. Computer Network Class 12 Notes
  11. More on MySQL Class 12 Notes

MCQ for Class 12 Computer Science Python

  1. Python Revision tour – 1 Class 12 MCQs
  2. Python Revision tour – 2 Class 12 MCQs
  3. Working with Functions Class 12 MCQs
  4. Using Python Libraries Class 12 MCQs
  5. File Handling Class 12 MCQs
  6. Recursion Class 12 MCQs
  7. Data Visualization using Pyplot Class 12 MCQs
  8. Data Structure Class 12 MCQs
  9. Computer Network Class 12 MCQs
  10. More on MySQL Class 12 MCQs

Computer Science Class 12 Questions and Answers

  1. Python Revision tour – 1 Class 12 Questions and Answers
  2. Working with Functions Class 12 Questions and Answers
  3. Using Python Libraries Class 12 Questions and Answers
  4. File Handling Class 12 Questions and Answers
  5. Recursion Class 12 Questions and Answers
  6. Idea of Algorithmic Efficiency Class 12 Questions and Answers
  7. Data Structure Class 12 Questions and Answers
  8. More on MySQL Class 12 Questions and Answers
  9. Computer Network Class 12 Questions and Answers
  10. More on MySQL Class 12 Questions and Answers 

File Handling in Python Class 12 NCERT Solutions

Teachers and Examiners (CBSESkillEduction) collaborated to create the File Handling in Python Class 12 NCERT Solutions. All the important Information are taken from the NCERT Textbook Computer Science (083) class 12.

File Handling in Python Class 12 NCERT Solutions

1. Differentiate between:
a) text file and binary file
Answer – Data files primarily come in two flavours: text files and binary files. Any text editor can open a text file since it is made up of characters that are human readable. Binary files, on the other hand, contain non-human readable characters and symbols and need special software to retrieve its information.

b) readline() and readlines()
Answer – When called, the readline() function in Python returns a line from the file. The readlines() method will return every line in a file as a list with each item representing a line in the file.

c) write() and writelines()
Answer – A string is passed as an argument to the write() method, which writes it to a text file. To write several strings to a file, use the writelines() method. To use the writelines() method, we must supply an iterable object (such as a list, tuple, etc.) that contains strings.

2. Write the use and syntax for the following methods:
a) open()
Answer – open(file_name, mode)
b) read()
Answer – file_object.read()
c) seek()
Answer – f.seek(offset, from_what)
d) dump()
Answer – dump(data_object, file_object)

3. Write the file mode that will be used for opening the following files. Also, write the Python statements to open the following files:
a) a text file “example.txt” in both read and write mode
b) a binary file “bfile.dat” in write mode
c) a text file “try.txt” in append and read mode
d) a binary file “btry.dat” in read only mode.
Answer –
a) file = open( “example.txt”, “w+” )
b)file = open(“bfile.dat” , “wb” )
c) file = open ( “try.txt” , “a+” )
d) file = open( “btry.dat” , “rb” )

4. Why is it advised to close a file after we are done with the read and write operations? What will happen if we do not close it? Will some error message be flashed?
Answer – As Python ensures that any unwritten or unsaved data is flushed off (written to the file) before the file is closed, the main reason to close a file after read and write operations is to prevent the application from slowing down. So, once we’re done with it, it’s always a good idea to close the file.

5. What is the difference between the following set of statements (a) and (b):
a) P = open(“practice.txt”,”r”)
P.read(10)
b) with open(“practice.txt”, “r”) as P:
x = P.read()
Answer – File P will read 10 characters in part “a” but won’t print anything; in part “b,” however, it will read every character in the practise file and save it in the variable “x.”

6. Write a command(s) to write the following lines to the text file named hello.txt. Assume that the file is opened in append mode.
“ Welcome my class”
“It is a fun place”
“You will learn and play”
Answer –
f = open(“hello.txt”,”a”)
f.write(“Welcome my class”)
f.write(“It is a fun place”)
f.write(“You will learn and play”)
f.close()

7. Write a Python program to open the file hello.txt used in question no 6 in read mode to display its contents. What will be the difference if the file was opened in write mode instead of append mode?
Answer –
f = open(“hello.txt”,”r”)
x = f.read()
print(x)

8. Write a program to accept string/sentences from the user till the user enters “END” to. Save the data in a text file and then display only those sentences which begin with an uppercase alphabet.
Answer –
f = open(“example.txt”,”w”)
while True :
sen = input(“Enter something ( Enter END for quit ) :-“)
if sen == “END” :
break
else :
f.write(sen + “\n”)
f.close()
print()
print(“Lines started with Capital letters :-“)
f = open(“example.txt”,”r”)
print()
data = f.readlines()
for i in data :
if i[0].isupper() :
print(i)
f.close()

9. Define pickling in Python. Explain serialization and deserialization of Python object.
Answer – When serialising and deserializing a Python object structure, pickle is primarily employed. It involves transforming a Python object into a byte stream in order to store it in a file or database, keep programme state consistent across sessions, or send data over the network.

10. Write a program to enter the following records in a binary file:
Item No integer
Item_Name string
Qty integer
Price float
Number of records to be entered should be accepted from the user. Read the file to display the records in the following format:
Item No:
Item Name :
Quantity:
Price per item:
Amount: ( to be calculated as Price * Qty
Answer –
import pickle

file = open(“Pathwalla.dat”,”wb”)

while True :
dic = { }
Item_No = int(input(“Enter Item no.”))
Item_Name = input(“Enter Item name :-“)
Qty = int(input(“Enter Quantity :- “))
Price = float(input(“Enter price :-“))

dic[ “Item_No” ] = Item_No
dic[ “Item_Name” ] = Item_Name
dic[ “Qty” ] = Qty
dic[ “Price” ] = Price
pickle.dump( dic , file )
print()
ans = input(“Do you want to quit Enter [ Y/N ] :-“)
if ans == “y” or ans == “Y” :
break
print()

file.close()
print()
file = open(“Pathwalla.dat”,”rb”)

try :
while True :
dic = pickle.load(file)
print( “Item No. :”,”\t”, dic[ “Item_No” ] )
print( “Item Name :”,”\t”, dic[ “Item_Name” ] )
print( “Quantity :”,”\t”, dic[ “Qty” ] )
print( “Price of one :”,”\t”,dic[ “Price” ] )
print( “Amount :”, “\t” , dic[ “Qty” ] * dic[ “Price” ] )
print()
except :
file.close()

Computer Science Class 12 Notes

  1. Python Revision tour – 1 Class 12 Notes
  2. Python Revision tour – 2 Class 12 Notes Notes
  3. Working with Functions Class 12 Notes
  4. Using Python Libraries Class 12 Notes
  5. File Handling Class 12 Notes
  6. Recursion Class 12 Notes
  7. Idea of Algorithmic Efficiency Class 12 Notes
  8. Data Visualization using Pyplot Class 12 Notes
  9. Data Structure Class 12 Notes
  10. Computer Network Class 12 Notes
  11. More on MySQL Class 12 Notes

MCQ for Class 12 Computer Science Python

  1. Python Revision tour – 1 Class 12 MCQs
  2. Python Revision tour – 2 Class 12 MCQs
  3. Working with Functions Class 12 MCQs
  4. Using Python Libraries Class 12 MCQs
  5. File Handling Class 12 MCQs
  6. Recursion Class 12 MCQs
  7. Data Visualization using Pyplot Class 12 MCQs
  8. Data Structure Class 12 MCQs
  9. Computer Network Class 12 MCQs
  10. More on MySQL Class 12 MCQs

Computer Science Class 12 Questions and Answers

  1. Python Revision tour – 1 Class 12 Questions and Answers
  2. Working with Functions Class 12 Questions and Answers
  3. Using Python Libraries Class 12 Questions and Answers
  4. File Handling Class 12 Questions and Answers
  5. Recursion Class 12 Questions and Answers
  6. Idea of Algorithmic Efficiency Class 12 Questions and Answers
  7. Data Structure Class 12 Questions and Answers
  8. More on MySQL Class 12 Questions and Answers
  9. Computer Network Class 12 Questions and Answers
  10. More on MySQL Class 12 Questions and Answers 

File Handling in Python Class 12 MCQ

Teachers and Examiners (CBSESkillEduction) collaborated to create the File Handling in Python Class 12 MCQ. All the important Information are taken from the NCERT Textbook Computer Science (083) class 12.

File Handling in Python Class 12 MCQ

1. A text file stores information is __________ characters.
a. ASCII
b. Unicode
c. Both a) and b) 
d. None of the above

Show Answer ⟶
c. Both a) and b)

2. In text files, each line of text is terminated, with a special character known as ___________.
a. EOL 
b. EOF
c. EEF
d. All of the above

Show Answer ⟶
a. EOL

3. Which one of the following is correct for carriage-return and newline combination.
a. \r\n 
b. /r/n
c. \r/n
d. /r\n

Show Answer ⟶
a. \r\n

4. A _________ file is just a file that contains information in the same format in which the information is held in memory.
a. Text file
b. Binary file 
c. Word file
d. None of the above

Show Answer ⟶
b. Binary file

File Handling in Python Class 12 MCQ

5. _________file format are faster and easier for a prgram to read and write than other file format.
a. Text file
b. Binary file 
c. Doc file
d. None of the above

Show Answer ⟶
b. Binary file

6. The command for opening a file in Python file handling is ____________.
a. open() 
b. update()
c. both a) and b)
d. None of the above

Show Answer ⟶
a. open()

7. The command for closing a file in Python file handling is ____________.
a. close() 
b. closing()
c. object()
d. None of the above

Show Answer ⟶
a. close()

8. _________ text file mode is used to read data from file.
a. ‘r’
b. ‘rb’
c. ‘r+’
d. None of the above

Show Answer ⟶
a. ‘r’

9. _________ text file mode is used to apped data in the file using file handling.
a. ‘w’
b. ‘ab’
c. ‘a’ 
d. None of the above

Show Answer ⟶
c. ‘a’

File Handling in Python Class 12 MCQ

10. _________ binary file mode is used to append data in the file using file handling.
a. ‘ab’ 
b. ‘w’
c. ‘a’
d. None of the above

Show Answer ⟶
a. ‘ab’

11. Which of the following option is correct for ‘a+’ text file mode.
a. File is create if does not exit
b. If file exist, file’s existing data is retained; new data is appended
c. Both reading and writing operation can take palce.
d. All of the above 

Show Answer ⟶
d. All of the above

12. ___________ function is used to read the data from the file.
a. read()
b. readline()
c. readlines()
d. All of the above 

Show Answer ⟶
d. All of the above

13. Which function is used to write data onto a file.
a. write()
b. writelines()
c. Both a) and b) 
d. None of the above

Show Answer ⟶
c. Both a) and b)

14. Python holds everything to write in the file in buffer. if you want to force python to write the contents of buffer onto storage, you can use ________ function.
a. flush() 
b. push()
c. clear()
d. None of the above

Show Answer ⟶
a. flush()

File Handling in Python Class 12 MCQ

15. Which function is used to remove whitespace after reading a file in file handling.
a. write()
b. read()
c. strip() 
d. None of the above

Show Answer ⟶
c. strip()

16. _________ removes the given character from trailing end or from the right end.
a. strip()
b. rstrip() 
c. lstrip()
d. None of the above

Show Answer ⟶
b. rstrip()

17. A text file can be opened in ________ file modes.
a. ‘r’ and ‘w’
b. ‘a’ and ‘r+’
c. ‘w+’ and ‘a+’
d. All of the above 

Show Answer ⟶
d. All of the above

18. A binary file can be opend in ________ file mode.
a. ‘rb’ and ‘wb’
b. ‘ab’ and ‘r+b’
c. (‘rb+’), ‘w+b'(wb+’), ‘a+b'(‘ab+’)
d. All of the above 

Show Answer ⟶
d. All of the above

19. ________ are the standard streams in file handling.
a. stdin (standard input)
b. stdout (standard output)
c. stderr (standard error)
d. All of the above 

Show Answer ⟶
d. All of the above

File Handling in Python Class 12 MCQ

20. The input and output devices are implemented as file, also called __________.
a. Standard streams 
b. Standard Binary
c. Standar Text
d. None of the above

Show Answer ⟶
a. Standard streams

21. In python directory denonted as a dot(.) while its parent directory is denoted with ________.
a. Three dots(…)
b. Two dots(..) 
c. Both a) and b)
d. None of the above

Show Answer ⟶
b. Two dots(..)

Computer Science Class 12 Notes

  1. Python Revision tour – 1 Class 12 Notes
  2. Python Revision tour – 2 Class 12 Notes Notes
  3. Working with Functions Class 12 Notes
  4. Using Python Libraries Class 12 Notes
  5. File Handling Class 12 Notes
  6. Recursion Class 12 Notes
  7. Idea of Algorithmic Efficiency Class 12 Notes
  8. Data Visualization using Pyplot Class 12 Notes
  9. Data Structure Class 12 Notes
  10. Computer Network Class 12 Notes
  11. More on MySQL Class 12 Notes

MCQ for Class 12 Computer Science Python

  1. Python Revision tour – 1 Class 12 MCQs
  2. Python Revision tour – 2 Class 12 MCQs
  3. Working with Functions Class 12 MCQs
  4. Using Python Libraries Class 12 MCQs
  5. File Handling Class 12 MCQs
  6. Recursion Class 12 MCQs
  7. Data Visualization using Pyplot Class 12 MCQs
  8. Data Structure Class 12 MCQs
  9. Computer Network Class 12 MCQs
  10. More on MySQL Class 12 MCQs

Computer Science Class 12 Questions and Answers

  1. Python Revision tour – 1 Class 12 Questions and Answers
  2. Working with Functions Class 12 Questions and Answers
  3. Using Python Libraries Class 12 Questions and Answers
  4. File Handling Class 12 Questions and Answers
  5. Recursion Class 12 Questions and Answers
  6. Idea of Algorithmic Efficiency Class 12 Questions and Answers
  7. Data Structure Class 12 Questions and Answers
  8. More on MySQL Class 12 Questions and Answers
  9. Computer Network Class 12 Questions and Answers
  10. More on MySQL Class 12 Questions and Answers 

Using Python Libraries Class 12 Important Questions

Teachers and Examiners (CBSESkillEduction) collaborated to create the Using Python Libraries Class 12 Important Questions. All the important Information are taken from the NCERT Textbook Computer Science (083) class 12.

Using Python Libraries Class 12 Important Questions

1. What is module, package and a library?
Answer – A module is a file that includes Python functions, global variables, and other things. It is merely a.py file containing Python executable code or statements. A package is a namespace that includes several other packages and modules.
Library It consists of a variety of packages. Conceptually, there is no distinction between a Python library and a package.

2. What is a python module?
Answer – A file with Python definitions and statements is known as a module. Variables, classes, and functions can all be defined in a module. Runnable code may also be included in a module. Code that has been grouped together into modules is simpler to read and utilise. Additionally, it organises the code logically.

Using Python Libraries Class 12 Important Questions

3. What is the utility of built – in function help()?
Answer – The documentation for modules, functions, classes, keywords, etc. is shown using the help() function. The interactive help tool launches on the console if we don’t pass an argument to the help function.

4. What is docstrings? How are they useful?
Answer – A Python module, class, function, or method is documented with a string known as a “docstring” so that programmers may understand what it does without having to learn the specifics of how it is implemented. Additionally, it is usual practice to automatically produce online (html) documentation from docstrings.

5. What happens when Python encounters an import statement in a program?
Answer – If the module is found in the search path when the interpreter comes across an import statement, it is imported. The interpreter uses a search path, which is a list of directories, when importing a module.

Using Python Libraries Class 12 Important Questions

6. What is the procedure to create own library/package in Python?
Answer – You need to give your Python package a special name. No two Python packages with an existing name can have the same name. The name of your package must be the same for both the parent folder and the subfolder. There are packages and parameter names in the setup.py file.

7. Why is a package attached to site-package folder of Python installation?
Answer – What function does the Python installation’s site-packages folder serve? The default location and folder from which the Python interpreter imports all user-defined packages and libraries is called site-package. So, in order to import any package using the import command, we must attach it to the Python installation’s site-package folder.

Computer Science Class 12 Notes

  1. Python Revision tour – 1 Class 12 Notes
  2. Python Revision tour – 2 Class 12 Notes Notes
  3. Working with Functions Class 12 Notes
  4. Using Python Libraries Class 12 Notes
  5. File Handling Class 12 Notes
  6. Recursion Class 12 Notes
  7. Idea of Algorithmic Efficiency Class 12 Notes
  8. Data Visualization using Pyplot Class 12 Notes
  9. Data Structure Class 12 Notes
  10. Computer Network Class 12 Notes
  11. More on MySQL Class 12 Notes

MCQ for Class 12 Computer Science Python

  1. Python Revision tour – 1 Class 12 MCQs
  2. Python Revision tour – 2 Class 12 MCQs
  3. Working with Functions Class 12 MCQs
  4. Using Python Libraries Class 12 MCQs
  5. File Handling Class 12 MCQs
  6. Recursion Class 12 MCQs
  7. Data Visualization using Pyplot Class 12 MCQs
  8. Data Structure Class 12 MCQs
  9. Computer Network Class 12 MCQs
  10. More on MySQL Class 12 MCQs

Computer Science Class 12 Questions and Answers

  1. Python Revision tour – 1 Class 12 Questions and Answers
  2. Working with Functions Class 12 Questions and Answers
  3. Using Python Libraries Class 12 Questions and Answers
  4. File Handling Class 12 Questions and Answers
  5. Recursion Class 12 Questions and Answers
  6. Idea of Algorithmic Efficiency Class 12 Questions and Answers
  7. Data Structure Class 12 Questions and Answers
  8. More on MySQL Class 12 Questions and Answers
  9. Computer Network Class 12 Questions and Answers
  10. More on MySQL Class 12 Questions and Answers 

Using Python Libraries Class 12 MCQ

Teachers and Examiners (CBSESkillEduction) collaborated to create the Using Python Libraries Class 12 MCQ. All the important Information are taken from the NCERT Textbook Computer Science (083) class 12.

Using Python Libraries Class 12 MCQ

1. __________ is a collection of modules and packages are used for a specific type of applications or requirements.
a. Library 
b. String
c. List
d. None of the above

Show Answer ⟶
a. Library

2. __________ library provides some advance math functionalities along wiht tools to create and manipulate numeric arrays.
a. NumPy library 
b. SciPy library
c. Malpolotlib library
d. None of the above

Show Answer ⟶
a. NumPy library

Using Python Libraries Class 12 MCQ

3. ___________ library offers algorithmic and mathematical tools for scientific calculations.
a. NumPy library
b. SciPy library 
c. Malpolotlib library
d. None of the above

Show Answer ⟶
b. SciPy library

4. _________ library provides traditional Python user interface toolkit and helps you to create user-friendly GUI interface for different types of applications.
a. NumPy library
b. Tkinter library 
c. Malpolotlib library
d. None of the above

Show Answer ⟶
b. Tkinter library

Using Python Libraries Class 12 MCQ

5. ___________ library offers many functions and tools to produce quality output in variety of formats such as plots, charts, graphs etc.
a. NumPy library
b. SciPy library
c. Malpolotlib library 
d. None of the above

Show Answer ⟶
c. Malpolotlib library

6. The act of partitioning a program into individual components is called ___________.
a. Module 
b. String
c. Function
d. None of the above

Show Answer ⟶
a. Module

Using Python Libraries Class 12 MCQ

7. In Python you can create __________ module.
a. Your own module
b. Predefined module
c. Both a) and b) 
d. None of the above

Show Answer ⟶
c. Both a) and b)

8. ___________ command is used to import entire module.
a. <module> import
b. import <module> 
c. import <module> import
d. None of the above

Show Answer ⟶
b. import <module>

9. ___________ command is used to import selected objects from a module.
a. <module> import <module>
b. <module> import <object> 
c. import <module> import
d. None of the above

Show Answer ⟶
b. <module> import <object>

Using Python Libraries Class 12 MCQ

10. If in a module there is another import statement importing an already imported module then Python will ___________.
a. Ignore that import statement 
b. Rewrite that import statement
c. Both a) and b)
d. None of the above

Show Answer ⟶
a. Ignore that import statement

11. ___________ truncates the fractional part of given number and returns only the integer or whole part.
a. round(<number>)
b. number(<number>)
c. int(<number>) 
d. None of the above

Show Answer ⟶
c. int(<number>)

12. __________ function joins a string or character after each member of the string.
a. <str>.split(<string /char>)
b. <str>.join(<string iterable>) 
c. <str>.replace(<word to be replaced>, <replace word>)
d. None of the above

Show Answer ⟶
b. <str>.join(<string iterable>)

13. ___________ function splits a string on given string or character and returns a list containing split string as memeber.
a. <str>.split(<string /char>) 
b. <str>.join(<string iterable>)
c. <str>.replace(<word to be replaced>, <replace word>)
d. None of the above

Show Answer ⟶
a. <str>.split(<string /char>)

14. ___________ function replace a word or part of the string with another in the given string.
a. <str>.split(<string /char>)
b. <str>.join(<string iterable>)
c. <str>.replace(<word to be replaced>, <replace word>) 
d. None of the above

Show Answer ⟶
c. <str>.replace(<word to be replaced>, <replace word>)

Using Python Libraries Class 12 MCQ

15. Python has a module namely __________ that provided random number generator.
a. random()
b. randint(a,b)
c. Both a) and b) 
d. None of the above

Show Answer ⟶
c. Both a) and b)

16. The urllib module is a collection of sub-modules like _________.
a. Request
b. Error
c. Parse
d. All of the above 

Show Answer ⟶
d. All of the above

Computer Science Class 12 Notes

  1. Python Revision tour – 1 Class 12 Notes
  2. Python Revision tour – 2 Class 12 Notes Notes
  3. Working with Functions Class 12 Notes
  4. Using Python Libraries Class 12 Notes
  5. File Handling Class 12 Notes
  6. Recursion Class 12 Notes
  7. Idea of Algorithmic Efficiency Class 12 Notes
  8. Data Visualization using Pyplot Class 12 Notes
  9. Data Structure Class 12 Notes
  10. Computer Network Class 12 Notes
  11. More on MySQL Class 12 Notes

MCQ for Class 12 Computer Science Python

  1. Python Revision tour – 1 Class 12 MCQs
  2. Python Revision tour – 2 Class 12 MCQs
  3. Working with Functions Class 12 MCQs
  4. Using Python Libraries Class 12 MCQs
  5. File Handling Class 12 MCQs
  6. Recursion Class 12 MCQs
  7. Data Visualization using Pyplot Class 12 MCQs
  8. Data Structure Class 12 MCQs
  9. Computer Network Class 12 MCQs
  10. More on MySQL Class 12 MCQs

Computer Science Class 12 Questions and Answers

  1. Python Revision tour – 1 Class 12 Questions and Answers
  2. Working with Functions Class 12 Questions and Answers
  3. Using Python Libraries Class 12 Questions and Answers
  4. File Handling Class 12 Questions and Answers
  5. Recursion Class 12 Questions and Answers
  6. Idea of Algorithmic Efficiency Class 12 Questions and Answers
  7. Data Structure Class 12 Questions and Answers
  8. More on MySQL Class 12 Questions and Answers
  9. Computer Network Class 12 Questions and Answers
  10. More on MySQL Class 12 Questions and Answers 

Working with Functions in Python Class 12 MCQ

Teachers and Examiners (CBSESkillEduction) collaborated to create the Working with Functions in Python Class 12 MCQ. All the important Information are taken from the NCERT Textbook Computer Science (083) class 12.

Working with Functions in Python Class 12 MCQ

1. Which of the following is the use of function in python?
a) Functions are reusable pieces of programs 
b) Functions don’t provide better modularity for your application
c) you can’t also create your own functions
d) All of the mentioned

Show Answer ⟶
a) Functions are reusable pieces of programs

2. Which keyword is used for function?
a) Fun
b) Define
c) Def 
d) Function

Show Answer ⟶
c) Def

3. What will be the output of the following Python code?
def sayHello():
print(‘Hello World!’)
sayHello()
sayHello()

a. Hello World! 
Hello World!
b. Hello World!
c. Hello World!
Hello World!
Hello World!
d. None of the above

Show Answer ⟶
a. Hello World!
Hello World!

4. In programming, the use of ___________ is one of the means to achieve modularity and reusability.
a. String
b. If-Statement
c. Lists
d. Function 

Show Answer ⟶
d. Function

Working with Functions in Python Class 12 MCQ

5. __________ can be defined as a named group of instructions that accomplish a specific task when it is invoked.
a. String
b. If-Statement
c. Lists
d. Function 

Show Answer ⟶
d. Function

6. What are the advantages of function?
a. Increases readability
b. Reduces code
c. Increases reusability
d. All of the above 

Show Answer ⟶
d. All of the above

7. __________ length as the same code is not required to be written at multiple places in a program. This also makes debugging easier.
a. Increases readability
b. Reduces code 
c. Increases reusability
d. All of the above

Show Answer ⟶
b. Reduces code

8. We can define our own functions while writing the program. Such functions are called __________.
a. User defined function 
b. Predefined function
c. Both a) and b)
d. None of the above

Show Answer ⟶
a. User defined function

9. A function defined to achieve some task as per the programmer’s requirement is called a ____________.
a. User defined function
b. Predefined function 
c. Both a) and b)
d. None of the above

Show Answer ⟶
b. Predefined function

Working with Functions in Python Class 12 MCQ

10. The items enclosed in “[ ]” are called ___________ and they are optional.
a. Function
b. Parameters 
c. Values
d. None of the above

Show Answer ⟶
b. Parameters

11. Function header always ends with a _________.
a. Colon (:) 
b. Semi-Colon (;)
c. Both a) and b)
d. None of the above

Show Answer ⟶
a. Colon (:)

12. Function name should be __________.
a. Unique 
b. Repeated
c. Only keyword name can be added
d. None of the above

Show Answer ⟶
a. Unique

13. The statements outside the function indentation are not considered as _____________.
a. Not a part of the function
b. Part of the function 
c. Some time it is part of function
d. None of the above

Show Answer ⟶
b. Part of the function

14. ____________ is a value passed to the function during the function call which is received in the corresponding parameter defined in the function header.
a. Parameters
b. Arguments 
c. Values
d. None of the above

Show Answer ⟶
b. Arguments

Working with Functions in Python Class 12 MCQ

15. We can use the _________ function to find the identity of the object that the argument and parameter are referring to.
a. identity()
b. id() 
c. ids()
d. None of the above

Show Answer ⟶
b. id()

16. A __________ is a value that is pre decided and assigned to the parameter when the function call does not have its corresponding argument.
a. Default Value 
b. Value
c. Null Value
d. None of the above

Show Answer ⟶
a. Default Value

17. In python ___________ should be in the same order as that of the arguments.
a. Values
b. Parameters 
c. Function name
d. None of the above

Show Answer ⟶
b. Parameters

18. In python,________ statement returns the values from the function.
a. Reverse
b. Return 
c. Back
d. None of the above

Show Answer ⟶
b. Return

19. In python, function can be defined as _________ ways.
a. No argument and no return value
b. Argument and with return value
c. Arguments and no return value
d. All of the above 

Show Answer ⟶
d. All of the above

Working with Functions in Python Class 12 MCQ

20. The Python interpreter starts executing the instructions in a program from the _________.
a. First Statement 
b. Second Statement
c. Third Statement
d. None of the above

Show Answer ⟶
a. First Statement

21. The translator executes the code one by one is known as __________.
a. Translator
b. Compiler
c. Interpreter 
d. None of the above

Show Answer ⟶
c. Interpreter

22. A variable defined inside a function cannot be accessed ________ it.
a. Outside 
b. Inside
c. Both a) and b)
d. None of the above

Show Answer ⟶
a. Outside

23. A variable that has global scope is known as a ___________.
a. Local variable
b. Global variable 
c. Define variable
d. None of the above

Show Answer ⟶
b. Global variable

24. A variable that has a local scope is known as a ________.
a. Local variable 
b. Global variable
c. Define variable
d. None of the above

Show Answer ⟶
a. Local variable

Working with Functions in Python Class 12 MCQ

25. In Python, a variable that is defined outside any function or any block is known as a ________.
a. Local variable
b. Global variable 
c. Define variable
d. None of the above

Show Answer ⟶
b. Global variable

26. Any change made to the global variable will impact ___________ in the program where that variable can be accessed.
a. Only one function
b. All the functions 
c. Only two functions
d. None of the above

Show Answer ⟶
b. All the functions

27. A variable that is defined inside any function or a block is known as a __________.
a. Local variable 
b. Global variable
c. Define variable
d. None of the above

Show Answer ⟶
a. Local variable

28. Any modification to a global variable is permanent and affects _________ where it is used.
a. Only one function
b. All the functions 
c. Only two functions
d. None of the above

Show Answer ⟶
b. All the functions

29. If a variable with the same name as the global variable is defined inside a function, then it is considered _________ to that function.
a. Local variable 
b. Global variable
c. Define variable
d. None of the above

Show Answer ⟶
a. Local variable

Working with Functions in Python Class 12 MCQ

30. For a complex problem, it may not be feasible to manage the code in one single file. Then, the program is divided into different parts under different levels, called ________.
a. Modules 
b. Code
c. Variable
d. None of the above

Show Answer ⟶
a. Modules

31. What is the extension of python?
a. .pyy
b. .py 
c. .pyh
d. None of the above

Show Answer ⟶
b. .py

32. What is the syntax of import statements in python?
a. import modulename1 [,modulename2, …] 
b. imp modulename1 [,modulename2, …]
c. Both a) and b)
d. None of the above

Show Answer ⟶
a. import modulename1 [,modulename2, …]

33. To call a function of a module, the function name should be preceded with the name of the module with a _______.
a. comma(,)
b. dot(.) 
c. Semicolon(;)
d. None of the above

Show Answer ⟶
b. dot(.)

34. _________ functions that are used for generating random numbers.
a. random.random()
b. random.randint()
c. random.randrange()
d. All of the above 

Show Answer ⟶
d. All of the above

Working with Functions in Python Class 12 MCQ

35. In programming, functions are used to achieve modularity and reusability.
a. Modularity
b. Reusability
c. Both a) and b) 
d. None of the above

Show Answer ⟶
c. Both a) and b)

36. Function can be defined as a named group of instructions that are executed when the function is invoked or called by its name.
a. Its name 
b. Other names
c. No name
d. All of the above

Show Answer ⟶
a. Its name

37. Programmers can write their own functions known as _________.
a. Pre defined function
b. User defined function
c. Both a) and b) 
d. None of the above

Show Answer ⟶
c. Both a) and b)

38. The Python interpreter has a number of functions built into it. These are the functions that are frequently used in a Python program. Such functions are known as _________.
a. built in program
b. built in function 
c. built in arguments
d. None of the above

Show Answer ⟶
b. built in function

39. An __________ is a value passed to the function during a function call which is received in a parameter defined in the function header.
a. Argument 
b. function
c. Both a) and b)
d. None of the above

Show Answer ⟶
a. Argument

Working with Functions in Python Class 12 MCQ

40. Python allows assigning a ________ to the parameter.
a. Predefined value
b. default value 
c. No value
d. None of the above

Show Answer ⟶
b. default value

41. A function returns value(s) to the calling function using ________.
a. Reverse statement
b. Return statement 
c. Both a) and b)
d. None of the above

Show Answer ⟶
b. Return statement

42. Multiple values in Python are returned through a _______.
a. String
b. Tuple 
c. Both a) and b)
d. None of the above

Show Answer ⟶
b. Tuple

43. The part of the program where a variable is accessible is defined as the _________.
a. Scope of the variable 
b. Scope of the function
c. Scope of the code
d. None of the above

Show Answer ⟶
a. Scope of the variable

44. A variable that is defined outside any particular function or block is known as a ___________. It can be accessed anywhere in the program.
a. Local variable
b. Global variable 
c. Define variable
d. None of the above

Show Answer ⟶
b. Global variable

Working with Functions in Python Class 12 MCQ

45. A variable that is defined inside any function or block is known as a __________. It can be accessed only in the function or block where it is defined. It exists only till the function executes or remains active.
a. Local variable 
b. Global variable
c. Define variable
d. None of the above

Show Answer ⟶
a. Local variable

46. A module can be imported in a program using ________ statement.
a. Insert
b. Invoke
c. Import 
d. All of the above

Show Answer ⟶
c. Import

Computer Science Class 12 Notes

  1. Python Revision tour – 1 Class 12 Notes
  2. Python Revision tour – 2 Class 12 Notes Notes
  3. Working with Functions Class 12 Notes
  4. Using Python Libraries Class 12 Notes
  5. File Handling Class 12 Notes
  6. Recursion Class 12 Notes
  7. Idea of Algorithmic Efficiency Class 12 Notes
  8. Data Visualization using Pyplot Class 12 Notes
  9. Data Structure Class 12 Notes
  10. Computer Network Class 12 Notes
  11. More on MySQL Class 12 Notes

MCQ for Class 12 Computer Science Python

  1. Python Revision tour – 1 Class 12 MCQs
  2. Python Revision tour – 2 Class 12 MCQs
  3. Working with Functions Class 12 MCQs
  4. Using Python Libraries Class 12 MCQs
  5. File Handling Class 12 MCQs
  6. Recursion Class 12 MCQs
  7. Data Visualization using Pyplot Class 12 MCQs
  8. Data Structure Class 12 MCQs
  9. Computer Network Class 12 MCQs
  10. More on MySQL Class 12 MCQs

Computer Science Class 12 Questions and Answers

  1. Python Revision tour – 1 Class 12 Questions and Answers
  2. Working with Functions Class 12 Questions and Answers
  3. Using Python Libraries Class 12 Questions and Answers
  4. File Handling Class 12 Questions and Answers
  5. Recursion Class 12 Questions and Answers
  6. Idea of Algorithmic Efficiency Class 12 Questions and Answers
  7. Data Structure Class 12 Questions and Answers
  8. More on MySQL Class 12 Questions and Answers
  9. Computer Network Class 12 Questions and Answers
  10. More on MySQL Class 12 Questions and Answers 

Working with Functions in Python Class 12 Solutions

Teachers and Examiners (CBSESkillEduction) collaborated to create the Working with Functions in Python Class 12 Solutions. All the important Information are taken from the NCERT Textbook Computer Science (083) class 12.

Working with Functions in Python Class 12 Solutions

1. What do you understand by local and global scope of variables? How can you access a global variable inside the function, if function has a variable with same name.
Answer – A global variable is a variable that is accessible globally. A local variable is one that is only accessible to the current scope, such as temporary variables used in a single function definition. A variable declared outside of the function or in global scope is known as global variable. This means, global variable can be accessed inside or outside of the function where as local variable can be used only inside of the function. We can access by declaring variable as global A.

2. What is the deference between local variable and a global variable?
Answer – Local variables have a scope that is limited to the function in which they are defined, whereas global variables have a scope that encompasses the entire programme.

3. Differentiate between the round() and floor() functions with the help of suitable example.
Answer – The function floor() is used to convert to the lowest lower whole number, whereas the function round() is used to convert a fractional number into a whole as the nearest next. For example, round (5.8) = 6, round (4.1) = 5, and floor (6.9) = 6, floor (5.01) = 5.

4. What is the difference between input() and raw_input()?
Answer – In Python, raw input() and input are two functions that can be used to read data or input from the user (). The outcomes can be kept in a variable. raw input(): This function returns a string after reading the command or input. Python types like list, tuple, int, etc. are returned by the input() function after reading the input.

5. What is a function?
Answer – A function in computer programming is a chunk of code with a name that carries out a particular activity. Usually, this entails receiving some input, processing it, and then producing an

6. Write and explain the types of functions supported by python.
Answer – In Python, there are two categories of functions: User-Defined Functions: The user can define these types of functions to carry out any particular task. Built-in Functions are pre-defined functions that are available in Python.

7. Write a Python function to calculate the factorial of a number (a non-negative integer). The function accepts the number as an argument.
Answer –
def factorial(n):
     if n == 0:
         return 1
     else:
         return n * factorial(n-1)
n=int(input(“Enter Number : “))
print(factorial(n))

8. Write a Python function to find the Max of two numbers.
Answer –
def myfunction( x, y ):
     if x > y:
         return x
         return y

print(myfunction(2, 5))

9. Write a program to create a function that takes two arguments, name and age, and print their value.
Answer –
def student(name, age):
     print(name, age)

student(“Amit”, 22)

Computer Science Class 12 Notes

  1. Python Revision tour – 1 Class 12 Notes
  2. Python Revision tour – 2 Class 12 Notes Notes
  3. Working with Functions Class 12 Notes
  4. Using Python Libraries Class 12 Notes
  5. File Handling Class 12 Notes
  6. Recursion Class 12 Notes
  7. Idea of Algorithmic Efficiency Class 12 Notes
  8. Data Visualization using Pyplot Class 12 Notes
  9. Data Structure Class 12 Notes
  10. Computer Network Class 12 Notes
  11. More on MySQL Class 12 Notes

MCQ for Class 12 Computer Science Python

  1. Python Revision tour – 1 Class 12 MCQs
  2. Python Revision tour – 2 Class 12 MCQs
  3. Working with Functions Class 12 MCQs
  4. Using Python Libraries Class 12 MCQs
  5. File Handling Class 12 MCQs
  6. Recursion Class 12 MCQs
  7. Data Visualization using Pyplot Class 12 MCQs
  8. Data Structure Class 12 MCQs
  9. Computer Network Class 12 MCQs
  10. More on MySQL Class 12 MCQs

Computer Science Class 12 Questions and Answers

  1. Python Revision tour – 1 Class 12 Questions and Answers
  2. Working with Functions Class 12 Questions and Answers
  3. Using Python Libraries Class 12 Questions and Answers
  4. File Handling Class 12 Questions and Answers
  5. Recursion Class 12 Questions and Answers
  6. Idea of Algorithmic Efficiency Class 12 Questions and Answers
  7. Data Structure Class 12 Questions and Answers
  8. More on MySQL Class 12 Questions and Answers
  9. Computer Network Class 12 Questions and Answers
  10. More on MySQL Class 12 Questions and Answers 

Python Revision Tour 2 Class 12 MCQ

Teachers and Examiners (CBSESkillEduction) collaborated to create the Python Revision Tour 2 Class 12 MCQ. All the important Information are taken from the NCERT Textbook Computer Science (083) class 12.

Python Revision Tour 2 Class 12 MCQ

1. _________ is a sequence which is made up of one or more UNICODE characters.
a. String 
b. Number
c. Float
d. Double

Show Answer ⟶
a. String

2. String can be a _________.
a. Letter
b. Digit
c. Whitespace & Symbol
d. All of the above 

Show Answer ⟶
d. All of the above

3. A string can be assign by enclosing ______ quote.
a. Single
b. Double
c. Triple
d. All of the above 

Show Answer ⟶
d. All of the above

4. Each individual character in a string can be accessed using a technique called _______.
a. Indexing 
b. Method
c. Storing
d. None of the above

Show Answer ⟶
a. Indexing

5. The index specifies the character to be accessed in the string and is written in square brackets _______.
a. ( )
b. [ ] 
c. { }
d. None of the above

Show Answer ⟶
b. [ ]

6. In the string, the index of the first character start from ______.
a. 0 
b. n-1
c. 1
d. None of the above

Show Answer ⟶
a. 0

7. In the string, the index of the last character ______.
a. 0
b. n-1 
c. 1
d. None of the above

Show Answer ⟶
b. n-1

8. If we give index value out of this range then we get an _______.
a. Run time Error
b. IndexError 
c. Syntax Error
d. None of the above

Show Answer ⟶
b. IndexError

9. What will be the output of the following python code
str1=”Welcome to my \n School”
print(str1)
a. Welcome to my
b. Welcome to my School
c. Welcome to my 
School
d. None of the above

Show Answer ⟶
c. Welcome to my

10. What will be the output of the following python code
str1=”Welcome to \
my School”
print(str1)
a. Welcome to my School 
b. Welcome to
my School
c. Welcome to \ my School
d. None of the above

Show Answer ⟶
a. Welcome to my School

11. A string is an _______ data type.
a. Mutable
b. Immutable t
c. Both a) and b)
d. None of the above

Show Answer ⟶
b. Immutable

12. Immutable data type means _________.
a. String can be changed after it has been created
b. String cannot be changed after it has been created 
c. Both a) and b)
d. None of the above

Show Answer ⟶
b. String cannot be changed after it has been created

13. Concatenate means ______.
a. to Join 
b. to Divide
c. to Split
d. None of the above

Show Answer ⟶
a. to Join

14. Python allows us to join two strings using concatenation operator _______.
a. + +
b. + –
c. + 
d. None of the above

Show Answer ⟶
c. +

15. Python allows us to repeat the given string using repetition operator which is denoted by symbol _________.
a. * 
b. &
c. #
d. $

Show Answer ⟶
a. *

16. It is possible to retrieve each individual character in a string using a method _________ .
a. Concatenation
b. Indexing 
c. Replication
d. All of the above

Show Answer ⟶
b. Indexing

17. We receive a ________ if we provide an index value that is outside of the range.
a. Syntax Error
b. Run time Error
c. Index Error 
d. None of the above

Show Answer ⟶
c. Index Error

18. Python has two membership operators _______ and ______.
a. In and Out
b. In and Not 
c. True and False
d. None of the above

Show Answer ⟶
b. In and Not

19. The _________ operator also takes two strings and returns True if the first string does not appear as a substring in the second string, otherwise returns False.
a. Not
b. Not to
c. Not in 
d. Not out

Show Answer ⟶
c. Not in

20. In Python, to access some part of a string or substring, we use a method called _______.
a. Joining
b. Slicing 
c. Accessing
d. None of the above

Show Answer ⟶
b. Slicing

21. The data type list is an ordered sequence which is ________ and made up of one or more elements.
a. Mutable 
b. Immutable
c. Both a) and b)
d. None of the above

Show Answer ⟶
a. Mutable

22. Which statement from the list below will be create a new list?
a. new_l = [1, 2, 3, 4]
b. new_l = list()
c. Both a) and b) 
d. None of the above

Show Answer ⟶
c. Both a) and b)

23. List can content __________.
a. Integer
b. Float
c. String & Tuple
d. All of the above 

Show Answer ⟶
d. All of the above

24. list are enclosed in square ________ and are separated by _________.
a. Brackets and comma 
b. Brackets and dot
c. Curli Brackets and dot
d. None of the above

Show Answer ⟶
a. Brackets and comma

25. List elements may be of the following data types.
a. Different data types 
b. Same data types
c. Both a) and b)
d. None of the above

Show Answer ⟶
a. Different data types

26. In Python, lists are mutable. It means that ________.
a. The contents of the list can be changed after it has been created 
b. The contents of the list can’t changed after it has been created
c. The list cannot store the number data type.
d. None of the above

Show Answer ⟶
a. The contents of the list can be changed after it has been created

27. What will be the output of the following python code
print(list(“Python”))
a. (‘P’, ‘y’, ‘t’, ‘h’, ‘o’, ‘n’)
b. [‘P’, ‘y’, ‘t’, ‘h’, ‘o’, ‘n’] 
c. (“P”, “y”, “t”, “h”, “o”, “n”)
d. [“P”, “y”, “t”, “h”, “o”, “n”]Show Answer ⟶

b. [‘P’, ‘y’, ‘t’, ‘h’, ‘o’, ‘n’]

28. The data type list allows manipulation of its contents through ________.
a. Concatenation
b. Repetition
c. Membership
d. All of the above 

Show Answer ⟶
d. All of the above

29. Python allows us to join two or more lists using __________ operator.
a. Concatenation 
b. Repetition
c. Membership
d. All of the above

Show Answer ⟶
a. Concatenation

30. What will be the output of the following python code
new_list = [‘P’,’y’,’t’,’h’,’o’,’n’]
print(len(new_list))
a. 6 
b. 7
c. 8
d. 9

Show Answer ⟶
a. 6

31. Example of concatenation operator _______.
a. –
b. + 
c. /
d. *

Show Answer ⟶
b. +

32. If we try to concatenate a list with elements of some other data type, _________ occurs.
a. Runtime Error
b. Type Error 
c. Result
d. None of the above

Show Answer ⟶
b. Type Error

33. Python allows us to replicate a list using repetition operator depicted by symbol _________.
a. –
b. +
c. /
d. * 

Show Answer ⟶
d. *

34. Like strings, the membership operators _________ checks if the element is present in the list and returns True, else returns False.
a. In 
b. Out
c. Listin
d. None of the above

Show Answer ⟶
a. In

35. We can access each element of the list or traverse a list using a _______.
a. For loop
b. While loop
c. Both a) and b) 
d. None of the above

Show Answer ⟶
c. Both a) and b)

36. _________ returns the length of the list passed as the argument.
a. len() 
b. length()
c. leth()
d. None of the above

Show Answer ⟶
a. len()

37. ________ creates an empty list if no argument is passed.
a. len()
b. list() 
c. append()
d. extend()

Show Answer ⟶
b. list()

38. ________ a single element passed as an argument at the end of the list.
a. append() 
b. extend()
c. insert()
d. None of the above

Show Answer ⟶
a. append()

39. Which of the following command is used to add an element in list?
a. new_list.add(5)
b. new_list.added(5)
c. new_list.append(5) 
d. All of the above

Show Answer ⟶
c. new_list.append(5)

40. _________ returns the number of times a given element appears in the list.
a. insert()
b. index()
c. count() 
d. None of the above

Show Answer ⟶
c. count()

41. A ________ is an ordered sequence of elements of different data types, such as integer, float, string or list.
a. Tuple 
b. Dictionaries
c. List
d. None of the above

Show Answer ⟶
a. Tuple

42. Elements of a tuple are enclosed in ________ and are separated by ________.
a. Parenthesis and commas 
b. Curly Brackets and commas
c. Both a) and b)
d. None of the above

Show Answer ⟶
a. Parenthesis and commas

43. In Tuple, If we assign the value without comma it is treated as ________.
a. Integer 
b. String
c. Decimal
d. None of the above

Show Answer ⟶
a. Integer

44. In Tuple, Sequence without parenthesis is treated as _________.
a. Tuple Error
b. Tuple by default 
c. Both a) and b)
d. None of the above

Show Answer ⟶
b. Tuple by default

45. Elements of a tuple can be accessed in the same way as a list or string using ________.
a. Indexing
b. Slicing
c. Both a) and b) 
d. None of the above

Show Answer ⟶
c. Both a) and b)

46. Tuple is __________ data types.
a. Immutable
b. Mutable
c. Both a) and b) 
d. None of the above

Show Answer ⟶
c. Both a) and b)

47. Immutable means __________.
a. Tuple cannot be changed after it has been created 
b. Tuple can be changed after it has been created
c. Both a) and b)
d. None of the above

Show Answer ⟶
a. Tuple cannot be changed after it has been created

48. Python allows us to join tuples using __________ operator.
a. Assignment
b. Concatenation 
c. Repetition
d. None of the above

Show Answer ⟶
b. Concatenation

49. ________ operator can also be used for extending an existing tuple.
a. Assignment
b. Concatenation 
c. Repetition
d. None of the above

Show Answer ⟶
b. Concatenation

51. Concatenation operator depicted by symbol ________.
a. –
b. *
c. + 
d. /

Show Answer ⟶
c. +

52. Repetition operation is depicted by the symbol ________.
a. –
b. * 
c. +
d. /

Show Answer ⟶
b. *

53. ______ operator help to repeat elements of a tuple.
a. Assignment
b. Concatenation
c. Repetition 
d. None of the above

Show Answer ⟶
c. Repetition

54. In python, the repetition operator requires the first operand to be a tuple and the second operand to be _________ only.
a. String
b. Decimal
c. Integer 
d. None of the above

Show Answer ⟶
c. Integer

55. The ________ operator checks if the element is present in the tuple.
a. In 
b. Not in
c. Out
d. Not Out

Show Answer ⟶
a. In

56. The ________ operator returns True if the element is not present in the tuple, else it returns False.
a. In
b. Not in 
c. Out
d. Not Out

Show Answer ⟶
b. Not in

57. _________ returns the length or the number of elements of the tuple.
a. tuple()
b. len() 
c. count()
d. index()

Show Answer ⟶
b. len()

58. ________ returns the number of times the given element appears in the tuple
a. tuple()
b. len()
c. count() 
d. index()

Show Answer ⟶
c. count()

59. _________ returns the index of the first occurrence of the element in the given tuple.
a. tuple()
b. len()
c. count()
d. index() 

Show Answer ⟶
d. index()

60. ________ returns minimum or smallest element of the tuple.
a max()
b. min() 
c. sum()
d. None of the above

Show Answer ⟶
b. min()

61. ________ returns maximum or largest element of the tuple.
a max() 
b. min()
c. sum()
d. None of the above

Show Answer ⟶
a max()

62. _________ returns sum of the element of the tuple.
a max()
b. min()
c. sum() 
d. None of the above

Show Answer ⟶
c. sum()

63. A tuple inside another tuple is called a _______.
a. Tuple Leader
b. Nested Tuple 
c. Inner Tuple
d. None of the above

Show Answer ⟶
b. Nested Tuple

64. In python, tuples values are enclosed in _______.
a. Curly brackets
b. Parenthesis 
c. Square brackets
d. None of the above

Show Answer ⟶
b. Parenthesis

65. What will be the output of the following code.
str = tuple(“Python”)
print(tuple)
a. [‘P’, ‘y’, ‘t’, ‘h’, ‘o’, ‘n’]
b. (‘P’, ‘y’, ‘t’, ‘h’, ‘o’, ‘n’) 
c. Python
d. None of the above

Show Answer ⟶
b. (‘P’, ‘y’, ‘t’, ‘h’, ‘o’, ‘n’)

66. Which of the following is not a function of tuple?
a. sum()
b. max()
c. min()
d. delete() 

Show Answer ⟶
d. delete()

67. Which of the following belong to tuple?
a. Elements are enclosed in Parenthesis
b. Tuple is immutable
c. Tuple is a sequence data types
d. All of the above 

Show Answer ⟶
d. All of the above

68. Which of the following is the correct syntax to declare tuple?
a. t = 1,2,3
b. t = (‘a’,’b’,’c’)
c. t = (1,2,3)
d. All of the above 

Show Answer ⟶
d. All of the above

69. How you can delete tuple with single element?
a. t = 1,
b. t = (1,)
c. Both a) and b) 
d. t = [1]Show Answer ⟶

c. Both a) and b)

70. What will be the output of the following code.
t = (30)
type(t)
a. <class ‘float’>
b. <class ‘string’>
c. <class ‘int’> 
d. None of the above

Show Answer ⟶
c. <class ‘int’>

71. What will be the output of the following code.
t1 = (‘Computer’, ‘Science’)
t2 = (85, 65)
print(t1+t2)
a. (‘Computer’, ‘Science’, 85, 65) 
b. [‘Computer’, ‘Science’, 85, 65]
c. {‘Computer’, ‘Science’, 85, 65}
d. None of the above

Show Answer ⟶
a. (‘Computer’, ‘Science’, 85, 65)

72. Which of the following operator is used to replicate a tuple?
a. Modular
b. Exponent
c. Addition
d. Multiplication 

Show Answer ⟶
d. Multiplication

73. What will be the output of the following code.
t = (‘1’, ‘2’, ‘3’)
print(tuple(“Python”) + t)
a. [‘P’, ‘y’, ‘t’, ‘h’, ‘o’, ‘n’, ‘1’, ‘2’, ‘3’]
b. (‘P’, ‘y’, ‘t’, ‘h’, ‘o’, ‘n’, ‘1’, ‘2’, ‘3’) 
c. {‘P’, ‘y’, ‘t’, ‘h’, ‘o’, ‘n’, ‘1’, ‘2’, ‘3’}
d. None of the above

Show Answer ⟶
b. (‘P’, ‘y’, ‘t’, ‘h’, ‘o’, ‘n’, ‘1’, ‘2’, ‘3’)

74. Which of the following python function returns the length of tuple?
a. len() 
b. length()
c. leng()
d. None of the above

Show Answer ⟶
a. len()

Computer Science Class 12 Notes

  1. Python Revision tour – 1 Class 12 Notes
  2. Python Revision tour – 2 Class 12 Notes Notes
  3. Working with Functions Class 12 Notes
  4. Using Python Libraries Class 12 Notes
  5. File Handling Class 12 Notes
  6. Recursion Class 12 Notes
  7. Idea of Algorithmic Efficiency Class 12 Notes
  8. Data Visualization using Pyplot Class 12 Notes
  9. Data Structure Class 12 Notes
  10. Computer Network Class 12 Notes
  11. More on MySQL Class 12 Notes

MCQ for Class 12 Computer Science Python

  1. Python Revision tour – 1 Class 12 MCQs
  2. Python Revision tour – 2 Class 12 MCQs
  3. Working with Functions Class 12 MCQs
  4. Using Python Libraries Class 12 MCQs
  5. File Handling Class 12 MCQs
  6. Recursion Class 12 MCQs
  7. Data Visualization using Pyplot Class 12 MCQs
  8. Data Structure Class 12 MCQs
  9. Computer Network Class 12 MCQs
  10. More on MySQL Class 12 MCQs

Computer Science Class 12 Questions and Answers

  1. Python Revision tour – 1 Class 12 Questions and Answers
  2. Working with Functions Class 12 Questions and Answers
  3. Using Python Libraries Class 12 Questions and Answers
  4. File Handling Class 12 Questions and Answers
  5. Recursion Class 12 Questions and Answers
  6. Idea of Algorithmic Efficiency Class 12 Questions and Answers
  7. Data Structure Class 12 Questions and Answers
  8. More on MySQL Class 12 Questions and Answers
  9. Computer Network Class 12 Questions and Answers
  10. More on MySQL Class 12 Questions and Answers 
error: Content is protected !!