[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1. Python will give you an error if you skip the indentation

2 / 40

2.

Which statement is correct?

A. List is immutable && Tuple is mutable
B. List is mutable && Tuple is immutable
C. Both are Mutable.
D. Both are Immutable

3 / 40

3. A loop block in python starts with a –

a) ; (semicolon)

b) , (comma)

c) : (colon)

d) # (hash)

4 / 40

4. The else keyword catches anything which isn’t caught by the preceding conditions.

5 / 40

5. Comments can be used to make the code more readable.

6 / 40

6. You can use the append() method to add an element to an array

7 / 40

7. print() function is often used to output variables.

8 / 40

8. The for loop in Python is an _____________

a) Entry Controlled Loop

b) Exit Controlled Loop

c) Both of the above

d) None of the above

9 / 40

9. Python can be used on a server to create web applications?

10 / 40

10. Official site of python is www.python.org

11 / 40

11.

Which is the correct operator for power(xy)?

  1. X^y
  2. X**y
  3. X^^y
  4. None of the mentioned

12 / 40

12. What keyword would you use to add an alternative condition to an if statement?

a) else if
b) elseif
c) elif
d) None of the above

13 / 40

13. You can also have an else without the elif

14 / 40

14. Find the output of the given Python program?

a, b, c = 1, 3, 5if a > 0:  if b < 2:    print("Hi")  elif c > 3:    print("Hello")else:  print("Know Program")

a) Hi
b) Hello
c) Know Program
d) Compiled Successfully, No Output.

15 / 40

15. break in Python is used ______________

a) To restart a loop

b) Terminate a loop

c) To jump in between the loop

d) None of the above

16 / 40

16. Is Python code compiled or interpreted?
a) Python code is both compiled and interpreted
b) Python code is neither compiled nor interpreted
c) Python code is only compiled
d) Python code is only interpreted

17 / 40

17.

Which of the following statements assigns the value 25 to the variable x in Python:

  1. x ← 25
  2. x = 25
  3. x := 25
  4. int x = 25
  5. x << 25

18 / 40

18.

Which of the following precedence order is correct in Python?

  1. Parentheses, Exponential, Multiplication, Division, Addition, Subtraction
  2. Multiplication, Division, Addition, Subtraction, Parentheses, Exponential
  3. Division, Multiplication, Addition, Subtraction, Parentheses, Exponential
  4. Exponential, Parentheses, Multiplication, Division, Addition, Subtraction

19 / 40

19. Python can be treated in a procedural way, an object-oriented way or a functional way.

20 / 40

20. python has two primitive loop commands:

  • while loops
  • for loops

21 / 40

21. An array is a special variable, which can hold more than one value at a time

22 / 40

22. Comments can be used to explain Python code.

23 / 40

23. Strings in python are surrounded by either single quotation marks, or double quotation marks

24 / 40

24. Which keyword is used for function?
a) Fun
b) Define
c) Def
d) Function

25 / 40

25.

What will the below Python code will return?

If str1="save paper,save plants"str1.find("save")

A. It returns the first index position of the first occurance of “save” in the given string str1.
B. It returns the last index position of the last occurance of “save” in the given string str1.
C. It returns the last index position of the first occurance of “save” in the given string str1.
D. It returns the first index position of the first occurance of “save” in the given string str1.

26 / 40

26.

 Which of the following statement is False?

  1. Variable names can be arbitrarily long.
  2. They can contain both letters and numbers.
  3. Variable name can begin with underscore.
  4. Variable name can begin with number.

27 / 40

27. The len() method to return the length of an array

28 / 40

28.

Which of the following is not a keyword in Python language?

  1. val
  2. raise
  3. try
  4. with

29 / 40

29.

Which of the following statement will execute in last?

def s(n1): #Statement 1      print(n1) #Statement 2n2=4 #Statement 3s(n2) #Statement 4

a. Statement 1

b. Statement 2

c. Statement 3

d. Statement 4

30 / 40

30. Camel Case
Each word, except the first, starts with a capital letter:

31 / 40

31. What is the output of the given below program?

if 1 + 3 == 7:    print("Hello")else:    print("Know Program")

a) Hello
b) Know Program
c) Compiled Successfully, No Output.
d) Error

32 / 40

32.

Which keyword is used to begin the definition of a function?

a. Define

b. DEF

c. def

d. Def

33 / 40

33. The length of an array is always one more than the highest array index.

34 / 40

34.

What will be the output of below Python code?

str1="Information"print(str1[2:8])

A. format
B. formatio
C. orma
D. ormat

35 / 40

35. To write and execute code in python, we first need to install Python on our system.

36 / 40

36. Python has a set of built-in methods that you can use on lists/arrays

37 / 40

37. What is another word for ‘iteration’ ?

a) Selection

b) Assignment

c) Sequencing

d) Repetition

38 / 40

38. Bitwise operators are used to compare (binary) numbers

39 / 40

39.

What will be the output of below Python code?

str1="poWer"str1.upper()print(str1)

A. POWER
B. Power
C. power
D. poWer

40 / 40

40. What will be the output of the following Python code?

  1. d = {"john":40, "peter":45}
  2. d["john"]

a) 40
b) 45
c) “john”
d) “peter”

Exit



[hurrytimer id=”2250″]
[wooct_product]

Wrong shortcode initialized


You must log in to see your results.



Wrong shortcode initialized


There are no questions atteched yet.





[ays_quiz_leaderboard id=”Your_Quiz_ID” from=”Y-m-d H:i:sa” to=”Y-m-d H:i:s”]

Category:


Wrong shortcode initialized


[WATU 1]

You must log in to see your results.