MCQ for Class 12 Computer Science Python

mcq for class 12 computer science python

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

MCQ for Class 12 Computer Science Python

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 

Computer Science Class 12 Notes

computer science class 12 notes

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

Computer Science Class 12 Notes

Unit I: Computational Thinking and Programming – 2

  • Revision of Python topics covered in Class XI.
  • Functions: types of function (built-in functions, functions defined in module, user defined
    functions), creating user defined function, arguments and parameters, default parameters,
    positional parameters, function returning value(s), flow of execution, scope of a variable (global
    scope, local scope)
  • Introduction to files, types of files (Text file, Binary file, CSV file), relative and absolute paths
  • Text file: opening a text file, text file open modes (r, r+, w, w+, a, a+), closing a text file, opening a
    file using with clause, writing/appending data to a text file using write() and writelines(), reading
    from a text file using read(), readline() and readlines(), seek and tell methods, manipulation of data
    in a text file
  • Binary file: basic operations on a binary file: open using file open modes (rb, rb+, wb, wb+, ab, ab+),
    close a binary file, import pickle module, dump() and load() method, read, write/create, search,
    append and update operations in a binary file
  • CSV file: import csv module, open / close csv file, write into a csv file using csv.writer() and read
    from a csv file using csv.reader( )
  • Data Structure: Stack, operations on stack (push & pop), implementation of stack using list.

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

Computer Science Class 12 MCQ

  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

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

Unit II: Computer Networks (Computer Science Class 12 Notes)

  • Evolution of networking: introduction to computer networks, evolution of networking (ARPANET,
    NSFNET, INTERNET)
  • Data communication terminologies: concept of communication, components of data
    communication (sender,receiver, message, communication media, protocols), measuring capacity
    of communication media (bandwidth, data transfer rate), IP address, switching techniques (Circuit
    switching, Packet switching)
  • Transmission media: Wired communication media (Twisted pair cable, Co-axial cable, Fiber-optic
    cable), Wireless media (Radio waves, Micro waves, Infrared waves)
  • Network devices (Modem, Ethernet card, RJ45, Repeater, Hub, Switch, Router, Gateway, WIFI
    card)
  • Network topologies and Network types: types of networks (PAN, LAN, MAN, WAN), networking
    topologies (Bus, Star, Tree)
  • Network protocol: HTTP, FTP, PPP, SMTP, TCP/IP, POP3, HTTPS, TELNET, VoIP
  • Introduction to web services: WWW, Hyper Text Markup Language (HTML), Extensible Markup
    Language (XML), domain names, URL, website, web browser, web servers, web hosting
  1. Computer Network Class 12 Notes
  2. Computer Network Class 12 MCQs
  3. Computer Network Class 12 Questions and Answers

Unit III: Database Management

  • Database concepts: introduction to database concepts and its need
  • Relational data model: relation, attribute, tuple, domain, degree, cardinality, keys (candidate key,
    primary key, alternate key, foreign key)
  • Structured Query Language: introduction, Data Definition Language and Data Manipulation
    Language, data type (char(n), varchar(n), int, float, date), constraints (not null, unique, primary
    key), create database, use database, show databases, drop database, show tables, create table,
    describe table, alter table (add and remove an attribute, add and remove primary key), drop table,
    insert, delete, select, operators (mathematical, relational and logical), aliasing, distinct clause,
    where clause, in, between, order by, meaning of null, is null, is not null, like, update command,
    delete command, aggregate functions (max, min, avg, sum, count), group by, having clause, joins:
    cartesian product on two tables, equi-join and natural join
  • Interface of python with an SQL database: connecting SQL with Python, performing insert, update,
    delete queries using cursor, display data by using fetchone(), fetchall(), rowcount, creating
    database connectivity applications
  1. More on MySQL Class 12 Notes
  2. More on MySQL Class 12 MCQs
  3. More on MySQL Class 12 Questions and Answers 

Data Structure Questions and Answers

data structure questions and answers

Teachers and Examiners (CBSESkillEduction) collaborated to create the Data Structure Questions and Answers. Al the important Information are taken from the NCERT Textbook Data Structure.

