[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

2.

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

a. True

b. False

3 / 40

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

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. Comments can’t be used to prevent execution when testing code.

6 / 40

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

7 / 40

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

8 / 40

8.

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

9 / 40

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

10 / 40

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

11 / 40

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

12 / 40

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

13 / 40

13. The length of an array is always one more than the highest array index.

14 / 40

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

15 / 40

15. Most recent major version of Python is Python 3

16 / 40

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

17 / 40

17.

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

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

18 / 40

18.

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

19 / 40

19.

What will be the output of below Python code?

str1="Information"print(str1[2:8])

A. format
B. formatio
C. orma
D. ormat

20 / 40

20.

In a program, a function can be called ____________ times.

a. 2

b. 3

c. 5

d. Multiple times

21 / 40

21. What is the index value of ‘i’ in string “Learning”

a. 5

b. 3

c. 6

d. 7

22 / 40

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

23 / 40

23.

Following is an example of ___________________

sv = “csiplearninghub.com”

a. List

b. String

c. Dictionary

d. None of the above

24 / 40

24.

 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.

25 / 40

25. Comments starts with a #

26 / 40

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

27 / 40

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

28 / 40

28. 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”

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. You can return a range of characters by using the slice syntax

31 / 40

31. Find the output of the given Python program?

a = 25if a < 15:    print("Hi")if a <= 30:    print("Hello")else:    print("Know Program")

a) Hi
b) Hello
c) Know Program
d) Compiled Successfully, No Output.

32 / 40

32.

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

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

33 / 40

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

34 / 40

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

35 / 40

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

36 / 40

36. Find the output of the following program segments:

for i in range(20,30,2):

print(i)

a) 20 22 24 26 28

b) 20

22

24

26

28

c) 20 22 24 26 28 30

d) 20

22

24

26

28

30

37 / 40

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

38 / 40

38. Comparison operators are not  used to compare two values

39 / 40

39. Comments can be used to explain Python code.

40 / 40

40. You have to use the same number of spaces in the same block of code, otherwise Python will give you an error

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.