[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

2.

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

3 / 40

3.

 ____________________ can be defined as a named group of instructions that accomplish a specific task when it is invoked/called.

a. Function

b. Datatype

c. Token

d. Operator

4 / 40

4. Most recent major version of Python is Python 3

5 / 40

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

6 / 40

6.

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

7 / 40

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

8 / 40

8. Pascal Case
Each word starts with a capital letter:

9 / 40

9. Variables that are created outside of a function

10 / 40

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

11 / 40

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

12 / 40

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

13 / 40

13. Operators are used to perform operations on variables and values

14 / 40

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

15 / 40

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

16 / 40

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

17 / 40

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

18 / 40

18. Python  was created by Guido van Rossum, and released in 1999.

19 / 40

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

20 / 40

20.

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

21 / 40

21.

Which is the correct operator for power(xy)?

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

22 / 40

22. X wants to allow the program to repeatedly ask the user to enter their Choice if it does not equal the Answer. Which loop option should X use?

a) while Choice == Answer:

Choice = input()

b) while Choice != Answer:

Choice = input()

c) while Answer != Choice:

Choice = input()

d) while Answer =! Choice:

Choice = input()

 

23 / 40

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

24 / 40

24.

What do we use to define a block of code in Python language?

  1. Key
  2. Brackets
  3. Indentation
  4. None of these

25 / 40

25.

The most important object defined in NumPy is an N-dimensional array type called?

A. ndarray
B. narray
C. nd_array
D. darray

26 / 40

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

27 / 40

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

28 / 40

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

29 / 40

29.

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

a. [ ]

b. { }

c. ( )

d. None of the above

30 / 40

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

31 / 40

31.

How to copy one list to another in python?

A. l1[] = l2[]
B. l1[] = l2
C. l1[] = l2[:]
D. l1 = l2

32 / 40

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

a) for

b) while

c) Both (a) and (b)

d) None of the above

33 / 40

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

34 / 40

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

35 / 40

35.

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

36 / 40

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

37 / 40

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

38 / 40

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

39 / 40

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

40 / 40

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

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.