Data Structures : DPP 01 Discussion Notes.pdf

abhi218000a 9 views 12 slides Aug 28, 2024
Slide 1
Slide 1 of 12
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12

About This Presentation

Data notes


Slide Content

By- Astha Ma’amDPP No.- 6
DATA
SCIENCE & AI
Data Structures
DPP 01 Discussion
Notes
Python-For Data Science

#Q. What will be the output of the following code snippet?
a = 5
b = 2
print(a / b)
[MCQ]
2.5 2
2.0 2.5 with type float
A B
C D

#Q. What is the output of the following code?
x = 5
y = 3
if x > y:
print("x is greater than y")
else:
print("x is less than or equal to y")
[MCQ]
x is greater than y x is less than y
x is less than or equal to y x is greater than or equal to y
A B
C D

#Q. What will be the output of the following code snippet?
my_list = [1, 2, 3, 4, 5]
print(my_list[2:4])
[MCQ]
[2, 3]
[3, 4]
[1, 2, 3]
[3, 4, 5]
A
B
C
D

#Q. What is the correct way to define a function in Python?
[MCQ]
def function_name(parameter1, parameter2):
function_name(parameter1, parameter2) def:
function_name def(parameter1, parameter2):
def(parameter1, parameter2) function_name:
A
B
C
D

#Q. Which of the following is a correct way to call the function my_function with
two arguments in Python?
[MCQ]
call my_function(argument1, argument2)
my_function(argument1, argument2)
call my_function: argument1, argument2
my_function: argument1, argument2
A
B
C
D

#Q. What will be the output of the following code?
def my_function(x):
return x * 2
result = my_function(3) + my_function(4)
print(result)
[MCQ]
14 11
10 12
A B
C D

#Q. Which of the following statements is true about Python tuples?
[MCQ]
Tuples are mutable.
Tuples can contain elements of different data types.
Tuples use square brackets to enclose elements.
Tuples support item assignment.
A
B
C
D

#Q. What is the output of the following code?
def my_function(x):
return x + 1
result = my_function(5)
print(result)
[MCQ]
5 6
7 Error
A B
C D

#Q. Which statement about Python sets is correct?
[MCQ]
Sets maintain the order of elements.
Sets allow duplicate elements.
Sets are created using curly braces {}.
Sets are indexed data structures.
A
B
C
D

#Q. What will be the output of the following code?
a = 10
def my_function():
print(a)
my_function()
[MCQ]
10 Error
None No output
A B
C D

THANK - YOU
Tags