[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

2. With the break statement we can stop the loop before it has looped through all the items

3 / 40

3. A variable name cannot start with a number

4 / 40

4. Python can be used to handle big data and perform complex mathematics.

5 / 40

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

6 / 40

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

7 / 40

7.

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

8 / 40

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

9 / 40

9.

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

10 / 40

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

11 / 40

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

12 / 40

12.

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

13 / 40

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

14 / 40

14. The format() method takes the passed arguments

15 / 40

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

a) for

b) while

c) Both (a) and (b)

d) None of the above

16 / 40

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

17 / 40

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

18 / 40

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

19 / 40

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

20 / 40

20. Python has various versions available

21 / 40

21.

Choose the correct option with respect to Python.

A. Both tuples and lists are immutable.
B. Tuples are immutable while lists are mutable.
C. Both tuples and lists are mutable.
D. Tuples are mutable while lists are immutable.

22 / 40

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

23 / 40

23.

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

24 / 40

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

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

a) 1 2
b) 1 2 3
c) error
d) none of the mentioned

25 / 40

25.

What is the value of the expression 100 / 25?

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

26 / 40

26.

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

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

27 / 40

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

28 / 40

28. An array can hold many values under a single name

29 / 40

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

30 / 40

30.

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

a. [ ]

b. { }

c. ( )

d. None of the above

31 / 40

31. Find and write the output of the following python code:

x = “abcdef”

i = “a”

while i in x:

print(i, end = ” “)

a) a

b) a a a a a a

c) a a a a a a … infinite times

d) Code will generate error

32 / 40

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

33 / 40

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

34 / 40

34.

Which function overloads the >> operator?

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

35 / 40

35.

Write the output of the following code :

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

a. Weacome

b. Error

c. aWelcome

d. Welcomea

36 / 40

36. print() function is often used to output variables.

37 / 40

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

38 / 40

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

39 / 40

39. Python is an interpreted programming language

40 / 40

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

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.