[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1. When does the else statement written after loop executes?

a) When loop condition becomes false

b) When break statement is executed in the loop

c) else statement is always executed

d) None of the above

2 / 40

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

3 / 40

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

4 / 40

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

5 / 40

5.

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

6 / 40

6. The format() method takes the passed arguments

7 / 40

7.

 ____________________ 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

8 / 40

8. Python can be install on both  Linux and  Windows

9 / 40

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

10 / 40

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

11 / 40

11.

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

12 / 40

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

13 / 40

13.

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

14 / 40

14.

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

15 / 40

15. A variable name cannot start with a number

16 / 40

16. What is another word for ‘iteration’ ?

a) Selection

b) Assignment

c) Sequencing

d) Repetition

17 / 40

17. Comments can be used to explain Python code.

18 / 40

18. Comments starts with a #

19 / 40

19. Python is a  high-level programming language.

20 / 40

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

21 / 40

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

22 / 40

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

23 / 40

23.

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.

24 / 40

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

25 / 40

25. Python has various versions available

26 / 40

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

27 / 40

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

28 / 40

28.

What will be the output of below Python code?

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

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

29 / 40

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

30 / 40

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

31 / 40

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

32 / 40

32.

What will the below Python code will return?

If str1="save paper,save plants"str1.find("save")

A. It returns the first index position of the first occurance of “save” in the given string str1.
B. It returns the last index position of the last occurance of “save” in the given string str1.
C. It returns the last index position of the first occurance of “save” in the given string str1.
D. It returns the first index position of the first occurance of “save” in the given string str1.

33 / 40

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

34 / 40

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

35 / 40

35.

Which is the correct operator for power(xy)?

  1. X^y
  2. X**y
  3. X^^y
  4. None of the mentioned

36 / 40

36.

The most important object defined in NumPy is an N-dimensional array type called?

A. ndarray
B. narray
C. nd_array
D. darray

37 / 40

37.

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

38 / 40

38.

 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.

39 / 40

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

40 / 40

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

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.