[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

2.

What will be the output of below Python code?

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

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

3 / 40

3. The format() method takes the passed arguments

4 / 40

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

5 / 40

5. You can return a range of characters by using the slice syntax

6 / 40

6.

What is the value of the expression 100 / 25?

  1. 4
  2. 4.0
  3. 0
  4. 25

7 / 40

7. Python can be install on both  Linux and  Windows

8 / 40

8. An example of an illegal character is a double quote inside a string that is surrounded by double quotes

9 / 40

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

10 / 40

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

11 / 40

11.

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

12 / 40

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

13 / 40

13.

Python considered the character enclosed in triple quotes as String.(T/F)

a. True

b. False

14 / 40

14.

 Select the correct example of complex datatype in Python

  1. 3 + 2j
  2. -100j
  3. 5j
  4. All of the above are correct

15 / 40

15. With the for loop we can execute a set of statements

16 / 40

16.

Which is the correct operator for power(xy)?

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

17 / 40

17. Which of the following is the correct extension of the Python file?

18 / 40

18. Variable names are case-sensitive

19 / 40

19. 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)

20 / 40

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

21 / 40

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

22 / 40

22. Variables that are created outside of a function

23 / 40

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

24 / 40

24. Comparison operators are not  used to compare two values

25 / 40

25. if statements cannot be empty, but if you for some reason have an if statement with no content, put in the pass statement to avoid getting an error

26 / 40

26.

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

27 / 40

27.

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

28 / 40

28. You can also have multiple else statements on the same line:

29 / 40

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

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

a) Hi
b) Know Program

c)
Hi
Hello

d)
Know Program
Hello

30 / 40

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

31 / 40

31. 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))

32 / 40

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

33 / 40

33. With the break statement we can stop the loop before it has looped through all the items

34 / 40

34. During Installation Make sure to select both the checkboxes at the bottom .

35 / 40

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

36 / 40

36.  ________ in Python is a counter-controlled loop.

a) for

b) while

c) Both (a) and (b)

d) None of the above

37 / 40

37. python has two primitive loop commands:

  • while loops
  • for loops

38 / 40

38.

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

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

39 / 40

39. The list’s remove() method only removes the first occurrence of the specified value.

40 / 40

40. Python has various versions available

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.