[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

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

3 / 40

3. A variable name must start with a letter or the underscore character

4 / 40

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

5 / 40

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

6 / 40

6.

 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.

7 / 40

7. python file can also run on command line

8 / 40

8. Who developed Python Programming Language?

9 / 40

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

10 / 40

10.

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

11 / 40

11.

What will be the output of above Python code?

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

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

12 / 40

12.

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

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

13 / 40

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

14 / 40

14. Comments starts with a #

15 / 40

15. A loop block in python starts with a –

a) ; (semicolon)

b) , (comma)

c) : (colon)

d) # (hash)

16 / 40

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

17 / 40

17.

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

18 / 40

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

19 / 40

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

20 / 40

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

21 / 40

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

22 / 40

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

23 / 40

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

24 / 40

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

25 / 40

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

26 / 40

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

27 / 40

27.

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.

28 / 40

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

29 / 40

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

30 / 40

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

31 / 40

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

32 / 40

32. Arrays are used to store multiple values in one single variable.

33 / 40

33. Can we write if/else into one line in python?

a) Yes
b) No
c) if/else not used in python
d) None of the above

34 / 40

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

35 / 40

35.

What is the value of the expression 100 / 25?

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

36 / 40

36. All keywords in Python are in _________
a) Capitalized
b) lower case
c) UPPER CASE
d) None of the mentioned

37 / 40

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

38 / 40

38. Which of the following is False regarding loops in Python?

a)Loops are used to perform certain tasks repeatedly.

b) while loop is used when multiple statements are to executed repeatedly until the given condition becomes true.

c) while loop is used when multiple statements are to executed repeatedly until the given condition becomes false.

d) for loop can be used to iterate through the elements of lists.

39 / 40

39. You can also have an else without the elif

40 / 40

40. Which of the following is a Python tuple?
a) [1, 2, 3]
b) (1, 2, 3)
c) {1, 2, 3}
d) {}

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.