Data Structure Questions and Answers

1. What is a Data Strucuture?
Answer – A data structure is a specific type of format used to arrange, process, retrieve, and store data. There are a number of fundamental and sophisticated forms of data structures, all of which are made to organise data for a particular use. Users may easily get the data they require and use it in the proper ways thanks to data structures.

2. Why we are using Data Structures?
Answer – Users find it simple to access the data they need and use it appropriately thanks to data structures. The organising of information is framed by data structures in a way that both machines and people can better grasp.

Data Structure Questions and Answers

3. Compare a data type with a Data Strucutre.
Answer – A data type is one of the variations of a variable to which only values of that kind may be assigned. The programme can utilise this value at any time. A collection of data of several data kinds is referred to as a data structure. This data set can be used throughout the application and represented using an object.

4. What are some applications of Data structures?
Answer – Core operating system (OS) resources and operations are made possible through the usage of data structures, such as linked lists for memory allocation, file directory management and file structure trees, as well as queues for process scheduling.

Data Structure Questions and Answers

5. What is linear and non-linear data structure?
Answer – Data items are arranged in a linear order and connected to their previous and next neighbouring pieces in a linear data structure. Data elements are attached hierarchically in a non-linear data structure.

6. Describe the types of Data Structures?
Answer – A data structure is a specific type of format used to arrange, process, retrieve, and store data. There are a number of fundamental and sophisticated forms of data structures, all of which are made to organise data for a particular use. Users may easily get the data they require and use it in the proper ways thanks to data structures. There are generally four types of data structures to consider: arrays, lists: linear. Binary, heaps, space division, etc. are all examples of a tree.

Data Structure Questions and Answers

7. What common operations are performed on different Data Structures?
Answer – Some of the commonly performed operations on data strucutures are
a. Insertion – To add a new data item in the given collection of data items.
b. Deletion – To delete an existing data item from the given collection of data items.
c. Raversal – To access each data item exactly once so that it can be processed.
d. Searching – To find out the location of the data item if it exists in the given collection of data items.
e. Sorting – To arrange the data items in some order i.e. in ascending or descending order in case of numerical data and in dictionary oreder in case of alphanumeric data.

8. Differentiate between stack and queue data structure.
Answer – The main distinction between stack and queue data structures is that while queue uses a FIFO data structure type, stack uses LIFO. Last In First Out is referred to as LIFO. It implies that the last element is processed first when data is added to a stack. On the other hand, FIFO stands for First In First Out.

Data Structure Questions and Answers

9. What purpose Linear lists data structre are mostly used for?
Answer – It is a kind of data structure where information is managed and stored in an uniform manner. Each data element in the series is linked to the one before it. Since the data is arranged progressively, it is simple to implement the linear structure in a computer’s memory.

10. What is a list comprehension? How is it useful?
Answer – List comprehensions are helpful and can assist you in writing elegant code that is simple to read and debug, but they are not always the best option. They might increase memory use or slow down the performance of your code.

Data Structure Questions and Answers

11. What is a linked list data structure? What are the applications for the Linked list?
Answer – When it comes to managing dynamic data items, a linked list is the most desired data structure. A node is a type of data element found in linked lists. Additionally, each node has two fields: one field contains data, and the other field contains an address that maintains a link to the node after it.

12. What is the difference between a regular 2D list and a ragged List?
Answer – A list with entries that are lists of the same shape is referred to as a normal two-dimensional list. A ragged list is made up of lists with various shapes as its constituent parts.

Data Structure Questions and Answers

13. Difference between Array and Linked List.
Answer – An array is a grouping of objects with related data types. A linked list is an ordered grouping of identically typed elements where each element is linked to the following one via pointers. The array index can be used to randomly access array elements.

14. What is a stack? What basic operations can be performed on them?
Answer – A stack is an abstract data type used in computer science that acts as a collection of components and has two primary operations: Push, which includes an element in the collection, and. Pop, which eliminates the most recent ingredient to be added that has not yet been eliminated.

Data Structure Questions and Answers

