[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1.

Which one of the following is the correct extension of the Python file?

  1. .py
  2. .python
  3. .p
  4. None of these

2 / 40

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

3 / 40

3. python has two primitive loop commands:

  • while loops
  • for loops

4 / 40

4.

How to copy one list to another in python?

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

5 / 40

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

6 / 40

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

7 / 40

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

8 / 40

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

9 / 40

9.

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.

10 / 40

10.

What will be the output of below Python code?

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

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

11 / 40

11.

Which is the correct operator for power(xy)?

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

12 / 40

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

13 / 40

13.

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

14 / 40

14. The list’s remove() method only removes the first occurrence of the specified value.

15 / 40

15.

 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.

16 / 40

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

17 / 40

17.

Write the output of the following code :

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

a. Weacome

b. Error

c. aWelcome

d. Welcomea

18 / 40

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

19 / 40

19.

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

20 / 40

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

21 / 40

21. What keyword would you use to add an alternative condition to an if statement?

a) else if
b) elseif
c) elif
d) None of the above

22 / 40

22. Official site of python is www.python.org

23 / 40

23.

 What is output of: 35 == 35.0

  1. False
  2. True
  3. 33
  4. None of the above

24 / 40

24. An array is a special variable, which can hold more than one value at a time

25 / 40

25.

Which statement is correct?

A. List is immutable && Tuple is mutable
B. List is mutable && Tuple is immutable
C. Both are Mutable.
D. Both are Immutable

26 / 40

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

27 / 40

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

28 / 40

28.

Which keyword is used to begin the definition of a function?

a. Define

b. DEF

c. def

d. Def

29 / 40

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

30 / 40

30.

What will be the output of above Python code?

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

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

31 / 40

31.

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

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

32 / 40

32. Which of the following is False regarding loops in Python?

a)Loops are used to perform certain tasks repeatedly.

b) while loop is used when multiple statements are to executed repeatedly until the given condition becomes true.

c) while loop is used when multiple statements are to executed repeatedly until the given condition becomes false.

d) for loop can be used to iterate through the elements of lists.

33 / 40

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

34 / 40

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

35 / 40

35. Python can be install on both  Linux and  Windows

36 / 40

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

37 / 40

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

38 / 40

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

39 / 40

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

40 / 40

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

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.