[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1. python has two primitive loop commands:

  • while loops
  • for loops

2 / 40

2. You can use three double quotes only:

a = “””Lorem ipsum dolor sit amet,
consectetur adipiscing elit,
sed do eiusmod tempor incididunt
ut labore et dolore magna aliqua.”””
print(a)

3 / 40

3. A for loop is used for iterating over a sequence (that is either a list, a tuple, a dictionary, a set, or a string).

4 / 40

4. 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

5 / 40

5. We can combine strings and numbers by using the format() method

6 / 40

6. Find the output of the given Python program?

a = 25if a < 15:    print("Hi")if a <= 30:    print("Hello")else:    print("Know Program")

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

7 / 40

7. + operator is used  to get output of multiple variables

8 / 40

8. The format() method takes the passed arguments

9 / 40

9. python file can also run on command line

10 / 40

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

11 / 40

11. Which of the following is a Python tuple?
a) [1, 2, 3]
b) (1, 2, 3)
c) {1, 2, 3}
d) {}

12 / 40

12. Variable names are case-sensitive

13 / 40

13. To insert characters that are illegal in a string, use an escape character

14 / 40

14. Comments can be used to explain Python code.

15 / 40

15. 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.

16 / 40

16. Find and write the output of the following python code:

x = “abcdef”

i = “a”

while i in x:

print(i, end = ” “)

a) a

b) a a a a a a

c) a a a a a a … infinite times

d) Code will generate error

17 / 40

17. You can have if statements inside if statements, this is called nested if statements.

18 / 40

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

19 / 40

19.

In Python, a variable may be assigned a value of one type, and then later assigned a value of a different type:

  1. False
  2. True

20 / 40

20. Which term describes a loop that continues repeating without a terminating (ending) condition?

a) Infinite Loop

b) Conditional Loop

c) Unlimited Loop

d) Sequence Loop

21 / 40

21. Extension of all Python  Programme are .py

22 / 40

22.

What is the data type of print(type(10))

23 / 40

23. The for loop does not require an indexing variable to set beforehand

24 / 40

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

25 / 40

25.

What will be the output of below Python code?

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

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

26 / 40

26. Arrays are used to store multiple values in one single variable.

27 / 40

27. Suppose t = (1, 2, 4, 3), which of the following is incorrect?
a) print(t[3])
b) t[3] = 45
c) print(max(t))
d) print(len(t))

28 / 40

28.

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.

29 / 40

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

30 / 40

30. The format() method takes unlimited number of arguments

31 / 40

31.

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

32 / 40

32. What is another word for ‘iteration’ ?

a) Selection

b) Assignment

c) Sequencing

d) Repetition

33 / 40

33. You can use the pop() method to remove an element from the array

34 / 40

34.

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

35 / 40

35. You can also use the remove() method to remove an element from the array

36 / 40

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

37 / 40

37. Most recent major version of Python is Python 3

38 / 40

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

39 / 40

39. Python allows you to extract the values into variables.

40 / 40

40. Comments starts with a #

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.