15. Enlist some applications of stacks.
Answer – Some of the application of stacks are –
a. The evaluation of expressions with operands and operators can be done using a stack.
b. Stacks can be used for backtracking, or to verify if an expression’s parenthesis match.
c. It can also be used to change the expression from one form to another.
d. It can be applied to formally manage memories.

16. What are queues? What all operations can be performed on queues?
Answer – An object called a queue is used to control the sorted arrangement of various data kinds. Various queue actions, including Enqueue(), Dequeue(), isFull(), isNull(), and Peek().

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. Computer Network Class 12 Questions and Answers
  9. More on MySQL Class 12 Questions and Answers 

Data Structure MCQ With Answer

data structure mcq

Teachers and Examiners (CBSESkillEduction) collaborated to create the Data Structure MCQ. Al the important Information are taken from the NCERT Textbook Data Structure.

Data Structure MCQ With Answer

1. The computer system is used essentially as data manipulation system where __________ are very important things for it.
a. Data 
b. Data Strucutre
c. Program
d. None of the above

Show Answer ⟶
a. Data

2. Representation of data can be in forms of _________.
a. Raw data
b. Data item
c. Data structures
d. All of the above 

Show Answer ⟶
d. All of the above

3. Which of the following algorithms is used to solve problems involving pattern and string matching?
a. Robin Karp Algorithm
b. Z Algorithm
c. KMP Algorihtm
d. All of the above 

Show Answer ⟶
d. All of the above

4. A __________ is a physical implementation that clearly defiens a way of storing, accessing, manipulating data stored in a data strucutre.
a. Data Structure 
b. Data Program
c. Data Storage
d. None of the above

Show Answer ⟶
a. Data Structure

Data Structure MCQ With Answer

5. Which of the following algorithms uses a Divide and Conquer algorithm?
a. Merge Sort 
b. Bubble Sort
c. Quick Sort
d. None of the above

Show Answer ⟶
a. Merge Sort

6. ___________ data strucutres are normally built from primitive data types like integers, reals, characters, boolean.
a. Simple Data Strucutre 
b. Compound Data Strucutre
c. Both a) and b)
d. None of the above

Show Answer ⟶
a. Simple Data Strucutre

7. Simple data structures can be combined in various ways to form more complex strucutes called ____________.
a. Simple Data Strucutre
b. Compound Data Strucutre 
c. Both a) and b)
d. None of the above

Show Answer ⟶
b. Compound Data Strucutre

8. Example of Linear data structrues are _____________.
a. Stack
b. Queue
c. Linked List
d. All of the above 

Show Answer ⟶
d. All of the above

9. Example of Non-linear data strucutre are _________.
a. Stack & Queue
b. Linked List
c. Tree 
d. All of the above

Show Answer ⟶
c. Tree

Data Structure MCQ With Answer

10. _________ refer to a named list of a finite number n of similar data elements.
a. Linear List
b. Arrays
c. Both a) and b) 
d. None of the above

Show Answer ⟶
c. Both a) and b)

11. Arrays can be ___________.
a. One dimensional
b. Two dimensional
c. Multi dimensional
d. All of the above 

Show Answer ⟶
d. All of the above

12. _________ data strucutres refer to the lists stored and accessed in a special way, Where LIFO (Last in first out) technique is followed.
a. Stacks 
b. Queue
c. Linked List
d. None of the above

Show Answer ⟶
a. Stacks

13. __________ data strucutres are FIFO (First in First out) lists, where insertions take place at the “rear” end of the queues and deletions take palce at the “front” end of the queues.
a. Stacks
b. Queue 
c. Linked List
d. None of the above

Show Answer ⟶
b. Queue

14. _________ lists are special lists of some data elements linked to one another. The logical ordering is represented by having each element pointing to the next element.
a. Stacks
b. Queue
c. Linked List 
d. None of the above

Show Answer ⟶
c. Linked List

Data Structure MCQ With Answer

15. Trees are multilevel data strucutre having a hierarchical relationship among its elements called ________.
a. Node 
b. Reference
c. Link
d. None of the above

Show Answer ⟶
a. Node

16. Which one of the following is not a type of queue?
a. Single – ended queue 
b. Circular queue
c. Priority queue
d. Ordinary queue

