[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1. Variables that are created outside of a function

2 / 40

2.

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

3 / 40

3. Comments starts with a #

4 / 40

4. You can also have an else without the elif

5 / 40

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

6 / 40

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

7 / 40

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

8 / 40

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

9 / 40

9.

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

a. 2

b. 3

c. 5

d. Multiple times

10 / 40

10.

def cal(n1) : What is n1?

a. Parameter

b. Argument

c. Keyword

d. None of the above

11 / 40

11.

How to copy one list to another in python?

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

12 / 40

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

13 / 40

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

a) for

b) while

c) Both (a) and (b)

d) None of the above

14 / 40

14. Python can be used to handle big data and perform complex mathematics.

15 / 40

15.

What is the value of the expression 100 / 25?

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

16 / 40

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

17 / 40

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

18 / 40

18. A variable name cannot start with a number

19 / 40

19. Most recent major version of Python is Python 3

20 / 40

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

21 / 40

21. You can have if statements inside if statements, this is called nested if statements.

22 / 40

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

23 / 40

23.

 What is output of: 35 == 35.0

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

24 / 40

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

25 / 40

25.

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

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

26 / 40

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

27 / 40

27. The format() method takes unlimited number of arguments

28 / 40

28. Python can be install on both  Linux and  Windows

29 / 40

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

30 / 40

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

31 / 40

31.

Write the output of the following code :

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

a. Weacome

b. Error

c. aWelcome

d. Welcomea

32 / 40

32. python has two primitive loop commands:

  • while loops
  • for loops

33 / 40

33.

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

a. Define

b. DEF

c. def

d. Def

34 / 40

34. Python is an interpreted programming language

35 / 40

35.

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

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

36 / 40

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

37 / 40

37.

Python considered the character enclosed in triple quotes as String.(T/F)

a. True

b. False

38 / 40

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

39 / 40

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

40 / 40

40. Is there any comments in  following codes

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

 

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.