QUIZ ON : PROGRAMMING AND PROBLEM SOLVING THROUGH PYTHON - INTRODUCTION TO PYTHON

INTRODUCTION TO PYTHON

00:00:00

What will be the output of the following Python code?

print('xyyzxxyxyy'.lstrip('xyy'))

Option A. error
Option B. zxxyxyy
Option C. z
Option D. zxxy
True Answer B

Explanation :
The leading characters containing xyy are removed.

What will be the output of the following Python code?

print('xyyzxxyxyy'.lstrip('xyy'))

Question No# : 01 out of 20



The ______ mode of Python gives instant result of typed statement

Option A. Interactive Mode
Option B. Script Mode
Option C. Combination of Interactive and Script modes
Option D. All of these
True Answer A

Explanation :

The ______ mode of Python gives instant result of typed statement

Question No# : 02 out of 20

You can create program in Python, in Script Mode

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer A

Explanation :

You can create program in Python, in Script Mode

Question No# : 03 out of 20

What will be the output of the following Python code?

print('a B'.isalpha())

Option A. True
Option B. False
Option C. None
Option D. Error
True Answer B

Explanation :
Space is not a letter.

What will be the output of the following Python code?

print('a B'.isalpha())

Question No# : 04 out of 20



To convert the read value through input() into integer type, ______ () is used

Option A. floating
Option B. float
Option C. int
Option D. integer
True Answer C

Explanation :

To convert the read value through input() into integer type, ______ () is used

Question No# : 05 out of 20

What will be the output of the following Python code snippet?

print('abcd'.translate({'a': '1', 'b': '2', 'c': '3', 'd': '4'}))

Option A. abcd
Option B. 1234
Option C. error
Option D. none of the mentioned
True Answer A

Explanation :
The function translate expects a dictionary of integers. Use maketrans() instead of doing the above.

What will be the output of the following Python code snippet?

print('abcd'.translate({'a': '1', 'b': '2', 'c': '3', 'd': '4'}))

Question No# : 06 out of 20



What will be the output of the following Python code?

print('cba'.maketrans('abc', '123'))

Option A. {97: 49, 98: 50, 99: 51}
Option B. {65: 49, 66: 50, 67: 51}
Option C. 321
Option D. 123
True Answer A

Explanation :
A translation table is returned by maketrans.

What will be the output of the following Python code?

print('cba'.maketrans('abc', '123'))

Question No# : 07 out of 20



Python code can run on a variety of platforms, it means Python is a _____ language.

Option A. Graphical
Option B. Cross-platform
Option C. Independent
Option D. All of these
True Answer B

Explanation :

Python code can run on a variety of platforms, it means Python is a _____ language.

Question No# : 08 out of 20

Which of the following is not a token ?

Option A. Interpreter
Option B. Identifiers
Option C. Keyword
Option D. Operators
True Answer A

Explanation :

Which of the following is not a token ?

Question No# : 09 out of 20

The data type whose representation is unknown are called

Option A. Built in datatype
Option B. Derived datatype
Option C. Concrete datatype
Option D. Abstract datatype
True Answer D

Explanation :
A concrete data type is a data type whose representation is known and in abstract data type the representation of a data type is unknown

The data type whose representation is unknown are called

Question No# : 10 out of 20

What will be the output of the following Python code snippet?

print('\t'.isspace())

Option A. True
Option B. False
Option C. None
Option D. Error
True Answer A

Explanation :
Tab Spaces are considered as spaces.

What will be the output of the following Python code snippet?

print('\t'.isspace())

Question No# : 11 out of 20



Variable once assigned a value can be given any other vaue.

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer A

Explanation :

Variable once assigned a value can be given any other vaue.

Question No# : 12 out of 20

What will be the output of the following Python code?

print('''  \tfoo'''.lstrip())

Option A. foo
Option B. foo
Option C. foo
Option D. none of the mentioned
True Answer B

Explanation :
All leading whitespace is removed.

What will be the output of the following Python code?

print('''  \tfoo'''.lstrip())

Question No# : 13 out of 20



What will be the output of the following Python code snippet?

print('abc'.islower())

Option A. True
Option B. False
Option C. None
Option D. Error
True Answer A

Explanation :
There are no uppercase letters.

What will be the output of the following Python code snippet?

print('abc'.islower())

Question No# : 14 out of 20



The output of the two codes shown below is the same.

i. bin((2**16)-1)

ii. '{}'.format(bin((2**16)-1))

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer A

Explanation :
The output of both of the codes shown above is ‘0b1111111111111111’. Hence the statement is true.

The output of the two codes shown below is the same.

i. bin((2**16)-1)

ii. '{}'.format(bin((2**16)-1))

Question No# : 15 out of 20



Which of the following is not a legal integer type value in Python

Option A. Decimal
Option B. Octal
Option C. Hexadecimal
Option D. Roman
True Answer D

Explanation :

Which of the following is not a legal integer type value in Python

Question No# : 16 out of 20

What will be the output of the following Python code snippet?

print('ab cd-ef'.title())

Option A. Ab cd-ef
Option B. Ab Cd-ef
Option C. Ab Cd-Ef
Option D. None of the mentioned
True Answer C

Explanation :
The first letter of every word is capitalized. Special symbols terminate a word.

What will be the output of the following Python code snippet?

print('ab cd-ef'.title())

Question No# : 17 out of 20



What will be the output of the following Python code snippet?

print('0xa'.isdigit())

Option A. True
Option B. False
Option C. None
Option D. Error
True Answer B

Explanation :
Hexadecimal digits aren’t considered as digits (a-f).

What will be the output of the following Python code snippet?

print('0xa'.isdigit())

Question No# : 18 out of 20



What will be the output of the following Python code snippet?

print('__foo__'.isidentifier())

Option A. True
Option B. False
Option C. None
Option D. Error
True Answer A

Explanation :
It is a valid identifier.

What will be the output of the following Python code snippet?

print('__foo__'.isidentifier())

Question No# : 19 out of 20



names Given to different parts of a Python program are_____

Option A. Identifiers
Option B. Function
Option C. Keywords
Option D. Literals
True Answer A

Explanation :

names Given to different parts of a Python program are_____

Question No# : 20 out of 20


CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Website development Company in Allahabad