Show Answer ⟶
a. Single – ended queue

17. Which of the following does not represent a data structure operation?
a. Operations that manipulate data in some way 
b. Operations that perform a computation
c. Operations that monitor an object for the occurrence of a controlling event
d. Operations that check for syntax errors

Show Answer ⟶
a. Operations that manipulate data in some way

18. What are the basic operations that are performed on data structures _________.
a. Insertion
b. Deletion
c. Searching
d. All of the above 

Show Answer ⟶
d. All of the above

19. When elements of linear strucutes are homogeneous and are represented in memory by means of sequentional momoey location, these linear strucures are called _________.
a. String
b. Arrays 
c. List
d. None of the above

Show Answer ⟶
b. Arrays

Data Structure MCQ With Answer

20. What data structure is necessary to change infix notation into prefix notation?
a. Stack 
b. Linked list
c. Binary tree
d. Queue

Show Answer ⟶
a. Stack

21. If the stack is implemented using a linked list, which of the following nodes is considered as the top of the stack?
a. First node 
b. Second node
c. Last node
d. None of the above

Show Answer ⟶
a. First node

22. Linear List or Arrarys are one of the simplest data strucures and are very easy to _________.
a. Traverse
b. Search
c. Sort
d. All of the above 

Show Answer ⟶
d. All of the above

23. What are the different searching algorithms in Data structre.
a. Linear Search
b. Binary Search
c. Both a) and b) 
d. None of the above

Show Answer ⟶
c. Both a) and b)

24. In the ________ search, each element of the array list is compared with the given item to be searched for, One by One.
a. Linear search
b. Sequential search
c. Both a) and b) 
d. None of the above

Show Answer ⟶
c. Both a) and b)

Data Structure MCQ With Answer

25. In _________ search, the ITEM is searched for in smaller segment (nearly half the previous segment) after every stage.
a. Linear serach
b. Sequential search
c. Binary serach 
d. None of the above

Show Answer ⟶
c. Binary serach

26. The __________ refers to arranging elements of a list in ascending or descending order.
a. Order wise
b. Sorting 
c. Algorithms
d. None of the above

Show Answer ⟶
b. Sorting

27. What are the advantages of list comprehensions in Python.
a. Code reduction
b. Faster code processing
c. Both a) and b) 
d. None of the above

Show Answer ⟶
c. Both a) and b)

28. What is the maximum number of swaps that can be performed in the Selection Sort algroithm?
a. n – 2
b. n
c. n + 2
d. n – 1 

Show Answer ⟶
d. n – 1

29. The condition is known as___ if the stack has a size of 10 and we attempt to add the 11th element to it.
a. Underflow
b. Garbage collection
c. Overflow 
d. None of the above

Show Answer ⟶
c. Overflow

Data Structure MCQ With Answer

30. Which data structure is mostly used in the recursive algorithm’s implementation?
a. Queue
b. Stack 
c. Binary tree
d. Linked list

Show Answer ⟶
b. Stack

31. What data structures from the list below can be utilised to implement queues?
a. Stack
b. Linked List
c. Arrays
d. All of the above 

Show Answer ⟶
d. All of the above

32. What do you mean by code reduction.
a. A code of 3 or more lines gets reduced to a single line of code 
b. A code of 3 or more lines converted into a multiple lines
c. Both a) and b)
d. None of the above

Show Answer ⟶
a. A code of 3 or more lines gets reduced to a single line of code

33. If you want to create 2D list by inputting element by element, you can employ a ____________ loop.
a. Single loop
b. Nested loop 
c. Both a) and b)
d. None of the above

Show Answer ⟶
b. Nested loop

34. Which of the following sorting algorithms, in the worst-case situation, offers the best temporal complexity?
a. Quick Sort
b. Bubble Sort
c. Merge Sort 
d. None of the above

Show Answer ⟶
c. Merge Sort

Data Structure MCQ With Answer

35. A ____________ is a named group of data of different data types which can be processed as a single unit.
a. Data Type
b. Data Strucutre 
c. Data Item
d. None of the above

Show Answer ⟶
b. Data Strucutre

