[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1.

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

a. 2

b. 3

c. 5

d. Multiple times

2 / 40

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

3 / 40

3.

How to copy one list to another in python?

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

4 / 40

4. Python is a  high-level programming language.

5 / 40

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

6 / 40

6. Which keyword is used for function?
a) Fun
b) Define
c) Def
d) Function

7 / 40

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

8 / 40

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

9 / 40

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

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.

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

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

12 / 40

12.

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

13 / 40

13. python has two primitive loop commands:

  • while loops
  • for loops

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. Who developed Python Programming Language?

16 / 40

16.

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

a. Define

b. DEF

c. def

d. Def

17 / 40

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

18 / 40

18. The elif keyword is pythons way of saying “if the previous conditions were not true, then try this condition”.

19 / 40

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

20 / 40

20. A variable name cannot start with a number

21 / 40

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

22 / 40

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

23 / 40

23.

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

24 / 40

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

25 / 40

25. Python  was created by Guido van Rossum, and released in 1999.

26 / 40

26.

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

27 / 40

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

28 / 40

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

29 / 40

29. Variable names are case-sensitive

30 / 40

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

31 / 40

31. You can use the append() method to add an element to an array

32 / 40

32.

Write the output of the following code :

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

a. Weacome

b. Error

c. aWelcome

d. Welcomea

33 / 40

33. Operators are used to perform operations on variables and values

34 / 40

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

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

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

35 / 40

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

36 / 40

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

37 / 40

37.

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

a. [ ]

b. { }

c. ( )

d. None of the above

38 / 40

38. When does the else statement written after loop executes?

a) When loop condition becomes false

b) When break statement is executed in the loop

c) else statement is always executed

d) None of the above

39 / 40

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

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.