[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

1. Extension of all Python  Programme are .py

2 / 40

2.

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

3 / 40

3. With the for loop we can execute a set of statements

4 / 40

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

5 / 40

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

6 / 40

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

7 / 40

7.

Which function overloads the >> operator?

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

8 / 40

8. A variable name can only contain alpha-numeric characters and
underscores

9 / 40

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

10 / 40

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

11 / 40

11. Python can be install on both  Linux and  Windows

12 / 40

12. Can we write if/else into one line in python?

a) Yes
b) No
c) if/else not used in python
d) None of the above

13 / 40

13. X wants to allow the program to repeatedly ask the user to enter their Choice if it does not equal the Answer. Which loop option should X use?

a) while Choice == Answer:

Choice = input()

b) while Choice != Answer:

Choice = input()

c) while Answer != Choice:

Choice = input()

d) while Answer =! Choice:

Choice = input()

 

14 / 40

14.

Write the output of the following code :

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

a. Weacome

b. Error

c. aWelcome

d. Welcomea

15 / 40

15. An array can hold many values under a single name

16 / 40

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

17 / 40

17.

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

18 / 40

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

19 / 40

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

20 / 40

20. Which of the following is used to define a block of code in Python language?
a) Indentation
b) Key
c) Brackets
d) All of the mentioned

21 / 40

21.

Which one of the following is the correct extension of the Python file?

  1. .py
  2. .python
  3. .p
  4. None of these

22 / 40

22.

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

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

23 / 40

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

24 / 40

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

25 / 40

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

26 / 40

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

27 / 40

27. Arrays are used to store multiple values in one single variable.

28 / 40

28. Snake Case
Each word is separated by an underscore character:

29 / 40

29.

 What is output of: 35 == 35.0

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

30 / 40

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

31 / 40

31.

def cal(n1) : What is n1?

a. Parameter

b. Argument

c. Keyword

d. None of the above

32 / 40

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

33 / 40

33. You can also have multiple else statements on the same line:

34 / 40

34.

 Select the correct example of complex datatype in Python

  1. 3 + 2j
  2. -100j
  3. 5j
  4. All of the above are correct

35 / 40

35. Python can connect to database systems.

36 / 40

36. Python will give you an error if you skip the indentation

37 / 40

37. Python is a  high-level programming language.

38 / 40

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

39 / 40

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

40 / 40

40.

What will be the output of above Python code?

str1="6/4"print("str1")

A. 1
B. 6/4
C. 1.5
D. str1

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.