Search Header Logo

Phython MCQ 12

Authored by Balwan Yadav

Computers

12th Grade

Used 4+ times

Phython MCQ 12
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

14 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Which of the following is an invalid datatype in Python?

Set

None

Integer

Real

Answer explanation

In Python, 'Real' is not a valid datatype. The valid datatypes include Set, None, and Integer. 'Real' is often used in mathematical contexts but does not exist as a specific datatype in Python.

2.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

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?

dict_exam.update(dict_result)

dict_exam + dict_result

dict_exam.add(dict_result)

dict_exam.merge(dict_result)

Answer explanation

The correct choice is 'dict_exam.update(dict_result)', which merges the contents of both dictionaries into 'dict_exam'. The other options are invalid methods for merging dictionaries in Python.

3.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Consider the given expression: not True and False or True Which of the following will be correct output if the given expression is evaluated?

True

False

NONE

NULL

Answer explanation

The expression evaluates as follows: not True is False, so it becomes False and False or True. False and False is False, and False or True is True. Therefore, the correct output is True.

4.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Select the correct output of the code:

a = "Year 2022 at All the best"

a = a.split('2')

b = a[0] + ". " + a[1] + ". " + a[3]

print (b)

Year . 0. at All the best

Year 0. at All the best

Year . 022. at All the best

Year . 0. at all the best

Answer explanation

The code splits the string 'Year 2022 at All the best' by '2', resulting in ['Year ', '0', '22', ' at All the best']. The output concatenates the first, second, and fourth elements, yielding 'Year . 0. at All the best'.

5.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Which of the following mode in file opening statement results or generates an error if the file does not exist? (a) (b) (c) (d)

a+

r+

w+

None of the above

Answer explanation

The 'r+' mode opens a file for reading and writing, and it requires the file to exist. If the file does not exist, it generates an error. In contrast, 'w+' creates a new file if it doesn't exist, and 'a+' appends to a file.

6.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Fill in the blank: ______ command is used to remove primary key from a table in SQL.

update

remove

alter

drop

Answer explanation

The correct command to remove a primary key from a table in SQL is 'alter'. The 'alter' command allows you to modify an existing table structure, including dropping constraints like primary keys.

7.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Which of the following commands will delete the table from MYSQL database?

DELETE TABLE

DROP TABLE

REMOVE TABLE

ALTER TABLE

Answer explanation

The correct command to delete a table in MySQL is 'DROP TABLE'. 'DELETE TABLE' and 'REMOVE TABLE' are not valid SQL commands, while 'ALTER TABLE' is used to modify an existing table, not delete it.

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?