[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1.

Which of the following statements assigns the value 25 to the variable x in Python:

  1. x ← 25
  2. x = 25
  3. x := 25
  4. int x = 25
  5. x << 25

2 / 40

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

3 / 40

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

4 / 40

4. Python is a  high-level programming language.

5 / 40

5. Which of the following character is used to give single-line comments in Python?
a) //
b) #
c) !
d) /*

6 / 40

6.

In the Python statement x = a + 5 – b:

a and b are ________a + 5 - b is ________
  1. terms, a group
  2. operators, a statement
  3. operands, an expression
  4. operands, an equation

7 / 40

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

8 / 40

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

9 / 40

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

10 / 40

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

11 / 40

11. Python has various versions available

12 / 40

12. Variables that are created outside of a function

13 / 40

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

14 / 40

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

15 / 40

15. Variable names are case-sensitive

16 / 40

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

17 / 40

17.

 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.

18 / 40

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

19 / 40

19. Which of the following is the use of function in python?
a) Functions are reusable pieces of programs
b) Functions don’t provide better modularity for your application
c) you can’t also create your own functions
d) All of the mentioned

20 / 40

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

21 / 40

21.

Write the output of the following code :

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

a. Weacome

b. Error

c. aWelcome

d. Welcomea

22 / 40

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

23 / 40

23.

Which function overloads the >> operator?

  1. more()
  2. gt()
  3. ge()
  4. None of the above

24 / 40

24. The format() method takes the passed arguments

25 / 40

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

26 / 40

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

  1. d = {"john":40, "peter":45}
  2. d["john"]

a) 40
b) 45
c) “john”
d) “peter”

27 / 40

27. You can also have an else without the elif

28 / 40

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

 

29 / 40

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

30 / 40

30. Official site of python is www.python.org

31 / 40

31.

What is the value of the expression 100 / 25?

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

32 / 40

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

33 / 40

33.

Which statement is correct?

A. List is immutable && Tuple is mutable
B. List is mutable && Tuple is immutable
C. Both are Mutable.
D. Both are Immutable

34 / 40

34.

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

35 / 40

35.

 What is output of: 35 == 35.0

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

36 / 40

36.

l = [ 4, 8, 9, 2.6, 5 ] is a type of which data type in python?

  1. List
  2. Tuple
  3. Set
  4. None of these

37 / 40

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

38 / 40

38. Python can be install on both  Linux and  Windows

39 / 40

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

40 / 40

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

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.