[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. A variable name cannot start with a number

3 / 40

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

4 / 40

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

5 / 40

5. With the break statement we can stop the loop even if the while condition is true

6 / 40

6.

 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.

7 / 40

7. Comparison operators are not  used to compare two values

8 / 40

8.

What is the data type of print(type(10))

9 / 40

9.

What will be the output of below Python code?

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

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

10 / 40

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

11 / 40

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

12 / 40

12. Camel Case
Each word, except the first, starts with a capital letter:

13 / 40

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

14 / 40

14.

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

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

15 / 40

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

16 / 40

16.  ________ in Python is a counter-controlled loop.

a) for

b) while

c) Both (a) and (b)

d) None of the above

17 / 40

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

18 / 40

18. Python has various versions available

19 / 40

19.

Write the output of the following code :

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

a. Weacome

b. Error

c. aWelcome

d. Welcomea

20 / 40

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

21 / 40

21. What is the output of the given below program?

if 3 + 4 == 7:    print("Hi")else:    print("Know Program")print("Hello")

a) Hi
b) Know Program

c)
Hi
Hello

d)
Know Program
Hello

22 / 40

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

23 / 40

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

24 / 40

24.

Which is the correct operator for power(xy)?

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

25 / 40

25.

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.

26 / 40

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

27 / 40

27. A variable name can only contain alpha-numeric characters and
underscores

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.

What is the value of the expression 100 / 25?

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

30 / 40

30.

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

31 / 40

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

32 / 40

32.

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

a. Define

b. DEF

c. def

d. Def

33 / 40

33. Most recent major version of Python is Python 3

34 / 40

34.

How to copy one list to another in python?

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

35 / 40

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

36 / 40

36.

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

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

37 / 40

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

38 / 40

38.

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

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

39 / 40

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

40 / 40

40.

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

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.