Home   »   CBSE Class 12 Computer Science MCQ
Top Performing

CBSE Class 12 Computer Science MCQ Questions and Answers

Class 12 Computer Science MCQ

 

The Central Board of Secondary Education is going to conduct the Class 12th Computer Science Examination . On this page, we have provided Class 12th Computer Science MCQs so that students can practice these questions and pass the class 12th examination with flying colors. This year, the CBSE has changed the exam pattern, the questions will be of objective type questions, so here we have given important objective type questions for the practice of students appearing for the Computer Science Term 1 examination. In this article, we have covered topics like python, data file handling, etc. The students are advised to go through the entire article, we have covered the important questions which can be asked in the main examination. Ignoring any question can lead to a loss of marks.

 

Class 12th Computer Science MCQ Important Questions with Answers

Read all the Class 12th Computer Science MCQs is given below: 

  1. Python identifiers are case-sensitive.

a)True

b) False

c) Depends on Program

d) Depends on the computer system

Answer: True

 

  1. Arrange the following file handling operations in proper order:

A) Close the file

B) Perform operations on file

C) Opening the file

 

a) C – B – A

b) A – B – C

c) A – C – B

d) C – B – A

Ans. d) C – B – A

 

  1. The pickle.load() function requires minimum _____ number of parameters

a) 0

b) 1

c) 2

d) 3

Ans. b) 1

 

  1. Which of the following function is used to write steam data from python console to binary file?

a) load()

b) dumps()

c) dump()

d) write()

 

Ans. c) dump

 

  1. User need to call load() each time dump() is called.

a) Yes, it must be

b) No, Not necessarily

c) Depends on the file operations

d) All of the above

 

Ans. a) Yes, It must be

 

  1. The dump method requires _________ minimum no of parameters

a) 1

b) 2

c) 0

d) None of these

 

Ans. b) 2

 

  1. Pickling refers to

a) converting the structure to a byte stream before working to the file

b) converting the structure to a file in unicode

c) converting the structure to a file in text file

d) converting the structure to a csv filve

 

Ans. a) converting the strucgture to a byte stream before working to the file

 

  1. Select the correct statements for sys.stderr:

i) It is used to provide error messages.

ii) It is similar as sys.stdout

iii) It does not print only exceptions but prints error messages with debugging comments

iv) Can be linked to the standard input of another program with a pipe symbol

a) ii, iii and iv

b) i, ii and iv

c) i and iv only

d) i, ii and iii

 

Ans. d) i, ii and iii

 

  1. Statement A: Data written to sys.stdout appears on screen.

Statement B: Data are written to sys.stdout can be linked to the standard input of another program with a pipe.

a) Statement A is True

b) Statement B is False

c) Statement B is True

d) Both statements A and B are True

 

Ans. d) Both statements A and B are True

 

  1. Mr. Alpesh wants to know the standard stream which reads the standard input in python. Select the correct stream from the following:

a) sys.stdin

b) sys.stdinput

c) sys.input

d) sys.standardin

 

Ans. a) sys.stdin

 

  1. Using with ensures that

i) all the resources allocated the file objects get deallocated automatically when the user stops using the file

ii) all files will be closed by itself

iii) do not require to close the file in case of exception as well

iv) it makes code more compact and readable

a) i, ii and iii

b) i, iii and iv

c) ii, ii and iv

d) ii, iii and iv

 

Ans.d)i, ii, iii and iv

 

  1. Python will raise error FileNotFounderror, if

a) the file is empty

b) the file is created but not in use

c) the file doesn’t exist

d) the file is opened in read mode

 

Ans. c) the file doesn’t exist

 

  1. To write data into CSV from python console, which of the following function is correct?

a) csv.write(file)

b) csv.writer(file)

c) csv.Write(file)

d) csv.writerow()

 

Ans. b) csv.writer(file)

 

  1. The write() function actually

a) writes into permanent location to the file

b) write into the buffer

c) write into the library

d) write into the program

 

Ans. b) write into buffer

 

  1. The ________ mode allows adding data into the existing file at the end of the file.

a) read

b) write

c) binary

d) append

 

Ans. d) append

 

  1. The with clause plays an important role in file handling when

a) File is opened for writing

b) File is opened for reading

c) File is closed

d) Exception occurs

 

