[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1. Variables that are created outside of a function

2 / 40

2. Python has various versions available

3 / 40

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

4 / 40

4.

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.

5 / 40

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

6 / 40

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

7 / 40

7. The len() method to return the length of an array

8 / 40

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

9 / 40

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

10 / 40

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

11 / 40

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

12 / 40

12. Comments can be used to explain Python code.

13 / 40

13.

Which of the following creates a tuple?

A. tuple1=(“a”,”b”)
B. tuple1[2]=(“a”,”b”)
C. tuple1=(5)*2
D. None of the above

14 / 40

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

15 / 40

15.

Which function overloads the >> operator?

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

16 / 40

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

17 / 40

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

18 / 40

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

19 / 40

19.

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

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

20 / 40

20. Is there any comments in  following codes

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

 

21 / 40

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

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.  ________ in Python is a counter-controlled loop.

a) for

b) while

c) Both (a) and (b)

d) None of the above

24 / 40

24. You can also have an else without the elif

25 / 40

25.

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

26 / 40

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

27 / 40

27.

 ____________________ can be defined as a named group of instructions that accomplish a specific task when it is invoked/called.

a. Function

b. Datatype

c. Token

d. Operator

28 / 40

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

29 / 40

29. Python  was created by Guido van Rossum, and released in 1999.

30 / 40

30. Python can be install on both  Linux and  Windows

31 / 40

31. Python is a  high-level programming language.

32 / 40

32. Python can be treated in a procedural way, an object-oriented way or a functional way.

33 / 40

33.

Python considered the character enclosed in triple quotes as String.(T/F)

a. True

b. False

34 / 40

34.

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

a. [ ]

b. { }

c. ( )

d. None of the above

35 / 40

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

36 / 40

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

37 / 40

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

38 / 40

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

39 / 40

39.

What will be the output of below Python code?

str1="poWer"str1.upper()print(str1)

A. POWER
B. Power
C. power
D. poWer

40 / 40

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

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.