36. ________ data sturctre are normally built from primitive data types.
a. Simple 
b. Compound
c. Both a) and b)
d. None of the above

Show Answer ⟶
a. Simple

37. When an empty queue receives a pop() request. What is the name of the condition?
a. Underflow 
b. Overflow
c. Peek
d. None of the above

Show Answer ⟶
a. Underflow

38. ___________ data structure may be linear and no-linear.
a. Simple
b. Compound 
c. Both a) and b)
d. None of the above

Show Answer ⟶
b. Compound

39. What data structure from the list below is used in recursion?
a. Stack 
b. Linked List
c. Arrays
d. Queues

Show Answer ⟶
a. Stack

Data Structure MCQ With Answer

40. Which of the following data structures allows for both end-to-end insertion and deletion?
a. Stack
b. Queue
c. Deque 
d. None of the above

Show Answer ⟶
c. Deque

41. In an n-ary tree, how many kids can a node have at once?
a. Infinite node 
b. 3
c. 2
d. 0

Show Answer ⟶
a. Infinite node

42. A __________ referes to a named list of a finite number n of similar data elements whereas a structure refers to a named collection of variables of different data types.
a. Linear List
b. Arrays
c. Both a) and b) 
d. None of the above

Show Answer ⟶
c. Both a) and b)

43. Stacks are __________ lists where insertions and deletions take place only at one end.
a. LIFO (Last in First Out) 
b. FIFO (First in First Out)
c. Both a) and b)
d. None of the above

Show Answer ⟶
a. LIFO (Last in First Out)

44. What are the drawbacks of the array data structure?
a. Elements of an array can be sorted
b. Easier to access the elements in an array
c. Elements of mixed data tyeps can be stored
d. Index of the first element starts from 0

Show Answer ⟶
c. Elements of mixed data tyeps can be stored

Data Structure MCQ With Answer

45. Queues are __________ lists where insertions take place at “rear” end and deletions take place at the “front” end.
a. LIFO (Last in First Out)
b. FIFO (First in First Out) 
c. Both a) and b)
d. None of the above

Show Answer ⟶
b. FIFO (First in First Out)

46. In __________, each element of the array is compared with the given item to be searched for, one by one.
a. Linear search 
b. Binary search
c. Both a) and b)
d. None of the above

Show Answer ⟶
a. Linear search

47. A ___________ is a concise description of a list that shorthands the list creating for loop in the form of a single statement.
a. List Comprehension 
b. Queues Comprehension
c. Both a) and b)
d. None of the above

Show Answer ⟶
a. List Comprehension

48. What type of data is required to be stored by a LinkedList’s Node?
a. The value of the current node
b. The address of the next node
c. Both a) and b) 
d. None of the above

Show Answer ⟶
c. Both a) and b)

49. Stack is a list of data that follows ___________ rules.
a. Data can only be removed from the top
b. A new data element can only be added to the top of the stack.
c. Both a) and b) 
d. None of the above

Show Answer ⟶
c. Both a) and b)

Data Structure MCQ With Answer

50. How is a string stored in memory?
a. The Object of some class
b. An array of characters 
c. Same as other primitive data types
d. LinkedList of charcaters.

Show Answer ⟶
b. An array of characters

51. _________ refers to inspecting the value at the stack’s top without removing it. It is also sometimes referred as inspection.
a. Peek 
b. Overflow
c. Underflow
d. None of the above

Show Answer ⟶
a. Peek

52. What is the binary search algorithm’s time complexity?
a. O(n^2)
b. O(n)
c. O(1)
d. O(log2n) 

Show Answer ⟶
d. O(log2n)

53. ________ refers to situation (ERROR) when one tries to push an item in stack that is full.
a. Peek
b. Overflow 
c. Underflow
d. None of the above

Show Answer ⟶
b. Overflow

54. What are the disadvantages of the array data structure?
a. Elements of an array can be accessed in constant time
b. The amount of memory to be allocated should be known beforehand
c. Multiple other data strucutre can be implementd using arrays.
d. Elements are stored in contiguous memory blocks

Show Answer ⟶
b. The amount of memory to be allocated should be known beforehand

