[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1.

Which of the following statement is a function call?

a. call sum( )

b. def sum( )

c. sum( )

d. function sum( )

2 / 40

2. Extension of all Python  Programme are .py

3 / 40

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

4 / 40

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

5 / 40

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

6 / 40

6.

 ____________________ 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

7 / 40

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

8 / 40

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

9 / 40

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

10 / 40

10. A loop block in python starts with a –

a) ; (semicolon)

b) , (comma)

c) : (colon)

d) # (hash)

11 / 40

11.

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

12 / 40

12.

What will be the output of below Python code?

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

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

13 / 40

13. The for loop in Python is an _____________

a) Entry Controlled Loop

b) Exit Controlled Loop

c) Both of the above

d) None of the above

14 / 40

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

15 / 40

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

16 / 40

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

17 / 40

17. Pip is  not a powerful package management system for Python software packages

18 / 40

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

19 / 40

19. Is there any comments in  following codes

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

 

20 / 40

20. Comments can be used to explain Python code.

21 / 40

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

22 / 40

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

a) for

b) while

c) Both (a) and (b)

d) None of the above

23 / 40

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

24 / 40

24.

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

a. [ ]

b. { }

c. ( )

d. None of the above

25 / 40

25.

Which of the following creates a tuple?

A. tuple1=(“a”,”b”)
B. tuple1[2]=(“a”,”b”)
C. tuple1=(5)*2
D. None of the above

26 / 40

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

27 / 40

27. Variable names are case-sensitive

28 / 40

28. Most recent major version of Python is Python 3

29 / 40

29.

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

30 / 40

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

31 / 40

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

32 / 40

32. Variables that are created outside of a function

33 / 40

33. What will be the output of the following Python code?

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

a) 1 2
b) 1 2 3
c) error
d) none of the mentioned

34 / 40

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

35 / 40

35. Comments starts with a #

36 / 40

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

37 / 40

37. What will be the output of the following Python code?

x = ['ab', 'cd']for i in x:    i.upper()print(x)

a) [‘ab’, ‘cd’]
b) [‘AB’, ‘CD’]
c) [None, None]
d) none of the mentioned

38 / 40

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

39 / 40

39. You can also have an else without the elif

40 / 40

40.

Which function overloads the >> operator?

  1. more()
  2. gt()
  3. ge()
  4. None of the above

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.