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

3 / 40

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

4 / 40

4. python file can also run on command line

5 / 40

5.

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

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

6 / 40

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

7 / 40

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

8 / 40

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

9 / 40

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

10 / 40

10.

Which of the following statement is a function call?

a. call sum( )

b. def sum( )

c. sum( )

d. function sum( )

11 / 40

11. Comments can be used to explain Python code.

12 / 40

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

13 / 40

13. Python relies on indentation?

14 / 40

14. Indentation refers to the spaces at the beginning of a code line.

15 / 40

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

16 / 40

16.

What will be the output of below Python code?

str1="Information"print(str1[2:8])

A. format
B. formatio
C. orma
D. ormat

17 / 40

17. Who developed Python Programming Language?

18 / 40

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

a) for

b) while

c) Both (a) and (b)

d) None of the above

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. Pascal Case
Each word starts with a capital letter:

21 / 40

21. Python is a  high-level programming language.

22 / 40

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

23 / 40

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

24 / 40

24. Comments can’t be used to prevent execution when testing code.

25 / 40

25.

def cal(n1) : What is n1?

a. Parameter

b. Argument

c. Keyword

d. None of the above

26 / 40

26. Variable names are case-sensitive

27 / 40

27.

 What is output of: 35 == 35.0

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

28 / 40

28.

 Which of the following statement is False?

  1. Variable names can be arbitrarily long.
  2. They can contain both letters and numbers.
  3. Variable name can begin with underscore.
  4. Variable name can begin with number.

29 / 40

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

30 / 40

30. Python can be used on a server to create web applications?

31 / 40

31. Snake Case
Each word is separated by an underscore character:

32 / 40

32.

Which keyword is used to begin the definition of a function?

a. Define

b. DEF

c. def

d. Def

33 / 40

33. Python has a set of built-in methods that you can use on lists/arrays

34 / 40

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

35 / 40

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

36 / 40

36.

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

37 / 40

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

38 / 40

38.

How to copy one list to another in python?

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

39 / 40

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

40 / 40

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

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.