मराठी

Science (English Medium) इयत्ता १२ - CBSE Important Questions for Computer Science (Python)

Advertisements
[object Object]
[object Object]
विषय
मुख्य विषय
अध्याय
Advertisements
Advertisements
Computer Science (Python)
< prev  1 to 20 of 84  next > 

The SELECT statement when combined with the ______ clause returns records without repetition.

Appears in 2 question papers
Chapter: [9] Structured Query Language (SQL)
Concept: SQL for Data Query

Write two points of difference between Circuit Switching and Packet Switching.

Appears in 2 question papers
Chapter: [11] Data Communication
Concept: Switching Techniques

Expand the following in the context of Internet Protocol:

POP3

Appears in 2 question papers
Chapter: [11] Data Communication
Concept: Introduction to Protocols

Which of the following is an invalid datatype in Python?

Appears in 1 question paper
Chapter: [1] Exception Handling in Python
Concept: Introduction of Exception Handling in Python

Which of the following statement(s) would give an error after executing the following code?

S="Welcome to class XII" # Statement 1
print(S)       #Statement 2
S="Thank you"    # Statement 3
S[0]= '@'      # Statement 4
S=S+"Thank you"   # Statement 5
Appears in 1 question paper
Chapter: [1] Exception Handling in Python
Concept: Built-in Exceptions in Python

Rao has written a code to input a number and check whether it is prime or not. His code is having errors. Rewrite the correct code and underline the corrections made.

