[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1.

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

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

2 / 40

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

3 / 40

3. Which of the following loop is not supported by the python programming language?

a) for loop

b) while loop

c) do…while loop

d) None of the above

4 / 40

4. You can also have an else without the elif

5 / 40

5. The elif keyword is pythons way of saying “if the previous conditions were not true, then try this condition”.

6 / 40

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

7 / 40

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

8 / 40

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

9 / 40

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

10 / 40

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

11 / 40

11. Which of the following is used to define a block of code in Python language?
a) Indentation
b) Key
c) Brackets
d) All of the mentioned

12 / 40

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

13 / 40

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

14 / 40

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

15 / 40

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

 

16 / 40

16. Python has syntax that allows developers to write programs with fewer lines than some other programming languages.

17 / 40

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

18 / 40

18. Arithmetic operators are used with numeric values to perform common mathematical operations

19 / 40

19.

 What is output of: 35 == 35.0

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

20 / 40

20.

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

a. 2

b. 3

c. 5

d. Multiple times

21 / 40

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

22 / 40

22. Python can connect to database systems.

23 / 40

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

24 / 40

24. Is there any comments in  following codes

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

 

25 / 40

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

26 / 40

26.

What will be the output of above Python code?

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

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

27 / 40

27.

 Select the correct example of complex datatype in Python

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

28 / 40

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

29 / 40

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

x = ['ab', 'cd']for i in x:    i.upper()print(x)

a) [‘ab’, ‘cd’]
b) [‘AB’, ‘CD’]
c) [None, None]
d) none of the mentioned

30 / 40

30. Python relies on indentation?

31 / 40

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

32 / 40

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

33 / 40

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

34 / 40

34. Python can be install on both  Linux and  Windows

35 / 40

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

36 / 40

36.

How to copy one list to another in python?

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

37 / 40

37.

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

38 / 40

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

39 / 40

39.

Which of the following statement is a function call?

a. call sum( )

b. def sum( )

c. sum( )

d. function sum( )

40 / 40

40. A variable name can only contain alpha-numeric characters and
underscores

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.