MCQOPTIONS
Saved Bookmarks
This section includes 8 Mcqs, each offering curated multiple-choice questions to sharpen your Technical MCQs knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Which of the following would give "Harry" as output? Given str1="Mary,Harry,John,Sam" |
| A. | str1[4:9] |
| B. | str1[5:10] |
| C. | str1[4:10] |
| D. | str1[5:9] |
| E. | |
| Answer» C. str1[4:10] | |
| 2. |
Which of the following operations cannot be done on string str1, where str1="LETSFINDCOURSE."? |
| A. | str1+="Learning made easy" |
| B. | str1[1]="a" |
| C. | print(str1[1]) |
| D. | str1[0:4] |
| Answer» C. print(str1[1]) | |
| 3. |
Which of the following two will give the same result?(i) 42//2 (ii) 21%6 (iii) 12/4 (iv) 11*2 |
| A. | ii,iii |
| B. | i, iii |
| C. | ii, iv |
| D. | iii, iv |
| Answer» B. i, iii | |
| 4. |
a=0b=1if (a and b): print("hi")elif(not(a)): print("hello")elif(b): print("hi world")else: print("hello world")16.Which of the following are in correct order with respect to conditional statements in Python? (i) if (ii) else (iii) elif |
| A. | i, iii, ii |
| B. | ii, iii ,i |
| C. | iii, ii, i |
| D. | ii, i, iii |
| Answer» B. ii, iii ,i | |
| 5. |
for i in range(0 , -2 , -1): print(i)15.What will be the result of following Python code snippet after execution? |
| A. | hello world |
| B. | hi |
| C. | hi world |
| D. | hello |
| Answer» E. | |
| 6. |
If var1=7var2=5var3=1var4=10var5=20(var1*var2)>(var5+var4*var3) and ((var5+var3)/var1)>=(var2-2)/var314.What will be the output of following Python code snippet? |
| A. | 0, -1 |
| B. | 0, -1, -1 |
| C. | -1, -2 |
| D. | Error |
| Answer» B. 0, -1, -1 | |
| 7. |
var=3var1=0var2=var1+1while(var<7): var2=var2+var1 if(var1%2==0): var=var+1 var1=var1+1 else: var2=var2*var1 var1=var1+313. Which of the given options has same output as given statement? |
| A. | (var5/var4)>var3 and (var3*var2)>=(var1*var3) |
| B. | (var5-var4)*var2@@<var3 or></var3> |
| C. | (var4/var2)>var1 and (var1*3)/var3 |
| D. | (var1/var3)>var4 or var5*2==var4 |
| Answer» C. (var4/var2)>var1 and (var1*3)/var3 | |
| 8. |
a=0b=6x=(a&b)|(a&a | a&b)y=not(x)print(y)12.What will be the values of var1 and var2 after the execution of program? |
| A. | 12,648 |
| B. | 13,648 |
| C. | 13,660 |
| D. | 9,72 |
| Answer» D. 9,72 | |