[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

2. Most recent major version of Python is Python 3

3 / 40

3. Comments starts with a #

4 / 40

4.

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.

5 / 40

5.

How to copy one list to another in python?

A. l1[] = l2[]
B. l1[] = l2
C. l1[] = l2[:]
D. l1 = l2

6 / 40

6. Variable names are case-sensitive

7 / 40

7.

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

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

8 / 40

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

9 / 40

9. You can also have an else without the elif

10 / 40

10.

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

a. [ ]

b. { }

c. ( )

d. None of the above

11 / 40

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

12 / 40

12. Comments can be used to explain Python code.

13 / 40

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

14 / 40

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

15 / 40

15.

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

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

16 / 40

16.

What is the data type of print(type(0xFF))

17 / 40

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

18 / 40

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

19 / 40

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

20 / 40

20. Variables that are created outside of a function

21 / 40

21.

What is the value of the expression 100 / 25?

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

22 / 40

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

23 / 40

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

24 / 40

24. Identity operators are used to compare the objects, not if they are equal, but if they are actually the same object, with the same memory location

25 / 40

25. Comparison operators are not  used to compare two values

26 / 40

26.

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

27 / 40

27. Pip is  not a powerful package management system for Python software packages

28 / 40

28.

Following is an example of ___________________

sv = “csiplearninghub.com”

a. List

b. String

c. Dictionary

d. None of the above

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 has syntax that allows developers to write programs with fewer lines than some other programming languages.

31 / 40

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

32 / 40

32.

What will be the output of below Python code?

tupl=([2,3],"abc",0,9)tupl[0][1]=1print(tupl)A. ([2,3],"abc",0,9)B. ([1,3],"abc",0,9)C. ([2,1],"abc",0,9)D. Error

33 / 40

33.

 Select the correct example of complex datatype in Python

  1. 3 + 2j
  2. -100j
  3. 5j
  4. All of the above are correct

34 / 40

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

35 / 40

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

36 / 40

36.

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.

37 / 40

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

38 / 40

38.

What will be the output of above Python code?

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

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

39 / 40

39.

Which of the following statement is a function call?

a. call sum( )

b. def sum( )

c. sum( )

d. function sum( )

40 / 40

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

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.