[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 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

2 / 40

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

3 / 40

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

4 / 40

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

5 / 40

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

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. You can also have multiple else statements on the same line:

8 / 40

8. Most recent major version of Python is Python 3

9 / 40

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

10 / 40

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

11 / 40

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

12 / 40

12.

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

a. True

b. False

13 / 40

13. Python has syntax that allows developers to write programs with fewer lines than some other programming languages.

14 / 40

14.

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

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

15 / 40

15. Is there any comments in  following codes

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

 

16 / 40

16. python has two primitive loop commands:

  • while loops
  • for loops

17 / 40

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

18 / 40

18. Which of the following is the correct extension of the Python file?

19 / 40

19.

 What is output of: 35 == 35.0

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

20 / 40

20. Python can be install on both  Linux and  Windows

21 / 40

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

22 / 40

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

23 / 40

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

24 / 40

24. An array is a special variable, which can hold more than one value at a time

25 / 40

25. Variable names are case-sensitive

26 / 40

26.

Write the output of the following code :

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

a. Weacome

b. Error

c. aWelcome

d. Welcomea

27 / 40

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

28 / 40

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

29 / 40

29. print() function is often used to output variables.

30 / 40

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

31 / 40

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

a) for

b) while

c) Both (a) and (b)

d) None of the above

32 / 40

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

33 / 40

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

34 / 40

34.

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

35 / 40

35.

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

36 / 40

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

37 / 40

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

38 / 40

38. Comments starts with a #

39 / 40

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

40 / 40

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

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.