Data Structure MCQ With Answer

55. _________ refers to situation (ERROR) when one tries to pop/delete an item from an empty stack.
a. Peek
b. Overflow
c. Underflow 
d. None of the above

Show Answer ⟶
c. Underflow

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 

MCQ on Data Visualization in Python Class 12

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

MCQ on Data Visualization in Python Class 12

1. _________ basically refers to the graphical or visual representation of information and data using visual elements like chart, graphs, and maps etc.
a. Data Visualization
b. Matplotlib
c. PyPlot
d. None of the above

Show Answer ⟶
a. Data Visualization

2. _________ is a Python library that provided many interfaces and functionality for 2D-graphics.
a. Data Visualization
b. Matplotlib
c. PyPlot
d. None of the above

Show Answer ⟶
b. Matplotlib

3. __________ is a collection of mathods within matplotlib which allow user to construct 2D plots easily and interactively.
a. Data Visualization
b. Matplotlib
c. PyPlot
d. None of the above

Show Answer ⟶
c. PyPlot

4. In order to use PyPlot on your computers for data visulization, you need to first import it in your Python environment by issuing _________ command for matplotlib pyplot.
a. Insert
b. Import
c. Retrive
d. None of the above

Show Answer ⟶
b. Import

5. _________ is a Python library that offer many functions for creating and manipulating arrays, which come handy while plotting.
a. NumPy
b. Matplotlib
c. PyPlot
d. None of the above

Show Answer ⟶
a. NumPy

6. NumPy arrary are also called ________.
a. MatArrarys
b. NdArrays
c. NumPyArrays
d. None of the above

Show Answer ⟶
b. NdArrays

7. Which type of chart are available in data visulization.
a. Line chart
b. bar chart
c. Pie chart & Scatter chart
d. All of the above

Show Answer ⟶
d. All of the above

8. ________ is a type of chart which displays information as a series of data points called ‘markers’ connected by straight line segments.
a. Line chart
b. Line graph
c. Both a) and b)
d. None of the above

Show Answer ⟶
c. Both a) and b)

9. You can create line charts by using PyPlot’s _______ fucntion
a. Myplot()
b. Plot()
c. Both a) and b)
d. None of the above

Show Answer ⟶
b. Plot()

10. You can change line color, width, line-style, marker-type using ________ function.
a. Myplot()
b. Plot()
c. Both a) and b)
d. None of the above

Show Answer ⟶
b. Plot()

11. A _________ is a graphical display of data using bars of different heights.
a. Bar Graph or Bar Chart
b. Line Chart
c. Pie Chart
d. None of the above

Show Answer ⟶
a. Bar Graph or Bar Chart

12. You can create a bar chart using pyplot’s ________ function.
a. pie()
b. bar()
c. line()
d. None of the above

Show Answer ⟶
b. bar()

13. You can change colors of the bars, widths of the bars in ________ function.
a. bar()
b. pie()
c. line()
d. None of the above

Show Answer ⟶
a. bar()

14. The _________ is a type of graph in which a circle is diveded into sectors that each represent a proporation of the whole.
a. Pie chart
b. Bar chart
c. Line chart
d. None of the above

Show Answer ⟶
a. Pie chart

15. By default, the pie chart is _________ in shaper but you can change to circular shaper by giving command.
a. Oval
b. Square
c. Circle
d. All of the above

Show Answer ⟶
a. Oval

16. The axes can be labelled using _________ and _________ function.
a. xlabel() and ylabel()
b. labelx() and labely()
c. Both a) and b)
d. None of the above

Show Answer ⟶
a. xlabel() and ylabel()

17. The tick marks for axes values can be defined using _______ and ________ functions.
a. ticks() and ticks()
b. xticks() and yticks()
c. ticksx() and ticksy()
d. None of the above

Show Answer ⟶
b. xticks() and yticks()

18. Using __________ function, one can add legends to a plot where multiple data ranges have been plotted, but before that the data ranges must have their label argument defined in plot() or bar() function.
a. legend()
b. legends()
c. leg()
d. None of the above

Show Answer ⟶
a. legend()

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 

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 
error: Content is protected !!