def prime():
n=int(input("Enter number to check :: ")
for i in range (2, n//2):
if n%i=0:
print("Number is not prime \n")
break
else:
print("Number is prime \n’)
Appears in 1 question paper
Chapter: [1] Exception Handling in Python
Concept: Built-in Exceptions in Python

Predict the output of the Python code given below:

def Diff(N1,N2):
 if N1>N2:
 return N1-N2
 else:
 return N2-N1

NUM= [10,23,14,54,32]
for CNT in range (4,0,-1):
 A=NUM[CNT]
 B=NUM[CNT-1]
 print(Diff(A,B),'#', end=' ')
Appears in 1 question paper
Chapter: [1] Exception Handling in Python
Concept: Handling Exceptions in Python

Atharva is a Python programmer working on a program to find and return the maximum value from the list. The code written below has syntactical errors. Rewrite the correct code and underline the corrections made.

def max_num (L):
        max=L(O)
        for a in L:
                if a > max
                 max=a
        return max
Appears in 1 question paper
Chapter: [1] Exception Handling in Python
Concept: Syntax Errors in Python

Which of the following operators will return either True or False?

Appears in 1 question paper
Chapter: [1] Exception Handling in Python
Concept: Introduction of Exception Handling in Python

“In a Python program, if a break statement is given in a nested loop, it terminates the execution of all loops in one go.”

Appears in 1 question paper
Chapter: [1] Exception Handling in Python
Concept: Handling Exceptions in Python

An exception may be raised even if the program is syntactically correct.

Appears in 1 question paper
Chapter: [1] Exception Handling in Python
Concept: Exceptions in Python

The code given below accepts a number as an argument and returns the reverse number. Observe the following code carefully and rewrite it after removing all syntax and logical errors. Underline all the corrections made.

define revNumber (num) :
      rev = 0
      rem = 0
      While num > 0:
            rem ==num %10
            rev = rev*10 + rem
            num = num//10
            return rev
print (revNumber (1234))
Appears in 1 question paper
Chapter: [1] Exception Handling in Python
Concept: Syntax Errors in Python

Given the following dictionaries.

dict_exam={"Exam":"AISSCE", "Year":2023}
dict_result={"Total":500, "Pass_Marks":165}

Which statement will merge the contents of both dictionaries?

Appears in 1 question paper
Chapter: [2] File Handling in Python
Concept: The Pickle Module in Python

Which of the following mode in the file opening statement results or generates an error if the file does not exist?

Appears in 1 question paper
Chapter: [2] File Handling in Python
Concept: Reading from a Text File in Python

The correct syntax of seek() is ______

Appears in 1 question paper
Chapter: [2] File Handling in Python
Concept: Setting Offsets in a File in python

Assertion (A): CSV (Comma Separated Values) is a file format for data storage that looks like a text file.

Reason (R): The information is organized with one record on each line and each field is separated by a comma.

Appears in 1 question paper
Chapter: [2] File Handling in Python
Concept: Types of Files in Python

Write a method COUNTLINES() in Python to read lines from the text file ‘TESTFILE.TXT’ and display the lines which do not start with any vowel.

Example:

If the file content is as follows:

An apple a day keeps the doctor away.
We all pray for everyone’s safety.
A marked difference will come in our country.

The COUNTLINES() function should display the output as:

The number of lines not starting with any vowel - 1

Appears in 1 question paper
Chapter: [2] File Handling in Python
Concept: Reading from a Text File in Python

Write a function ETCount() in Python, which should read each character of a text file “TESTFILE.TXT” and then count and display the count of occurrence of alphabets E and T individually (including small cases e and t too).

Example:

If the file content is as follows:

Today is a pleasant day.
It might rain today.
It is mentioned on weather sites

The ETCount() function should display the output as:
E or e : 6
T or t : 9

Appears in 1 question paper
Chapter: [2] File Handling in Python
Concept: Reading from a Text File in Python

Aman is a Python programmer. He has written a code and created a binary file record.dat with employeeid, ename, and salary. The file contains 10 records.

He now has to update a record based on the employee id entered by the user and update the salary. The updated record is then to be written in the file temp.dat. The records which are not to be updated also have to be written to the file temp.dat. If the employee id is not found, an appropriate message should be displayed.

As a Python expert, help him to complete the following code based on the requirement given above:

import _______ #Statement 1
def update_data():
rec={}
fin=open("record.dat","rb") 
fout=open("_____________") #Statement 2
found=False
eid=int(input("Enter employee id to update their salary :: "))
while True:
try:
rec=______________ #Statement 3
if rec["Employee id"]==eid:
 found=True 
   rec["Salary"]=int(input("Enter new salary :: "))
   pickle.____________ #Statement 4
else:
   pickle.dump(rec,fout)
except:
  break
if found==True:
print("The salary of employee id ",eid," has
been updated.")
else:
print("No employee with such id is not found")
 fin.close()
fout.close()
  1. Which module should be imported into the program? (Statement 1)
  2. Write the correct statement required to open a temporary file named temp.dat. (Statement 2)
  3. Which statement should Aman fill in Statement 3 to read the data from the binary file, record.dat, and in Statement 4 to write the updated data in the file, temp.dat?
Appears in 1 question paper
Chapter: [2] File Handling in Python
Concept: The Pickle Module in Python
The syntax of seek() is:
file_object.seek(offset[,reference_point])

What is the default value of reference_point?

Appears in 1 question paper
Chapter: [2] File Handling in Python
Concept: Setting Offsets in a File in python
< prev  1 to 20 of 84  next > 
Advertisements
Advertisements
CBSE Science (English Medium) इयत्ता १२ Important Questions
Important Questions for CBSE Science (English Medium) इयत्ता १२ Biology
Important Questions for CBSE Science (English Medium) इयत्ता १२ Chemistry
Important Questions for CBSE Science (English Medium) इयत्ता १२ Computer Science (C++)
Important Questions for CBSE Science (English Medium) इयत्ता १२ Computer Science (Python)
Important Questions for CBSE Science (English Medium) इयत्ता १२ English Core
Important Questions for CBSE Science (English Medium) इयत्ता १२ English Elective - NCERT
Important Questions for CBSE Science (English Medium) इयत्ता १२ Entrepreneurship
Important Questions for CBSE Science (English Medium) इयत्ता १२ Geography
Important Questions for CBSE Science (English Medium) इयत्ता १२ Hindi (Core)
Important Questions for CBSE Science (English Medium) इयत्ता १२ Hindi (Elective)
Important Questions for CBSE Science (English Medium) इयत्ता १२ History
Important Questions for CBSE Science (English Medium) इयत्ता १२ Informatics Practices
Important Questions for CBSE Science (English Medium) इयत्ता १२ Mathematics
Important Questions for CBSE Science (English Medium) इयत्ता १२ Physical Education
Important Questions for CBSE Science (English Medium) इयत्ता १२ Physics
Important Questions for CBSE Science (English Medium) इयत्ता १२ Political Science
Important Questions for CBSE Science (English Medium) इयत्ता १२ Psychology
Important Questions for CBSE Science (English Medium) इयत्ता १२ Sanskrit (Core)
Important Questions for CBSE Science (English Medium) इयत्ता १२ Sociology
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×