Programming and Problem Solving Through Python Language Theory Question
Introduction to Python - Set 2
In order to store values, in form of key and value what we use ?
List
Class
Tuple
Dictionary
Answer : D
Explain : we use dictionary in which one key define and value store. Example (dictionary name) = { 'key':'value'}
What will be the output of following ?
print(range(4))
0,1,2,3
[0,1,2,3]
range(0,4)
Error
Answer : C
Explain : In Python, the range() function is used to generate a sequence of numbers within a specified range. The range() function returns an object that represents the sequence of numbers.
The data type whose representation is known are called
Built-in datatype
Derived datatype
Concrete datatype
Abstract datatype
Answer : C
Explain : A concrete data type is a data type whose representation is known and relied upon by the programmers who use the data type.If you do not know the representation of a data type and are not allowed to rely upon its representation, then the data type is abstract.
Which of the following is the use of function in python?
Functions do not provide better modularity for applications
One can’t create our own functions
Functions are reusable pieces of programs
All of the above
Answer : C
Explain : When function declare it can be reuse anywhere, anytime.
List, tuple, and range are which type of Data Types ?
Sequence Types
Binary Types
Boolean Types
None of the mentioned above
Answer : A
Explain :The sequence Types of Data Types are the list, the tuple, and the range. In order to store multiple values in an organized and efficient manner, we use the concept of sequences
Which function is used to get the version of python?
system.getversion
sys.version(1)
system.get
None of the above
Answer : B
Explain : sys.version(1) is used to known about python version.
Which function is used to get ASCII value of any character in python ?
as()
ascii()
bin()
ord()
Answer : D
Explain : ord () is used to check ascii value and bin() is used to get binary value.
Python is a which type of programming language ?
High level
Low level
Object oriented
Both a and c
Answer : D
Explain : Python is high level, scripted language and object oriented language.
What is the full form of IDLE in python ?
Integrated Development and Learning Environment
Interpreter Development and Learning Environment
Integrated Developed and Learning Environment
Integer Development and Learning Environment
Answer : A
Explain : IDLE (short for Integrated Development and Learning Environment) is an integrated development environment for Python.
The command used to start python from the command prompt is ?
execute python
python
py
Both B and C
Answer : D
Explain : We can use both python and py on cmd to run python.
Python Literals is used to define the data that is given in a variable or constant?
True
False
Answer : A
Explain : Literals in Python used as data that is provided in a variable or constant. Literal collections are supported in Python as well as String and Numeric literals, Boolean and Boolean expressions, Special literals, and Special expressions.
Which escape sequence represents the new line in python ?
\n
\'
\"
\r
Answer : A
Explain : \n escape seq. is used to add text in newline.
Which function is used to take input from user ?
in()
input()
user()
None
Answer : B
Explain : To take input from user, we use input() and int(input()) for integer value.
Which of following is not numeric data types ?
integer
float
complex
list
Answer : D
Explain : List is a ordered collection of data. There are three distinct numeric types: integers, floating point numbers, and complex numbers.
Print() function is used for ?
to get output
to take input
to assign value
None of the above
Answer : A
Explain : print() function is used to get output in python.