[miniorange_social_sharing]
[TheChamp-Login]

/40

Final Exam for Python for Everyone (A to Z)

BEST OF LUCK!!!

1 / 40

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

2 / 40

2.

Following is an example of ___________________

sv = “csiplearninghub.com”

a. List

b. String

c. Dictionary

d. None of the above

3 / 40

3. Python can connect to database systems.

4 / 40

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

5 / 40

5.

Write the output of the following code :

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

a. Weacome

b. Error

c. aWelcome

d. Welcomea

6 / 40

6. python file can also run on command line

7 / 40

7.

What is the value of the expression 100 / 25?

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

8 / 40

8. Comments starts with a #

9 / 40

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

10 / 40

10.

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

11 / 40

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

12 / 40

12.

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

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

13 / 40

13.

What will the below Python code will return?

If str1="save paper,save plants"str1.find("save")

A. It returns the first index position of the first occurance of “save” in the given string str1.
B. It returns the last index position of the last occurance of “save” in the given string str1.
C. It returns the last index position of the first occurance of “save” in the given string str1.
D. It returns the first index position of the first occurance of “save” in the given string str1.

14 / 40

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

15 / 40

15.

 Select the correct example of complex datatype in Python

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

16 / 40

16. Comments can be used to explain Python code.

17 / 40

17.

 Which of the following statement is False?

  1. Variable names can be arbitrarily long.
  2. They can contain both letters and numbers.
  3. Variable name can begin with underscore.
  4. Variable name can begin with number.

18 / 40

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

19 / 40

19. You can also have an else without the elif

20 / 40

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

21 / 40

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

22 / 40

22. Comparison operators are not  used to compare two values

23 / 40

23.

Function defined to achieve some task as per the programmer’s requirement is called a ___________

a. user defined function

b. library function

c. built in functions

d. All of the above.

24 / 40

24.

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

25 / 40

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

26 / 40

26. A variable name cannot start with a number

27 / 40

27. The format() method takes the passed arguments

28 / 40

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

29 / 40

29. 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()

 

30 / 40

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

31 / 40

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

32 / 40

32. Python can be install on both  Linux and  Windows

33 / 40

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

34 / 40

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

35 / 40

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

36 / 40

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

37 / 40

37. Variables that are created outside of a function

38 / 40

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

39 / 40

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

40 / 40

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

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.