Ans. d) Exception Occurs

 

17._________ clause close the opened file automatically once control comes outside the clause.

a) for clause

b) while clause

c) with clause

d) None of these

 

Ans. c)with clause

 

  1. The access_mode can be retrieved through

a) access_mode

b) process_mode

c) open_mode

d) select_mode

 

Ans. a) access_mode

 

  1. Atul wants to know that he has closed the file after performing the tasks. Which of the following function he can used to check whether the file is closed or not?

a) f.close()

b) f.closing()

c) f.closed()

d) There is no such function in python

 

Ans. c) f.closed()

 

  1. Statement A: It is always a good practice to close the file when read/write operations done in the file.Statement B: While closing a file system frees the memory allocated to it.

a) Statement A is Correct

b) Statement B is Correct

c) Statement A and Statement B are correct

d) Statement A and Statement B are incorrect

 

Ans. c) Statement A and Statement B are correct

 

  1. Puru wants to close a file after reading operation for the file object f. Suggest the correct function to him.

a) f.close()

b) f.close

c) f.quit()

d) f.exit()

 

Ans. a) f.close()

 

  1. In which of the following mode the file offset position is not at the begging of the file?

i) r, rb, r+ or +r, rb+ or +rb

ii) w, wb, wb+ or +wb

iii) a, a+ or +a

a) i, ii and iii

b) i, and ii only

c) iii only

d) ii and iii only

 

Ans. c) iii only

 

  1. Priya has placed the file pointer at 4th line in the text file. Now she wants to read all remaining lines of a text file. Which function is suitable for her, select the correct one:

a) f.read()

b) f.readlines()

c) f.read(n)

d) f.readlines()

 

Ans. d) f.readlines()

 

  1. Identify the function to read first 5 characters of the file from the beginning out of the following:

a) f.read(5)

b) f.read()=5

c) f.readline()

d) f.readlines(5)

 

Ans. a) f.read(5)

 

  1. Manoj wants to get the name of the current directory. Select appropriate statement for the same:

a) os.getcd()

b) os.getcurrentdirectory()

c) os.getcwd()

d) os.currentdirectory()

 

Ans. c) os.getcwd()

 

  1. The default directory for performing most of the functions is known as

a) active directory

b) current directory

c) working directory

d) open directory

 

Ans. b) current directory

 

  1. Which of the following are features of CSV files:

a) easy to read and manage

b) small in size

c) fast to process data

d) All of them

 

Ans. d) All of them

 

  1. Read the statements and choose the correct answer:

Statement A: It is very difficult to organize unstructured data

Statement B: CSV helps into organize a huge amount of data in a proper and systematic way

a) Only Statement A is correct

b) Only Statement B is correct

c) A and B both are correct

d) None of them is correct

 

Ans. c) A and B both are correct

 

  1. The CSV files can be accessed by

a) text editor and spreadsheet software

b) only through python programs

c) Only spreadsheet software

d) Only through database software

 

Ans. a) text editor and spreadsheet software

 

  1. A ___________ is a simple flat file in a human-readable format that is used to store data in a spreadsheet or database.

a) text file

b) database file

c) binary file

d) CSV file

 

Ans. CSV File

 

  1. Shiv wants to store the data of his customer using the python program. Suggest the best way to store the data?

a) Text Files

b) CSV files

c) Binary Files

d) Module File

 

Ans. c) Binary File

 

  1. Which of the following statement is not correct for text file?

A) Contains the information as same as its held in memory

B) No delimiter for a line

C) read and write faster than binary files

D) Common format for general work

a) A and B only

b) A, B and C

c) A, C and D

d) All of them

 

Ans. d) All of them

 

  1. In python which of the following is the default EOL character?

a) \eol

b) \enter

c) \n

d) \newline

 

Ans. c) \n

 

  1. Supriya doesn’t know about the text file extension. Help her to identify the same out of these:

a) .text

b) .txt

c) .txf

d) .tfx

 

Ans. b) .txt

 

  1. Which of the following format of files can be created programmatically through python program?

 

a) Data Files

b) Video Files

c) Media Files

d) Binary Files

 

Ans. d) Binary Files

 

  1. The ____________ are the files that store data pertaining to a specific application, for later use.

a) Data File

b) Program File

c) Source Code

d) Program Code

