[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

i = 1while True:    if i%3 == 0:        break    print(i)     i + = 1

a) 1 2
b) 1 2 3
c) error
d) none of the mentioned

2 / 40

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

3 / 40

3.

In a program, a function can be called ____________ times.

a. 2

b. 3

c. 5

d. Multiple times

4 / 40

4.

Which of the following creates a tuple?

A. tuple1=(“a”,”b”)
B. tuple1[2]=(“a”,”b”)
C. tuple1=(5)*2
D. None of the above

5 / 40

5.

 What is output of: 35 == 35.0

  1. False
  2. True
  3. 33
  4. None of the above

6 / 40

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

7 / 40

7.

Write the output of the following code :

str = "Welcome"str[2] = 'a'print(str)

a. Weacome

b. Error

c. aWelcome

d. Welcomea

8 / 40

8. With the break statement we can stop the loop even if the while condition is true

9 / 40

9.

def cal(n1) : What is n1?

a. Parameter

b. Argument

c. Keyword

d. None of the above

10 / 40

10.

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

11 / 40

11.

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

12 / 40

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

13 / 40

13. What is the index value of ‘i’ in string “Learning”

a. 5

b. 3

c. 6

d. 7

14 / 40

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

15 / 40

15.

Which one of the following is the correct extension of the Python file?

  1. .py
  2. .python
  3. .p
  4. None of these

16 / 40

16. What is another word for ‘iteration’ ?

a) Selection

b) Assignment

c) Sequencing

d) Repetition

17 / 40

17. Who developed Python Programming Language?

18 / 40

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

19 / 40

19. Find the output of the following program segments:

for i in range(20,30,2):

print(i)

a) 20 22 24 26 28

b) 20

22

24

26

28

c) 20 22 24 26 28 30

d) 20

22

24

26

28

30

20 / 40

20. Python can be install on both  Linux and  Windows

21 / 40

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

a) for

b) while

c) Both (a) and (b)

d) None of the above

22 / 40

22.

What will be the output of below Python code?

tupl=([2,3],"abc",0,9)tupl[0][1]=1print(tupl)A. ([2,3],"abc",0,9)B. ([1,3],"abc",0,9)C. ([2,1],"abc",0,9)D. Error

23 / 40

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

24 / 40

24. When does the else statement written after loop executes?

a) When loop condition becomes false

b) When break statement is executed in the loop

c) else statement is always executed

d) None of the above

25 / 40

25.

What is the data type of print(type(0xFF))

26 / 40

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

27 / 40

27. Comparison operators are not  used to compare two values

28 / 40

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

29 / 40

29. You have to use the same number of spaces in the same block of code, otherwise Python will give you an error

30 / 40

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

31 / 40

31.

Function defined to achieve some task as per the programmer’s requirement is called a ___________

a. user defined function

b. library function

c. built in functions

d. All of the above.

32 / 40

32.

What will be the output of above Python code?

str1="6/4"print("str1")

A. 1
B. 6/4
C. 1.5
D. str1

33 / 40

33.

What is the value of the expression 100 / 25?

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

34 / 40

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

35 / 40

35.

The function can be called in the program by writing function name followed by ____

a. [ ]

b. { }

c. ( )

d. None of the above

36 / 40

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

37 / 40

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

38 / 40

38. What does the following code print?

x = -10if x < 0:    print("The negative number ",  x, " is not valid here.")print("This is always printed")
a.This is always printedb.The negative number -10 is not valid hereThis is always printedc.The negative number -10 is not valid here

39 / 40

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

40 / 40

40. python file can also run on command line

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.