1.
How can we find which data type ans:variable
2.a=10+5j
B=10-5j
A*b=? Ans:125+0j
3.long_1=”python script”
Long_2=’c’+long_1[1:]
Ans: cython script
[Link]=”Django is python”
Print long[1:4]--------- jan
[Link] only list are?______
6.emp_data=(“rahul”,65,78,84)
Print emp_data[:3]
Ans: ('rahul', 65, 78)
7.emp_data=(“rahul”,65,78,84)
Print emp_data[-5:5]
Ans: ('rahul', 65, 78, 84)
8.val1=4
Result=val1**val2
Val2=2
Print result
Ans:Error in Programm invalid syntax
9.basket_1=[‘roses’,’lillies’,’sunflower’]
Basket_2=[‘lotus’,’lillies’,’red roses’]
Ans:set(basket_1+basket_2)
10.emp_data=[“rahul”,24,5.80,65,78,84]
Print emp_data[-1:5]
Ans[]
[Link]=[‘shell’,’perl’,’python’]
L_type=”are scripting languages”
Language+L_type
Ans: TypeError: can only concatenate list (not "str") to list
12.Flower_basket={“roses”:10,”lilies”:8,”sunflower”:4}
How to get value of “lilies”
13.Flower_basket={“roses”:10,”lilies”:8,”sunflower”:4}*2 ??
[Link] datatype doesnot support membership operator
a)list
b)tuple
c)string
d)int
15.x=y=10
If(x is y):
X=20
Else:
X=30
Print x
16.x=y=10
If (x is not y):
X=20
Elif (x>=y):
X=30
Y=20
Else:
X=40
Print x,y
17. import sys
Nargs=len([Link])
Total=0
Cnt=0
While(cnt<nargs):
Total+= int([Link])
Cnt+=1
[Link] foobar():
Print”django”
Print’rails’
Foobar()
Print’pylons’
19.x=10
Def foobar(x):
Global x=20
X=30
Foobar(X)
Print x
20. def foobar(a=30,b=40)
Print a,b
X=10
Y=20
Foobar(X)
[Link] foobar(a=30,b=40):
Print a,b
X=10
Y=20
Foobar()
[Link] fib(n):
If n==0:
Return 1
Else:
Return (fib(n-1)+fib(n-2))
[Link]=input(“enter the length : “)
Breadth=input(“enter the breadth : “)
Perimeter=(length+breadth)*2 ??
[Link] variable of python to find modules??
[Link] foo():
Print”is half the battle”
Print” a good beginning”
If __name__==’__main__’
Foo()
Print ‘makes a good ending’
[Link] statement is false regarding modules?
Ans: modules cannot have variables.
27. [Link]
def foo():
Print “iron python”
If __name__==’__main__
Foo()
Print”jython”
Appl:---
Import mod
Print ‘cython’
[Link]()
28.x=y=10
If(x is y):
X=20
Y=20
Else:
X=30
Y=40
Print x,y