Ans. a) Data File

 

  1. Read the following statements and then select the answer:

Statement A: Default arguments can be used to add new parameters to the existing functions

Statement B: Default arguments can be used to combine similar functions into one

a) Statement A is correct

b) Statement B is correct

c) Both are correct

d) Both are incorrect

 

Ans. c) Both are correct

 

  1. Which of the following function header is correct :

a) def discount(rate=7,qty,dis=5)

b) def discount(rate=7,qty,dis)

c) def discount(rate,qty,dis=5)

d) def discount(qty,rate=7,dis)

 

Ans. c) def discount(rate,qty,dis=5)

 

  1. The default valued parameter specified in the function header becomes optional in the 

function calling statement.

a) Yes

b) No

c) Not Sure

d) May be

 

Ans. a) Yes

 

  1. The positional parameters are also known as

a) required arguments

b) mandatory arguments

c) Both a and b

d) None of them

 

Ans. c) Both a and b

 

  1. Archi is confused between arguments and parameters. Select the fact about argument and parameter and solve her doubt

a) arguments are those values being passed and parameters are those values received

b) parameters are those values being passed and arguments are those values received

c) arguments appear in the function header and parameters appear in the function call

d) arguments can have same name and parameters can have value type

 

Ans. a) arguments are those values being passed and parameters are those values received

 

  1. In python function, the function calling another function is known as ________________ and the function being called is known _________

a) main, keyword

b) caller, called

c) called, caller

d) executer, execute

 

Ans. b) caller, called

 

  1. By default python names the segment with top-level statement as __________________

a) def main()

b) main()

c) __main__

d) _main

 

Ans. c) __main__

 

  1. Which of the following sentence is not correct for the python function?

a) Python function must have arguments

b) Python function can take an unlimited number of arguments

c) Python function can return multiple values

d) To return value you need to write the return statement

 

Ans. a) Python function must have arguments

 

  1. Rashmin is learning the python functions He read the topic types of python functions. He read that functions already available in the python library is called ___________. Fill appropriate word in this blank :

a) UDF (User Defined Function)

b) Built-in Functions

c) Modules

d) Reusable Function

 

Ans. b) Built-in functions

 

  1. Which of the following is not a feature supported by python functions

a) Modularity

b) Reusability

c) Simplicity

d) Data Hiding

 

Ans. d) Data Hiding

 

  1. Which of the function part contains the instructions for the tasks to be done in the function?

a) function header

d) function body

c) return statement

d) parameters

 

Ans. b) function body

 

  1. Richa is working with a program where she gave some values to the function. She doesn’t know the term to relate these values. Help her by selecting the correct option.

a) function value

b) arguments or parameters

c) return values

d) function call

 

Ans. b) arguments of parameters

 

  1. Read the statements:

Statement (A) : A function can perform certain functionality

Statement (B) : A function must return a result value

a) Statement A is correct

b) Statement B is correct

c) Statement A is correct but Statement B is not correct

d) Both are incorrect

 

Ans. c) Statement A is correct but Statement B is not correct

 

  1. The function header contains

a) function name and parameters only

b) def keyword along with function name and parameters

c) return statement only

d) parameter list only

 

Ans. b) def keyword along with function name and parameters

 

  1. Which of the following is not a part of the python function?

a) function header

b) return statement

c) parameter list

d) function keyword

 

Ans. d) function keyword

 

  1. Which of the following is a valid function name?

a) start_game()

b) start game()

c) start-game()

d) All of the above

 

Ans. a) start_game()

 

  1. Which of the following is not a correct statement for binary files?

a) Easy for carrying data into buffer

b) Much faster than other file systems

c) Characters translation is not required

d) Every line ends with new line character ‘\n’

 

Ans: d) Every line ends with new line character ‘\n’

 

  1. Which one of the following is correct statement?

a) import – pickle

b) pickle import

c) import pickle

d) All of the above

 

Ans: c) import pickle

 

  1. In which of the file mode existing data will be intact in binary file?

a) ab

b) a

c) w

d) wb

 

Ans: a) ab

 

  1. Ms. Suman is working on a binary file and wants to write data from a list to a binary file. Consider list object as l1, binary file suman_list.dat, and file object as f. Which of the following can be the correct statement for her?

a) f = open(‘sum_list’,’wb’); pickle.dump(l1,f)

