[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1.

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.

2 / 40

2.

Which of the following statement will execute in last?

def s(n1): #Statement 1      print(n1) #Statement 2n2=4 #Statement 3s(n2) #Statement 4

a. Statement 1

b. Statement 2

c. Statement 3

d. Statement 4

3 / 40

3.

 ____________________ 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

4 / 40

4.

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

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

5 / 40

5.

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

a. 2

b. 3

c. 5

d. Multiple times

6 / 40

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

7 / 40

7. Bitwise operators are used to compare (binary) numbers

8 / 40

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

9 / 40

9. You can return a range of characters by using the slice syntax

10 / 40

10.

Write the output of the following code :

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

a. Weacome

b. Error

c. aWelcome

d. Welcomea

11 / 40

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

12 / 40

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

13 / 40

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

14 / 40

14. The else keyword catches anything which isn’t caught by the preceding conditions.

15 / 40

15. Comments starts with a #

16 / 40

16.

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.

17 / 40

17. Python relies on indentation?

18 / 40

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

19 / 40

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

20 / 40

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

21 / 40

21.

What will be the output of below Python code?

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

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

22 / 40

22. python file can also run on command line

23 / 40

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

24 / 40

24. We can combine strings and numbers by using the format() method

25 / 40

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

26 / 40

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

27 / 40

27. Is there any comments in  following codes

i = 1while True:    if i%3 == 0:        break    print(i)     i + = 1

 

28 / 40

28. You can use three double quotes only:

a = “””Lorem ipsum dolor sit amet,
consectetur adipiscing elit,
sed do eiusmod tempor incididunt
ut labore et dolore magna aliqua.”””
print(a)

29 / 40

29.

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

a. Define

b. DEF

c. def

d. Def

30 / 40

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

a. 5

b. 3

c. 6

d. 7

31 / 40

31.

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

32 / 40

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

33 / 40

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

34 / 40

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

35 / 40

35. A variable name cannot start with a number

36 / 40

36. You can also use the remove() method to remove an element from the array

37 / 40

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

38 / 40

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

39 / 40

39. Python is an interpreted programming language

40 / 40

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

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.