- How many times loop run ?
i=5
while(i>1):
i=i-1
- 2
- 5
- 4
- 6
- Output of following code ?
for i in range(0,2,-1):
print("Python")
- Pyhton
- Python Python
- No Output
- PythonPython
- Which one of the following is a valid Python if statement :
- if a>=15 :
- if (a >= 20)
- if (a =>5)
- if a >= 6
- what condition is use an alternative of 'if' statement ?
- else if
- elseif
- elif
- None of the above
- Determine the output :
for i in range(20,30,10) :
j=i/2
print(j)
- 10.0
- 10 15
- 10.0 15.0
- None of these
- To repeat a particular task, we use __________.
- Input
- Loop
- Output
- Condition
- __________ immediately terminates a loop entirely.
- break
- continue
- pass
- none of these
- What is the output of the following ?
i = 2
while True:
if i%3 == 0:
break
print(i,end=" " )
i += 2
- 2 4 6 8 10 ....
- 2 4
- 2 3
- error
- What is the output of the following ?
for i in range(10):
if i == 5:
break
else:
print(i)
else:
print("Here")
- 0 1 2 3 4 Here
- 0 1 2 3 4 5 Here
- 0 1 2 3 4
- 1 2 3 4 5
- What will be the output of the following algorithm for a=5, b=8, c=6 ?
Step 1: Start
Step 2: Declare variables a,b and c.
Step 3: Read variables a,b and c.
Step 4: If a > b
If a > c
Display a is the largest number.
Else
Display c is the largest number.
Else
If b > c
Display b is the largest number.
Else
Display c is the greatest number.
Step 5: Stop
- b is the largest number
- c is the largest number
- a is the largest number
- stop
- What will following code segment print ?
a = True
b = False
c = False
if a or b and c:
print "HELLO"
else:
print "hello"
- HELLO
- Hello
- HellO
- None of these
- What will be the output after the following statements?
a = 0
b = 3
while a + b < 8:
a += 1
print(a, end='')
- 0 1 2 3 4
- 1 2 3 4 5 6
- 1 2 3 4 5
- None of these
- What will be the output of following code ?
if 2 + 5 == 8:
print("TRUE")
else:
print("FALSE")
print("TRUE")
- TRUE
- False
- TRUE TRUE
- FALSE TRUE
- What will be the output of the following?
print(range(4))
- 0,1,2,3
- [0,1,2,3]
- range(0,4)
- (0,1,2,3)
- What will be the output of the following expression ?
a = 2
b = 8
print(a | b)
print(a >> 1)
- 10 0
- 10 2
- 2 2
- 10 1
- What is the output of print(bool('False')) ?
- bool('False')
- True
- False
- 0
- elif can be considered to be abberviation of
- nested if
- if else
- else
- else if
- Which of following play important role in Pyhton programming ?
- Statements
- Control
- Indentation
- Calculations
- Which statement is generally used as a placeholder ?
- Continue Statements
- Pass Statements
- Break Statements
- None of these
- Python operator always yields the result of
- Interger
- Foating point
- Complex
- None of these