b) f = open(‘sum_list’,’rb’); l1=pickle.dump(f)

c) f = open(‘sum_list’,’wb’); pickle.load(l1,f)

d) f = open(‘sum_list’,’rb’); l1=pickle.load(f)

 

Ans: a) f = open(‘sum_list’,’wb’); pickle.dump(l1,f)

 

  1. Which option will be correct for reading file for suman from q-5?

–> Option ) f = open(‘sum_list’,’rb’); l1=pickle.load(f)

 Which of the following file mode opens a file for reading and writing both as well as overwrite the existing file if the file exists otherwise creates a new file?

a) w

b) wb+

c) wb

d) rwb

 

Ans:b) wb+

 

  1. Which of the following is not a correct statement for binary files?

a) Easy for carrying data into buffer

b) Much faster than other file systems

c) Characters translation is not required

d) Every line ends with new line character ‘\n’

 

Ans: d) Every line ends with new line character ‘\n’

 

  1. Every file has its own identity associated with it. Which is known as –
  1. icon
  2. extension
  3. format
  4. file type

 

Ans: b. extension

 

  1. Which of the following is not a known file type?

a.pdf

b. jpg

c. mp3

d. Txp

 

Ans: d. txp

 

  1. In f=open(“data.txt”, “r”), r refers to __________.

a. Filehandle

b. File object

c. File Mode

d. Buffer

 

Ans: c. File Mode

 

  1. EOL stands for

 

  1. End Of Line
  2. End Of List
  3. End of Lines
  4. End Of Location

 

Ans: a. End Of Line

 

  1. Which of the following file types allows to store large data files in the computer memory?

 

  1. Text Files
  2. Binary Files
  3. CSV Files
  4. None of these

 

Ans: b. Binary Files

 

  1. Which of the following file types can be opened with notepad as well as ms excel?

 

  1. Text Files
  2. Binary Files
  3. CSV Files
  4. None of these

Ans: c. CSV Files

 

  1. Which of the following is nor a proper file access mode?

 

  1. close
  2. read
  3. write
  4. Append

 

Ans: a. close

 

  1. To read 4th line from text file, which of the following statement is true?

 

  1. dt = f.readlines();print(dt[3])
  2. dt=f.read(4) ;print(dt[3])
  3. dt=f.readline(4);print(dt[3])
  4. All of these

 

Ans: a. dt = f.readlines();print(dt[3])

 

  1. Which of the following function flushes the files implicitly?

 

  1. flush()
  2. close()
  3. open()
  4. fflush()

 

Ans: b. close()

 

  1. Which of the following functions flushes the data before closing the file?

 

  1. flush()
  2. close()
  3. open()
  4. fflush()

 

Ans: a. flush()

 

  1. Choose the correct function to rename city columns to location using rename() function:

 

  1. df.rename(columns={‘City’:’Location’})
  2. df.rename(columns={‘City’=’Location’})
  3. df.rename(‘City’=’Location’)
  4. df.rename(df.columns(‘City’,’Location’))

 

Ans: a. df.rename(columns={‘City’:’Location’})

 

  1. df.index properties ca be used to

 

a rename rows

b rename columns

c rename rows and columns both

d None of these

 

Ans: a rename rows

 

  1. In python function, the function calling another function is known as ________________ and the function being called is known _________

 

  1. a) main, keyword
  2. b) caller, called
  3. c) called, caller
  4. d) executer, execute

 

Ans. b) caller, called

 

Sharing is caring!

FAQs

Q. When will CBSE conduct Class 12th Computer Science Term 1 Examination?

The CBSE will conduct Class 12th Computer Science Term 1 Examination on 21st December 2021.

Q. EOL stands for?

EOL stands for End of line.

Q. Which is not a feature supported by python functions?

Data Hiding is not a feature supported by python functions

Q. The CSV files can be accessed by?

The CSV files can be accessed by a text editor and spreadsheet software

Q. Which is not a proper file access mode?

Close is not a proper file access mode.

About the Author

Hi buds, I am Monisa, a postgraduate in Human Physiology (specialization in Ergonomics and Occupational health) with 1.5 years of experience in the school education sector. With versatile writing skills, I provide educational content to help students find the right path to success in various domains, such as JEE, NEET, CUET, and other entrance exams.