Q:1. What is the first step in write a program?
1. Run Code
2. Write Code
3. Edit Code
4. Check the Code
Reason: With Python, we can either write a program in
a text editor and then run it on Terminal or we can use
Python's Interactive Interpreter and type commandss
directily in Terminal.
Q:2. Logical solution is a.
solve the
and clear procedure to
problem, known as
1. problem description, step-by-step., flowchart
2. expression, assignment statement, identifier
3. finite, step-by-step, Algorithm
4. finite, assignment statement, algorithm
Reason: A step-by-step procedure used to solve a
problem is called Algorithms.
Q:3. Python is alan language (unlike C, C++,
Java).
1. Logical programming
2. Interpreted programming
3. Compiled programming
4. Complex programming
Reason: Python is called an interpreted language
because it goes through an interpreter, which turns
code you write into the language understood by your
computer's processor.
Q:4. What is the extension of apython file?
pi
2. Pyt
3. Py
4. ptn
Reason:PY is ascript file format used by Python.
a:5. In Pythonvariables can bethought of as
1.labels
2. containers
3. boxes
4.tumblers'
Reason: Variables can bethought of ascontainersthat
holdinformation and are usedto store datain memory.
Q:6. Which function is used to get a string in Title Cases
(First letter of each word in capital)?
1. pint()
2. title()
3. strip()
4. Istrip()
Reason: The method retums a string where the
title()
first character in every word is upper case. Like a
or a if the contains a number or a
header, title. word
symbol, the first letter after that will be converted to
upper case.
Q:7. Which function is used to get rid of the blank spaces on
the left?
1. strip()
. left()
3. rstrip()
4. Istrip()
Reason: Istrip() is used to remove spaces from the left
side of string. Since these are pandas function with
same name as to be
Python's default functions,.str has
prefixed to the compiler that a Pandas function is
tell
being called.
Q:8. A Python Program is a sequence of and
1. dataand information
2.classes andobjects
3. strings and arrays
4. definitions and commands
Reason: Sequences allow you to store multiple values
in an organized and efficient fashion.
a.9.
What willbe the output of: type(3.5)?
1. class double
2. class str
3. class int
4. class 'loat
Reason: Python has a built-in function called type() that
helps you find the class type of the variable given as
input.
Q:10. What will be the output of: int(2.5)?
1.1
2.3
3.2
4. 2.5
Reason: Because an integer is any whole number.
"
Precision compare from lowest to highest on basic data
types, so when we call int{2.5) its cast to an int and the
precision(decimal numbers) are chopped off.
a:11. Any input that you take in Python is ofdata type.
1. str
2 int
3. float
. char
Reason: Whatever you enter as input, input function
convert it into a string. if you enter an integer value still
input() function convert it into a string.
Q:12. What is the output of the following: 4//5?
1.1
2. 0.8
4.
Reason: The / perform integer division i.e it will
truncate the decimal part oft h e answer and return only
integer.
a:13. Whatwill be thevalue storedin y? :x, y, z = 1,2,3
1.1 1
2. 22
3. 3
4. None ofthese
Reason: On comparingthe values from the both sides,
we can see that the value of y
is given by,
y 2.=
Q:14. Which of the following is a valid identifier or variable?
1. well&1
2. well 1
3.well
4.@well
Reason: ldentifiers can be a combination of letters
lowercase (a to z) or uppercase (A to Z) or digits (0 to
9) or an underscore_