Comprehensive Python and Data Science Concepts for Students

0.0(0)
studied byStudied by 1 person
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/142

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

143 Terms

1
New cards

What has happened to the volume of global data over time?

Increased exponentially

2
New cards

Which field of computer science simulates human conversation?

Artificial Intelligence

3
New cards

What percentage increase in data science jobs is predicted by the U.S. Bureau of Labor Statistics by 2030?

30%

4
New cards

What type of data includes texts, images, or videos?

Unstructured data

5
New cards

What job role mainly focuses on analyzing and interpreting data?

Data analyst

6
New cards

Which professional develops websites?

Computer scientist

7
New cards

What type of bias occurs when the training data does not represent all groups equally?

Algorithmic bias

8
New cards

What scenario best describes algorithmic bias?

A model that accepts or rejects applications where males are more likely to apply.

9
New cards

What do data centers consume a lot of that contributes to carbon emissions?

Energy

10
New cards

What is a sequence of instructions that solves a problem called?

Algorithm

11
New cards

What translates high-level language into machine instructions?

Compiler

12
New cards

Which program can create Python code directly runnable by the interpreter?

IDLE Editor

13
New cards

What manages programs and interfaces with peripherals?

Operating system

14
New cards

What does 'dynamic typing' mean in Python?

Variable types are assigned automatically at runtime.

15
New cards

In which year did Python begin development?

1980

16
New cards

What is true about Python?

Python is free to use; developers don't usually pay a fee.

17
New cards

What symbol can be used in a Python identifier?

Underscore (_)

18
New cards

What does 'keyword' mean in Python?

A reserved word that cannot be used as a variable name.

19
New cards

What is dividing by zero an example of?

Logic error

20
New cards

Which error type does not stop program execution?

Logic error

21
New cards

What is the name of the process for removing errors from code?

Debugging

22
New cards

What type of error occurs when a variable name is used incorrectly?

NameError

23
New cards

What command is used to intentionally pause execution during development?

raise NotImplementedError

24
New cards

What keyword ends a loop early when a condition is met?

break

25
New cards

What keyword skips to the next iteration of a loop?

continue

26
New cards

Which statement keeps executing as long as the condition is true?

while loop

27
New cards

What is an essential feature of a while loop?

The loop expression must change within the loop body.

28
New cards

How many times will for i in range(1, 3): run?

2

29
New cards

How many times does while i <= 100: i = i + 2 iterate?

51

30
New cards

What output does for i in range(2): for j in range(3): print(i,j) produce?

0 0, 0 1, 0 2, 1 0, 1 1, 1 2

31
New cards

Which loop structure is best for unknown repetition?

while loop

32
New cards

Which is best for a known range of repetition?

for loop

33
New cards

Which keyword defines a function?

def

34
New cards

What is the value returned by def calc(a,b): return 1+a+b called as calc(4,5)?

10

35
New cards

Which of the following is not a valid function stub?

Leaving the function body empty

36
New cards

What is the purpose of function stubs?

Helps with incremental programming and testing

37
New cards

What happens when a function finishes execution?

Control returns to the calling line.

38
New cards

What is a variable that stores a function's output called?

Return value

39
New cards

What is the special variable __main__ used for?

Indicates whether a script is being run directly or imported.

40
New cards

What is scope resolution in Python?

The process of searching namespaces for variable definitions.

41
New cards

What does my_list = [1,2,3,4]; my_list[0:-1:3] return?

[1, 4]

42
New cards

What is the output of 'Python'[0:3]?

Pyt

43
New cards

What does .sort() do to a list?

Modifies the list in place by sorting it.

44
New cards

What does sorted() return?

A new sorted list, leaving the original unchanged.

45
New cards

What will all([0,1,2]) return?

False

46
New cards

What is the result of [i**2 for i in [1,2,3,4]]?

[1, 4, 9, 16]

47
New cards

What is slicing?

Extracting a portion of a list or string using index notation.

48
New cards

What is the output of 'Berlin is the capital of Germany'[-18:]?

'capital of Germany'

49
New cards

What is NumPy used for?

Numerical computations and arrays

50
New cards

What is Pandas used for?

Data manipulation and analysis

51
New cards

What is Matplotlib used for?

Plotting and data visualization

52
New cards

What does np.transpose(arr) do?

Flips rows and columns in a NumPy array

53
New cards

What does dat.iloc[1:3, 0:2] select?

Rows 1-2 and columns 0-1 from a DataFrame

54
New cards

What does plt.scatter(x, y) do?

Creates a scatter plot

55
New cards

What does plt.plot(xx, 4*xx - 3) show?

A linear relationship between x and y

56
New cards

What command sets x-axis label?

plt.xlabel('Label')

57
New cards

What command sets a plot title?

plt.title('My Plot')

58
New cards

How do you access a value safely in a dictionary?

dict.get(key, default)

59
New cards

What is a dictionary comprehension example?

{x: x*x for x in range(5)}

60
New cards

What does mydict['third'] = 5 do?

Updates the key 'third' with value 5

61
New cards

What are curly braces {} used for?

To define a set or dictionary

62
New cards

What does {'yellow', 'red', 'green'} represent?

A set

63
New cards

What is the command to execute an SQL query in Python?

dbCursor.execute(query, data)

64
New cards

Which method retrieves all rows of the result set?

.fetchall()

65
New cards

What must be done after database operations?

Close the cursor using .close()

66
New cards

What does dataframe.insert() do in pandas?

Inserts a new column into a DataFrame

67
New cards

What is the output of not(x) and (y == a)?

True only when x is False and y equals a

68
New cards

What is a ternary operator in Python?

a = b if condition else c

69
New cards

What does % do in Python?

Returns the remainder of a division

70
New cards

What does // do?

Integer division

71
New cards

What is an example of operator precedence?

Multiplication before addition

72
New cards

What does this code output? i = 5; while i < 10: print(i); i += 1

Prints 5 6 7 8 9

73
New cards

What does this code output? x = 18; while x % 3 == 0: print(x, end=' '); x = x // 3

18 6 2

74
New cards

What's the purpose of break in a loop?

Immediately exits the current loop

75
New cards

What's the purpose of continue in a loop?

Skips the remaining body and proceeds to the next iteration

76
New cards

What does while i <= 6: x += i; i += 2 do?

Adds every other number (1, 3, 5) until 6

77
New cards

What does this output? for j in range(2): for k in range(4): if k == 2: break; print(f'{j}{k}', end=' ')

00 01 10 11

78
New cards

How do nested loops behave?

Inner loops complete all iterations for each outer loop iteration

79
New cards

What's the output? num = 10; while num <= 15: print(num, end=' '); if num == 12: break; num += 1

10 11 12

80
New cards

What happens if a while loop never changes its condition variable?

Infinite loop

81
New cards

What does this output? count = 0; while count < 3: print('loop'); count += 1; print(count)

Prints 'loop' 3 times and final value 3

82
New cards

What is the effect of indentation in Python loops?

Determines the scope of loop body — incorrect indentation causes IndentationError.

83
New cards

What does math.pow(2, 3) return?

8.0

84
New cards

What does math.sqrt(16) return?

4.0

85
New cards

What does math.ceil(0.3) return?

1

86
New cards

What's the result of round(4.6)?

5

87
New cards

Which module is used for random number generation?

random

88
New cards

What does random.randrange(7) do?

Returns a random integer between 0-6

89
New cards

What's the result of abs(-7)?

7

90
New cards

What does max(3, 5, 2) return?

5

91
New cards

What does min(3, 5, 2) return?

2

92
New cards

Which operator gives the remainder of a division?

%

93
New cards

What does // do?

Performs floor (integer) division

94
New cards

What's the operator for exponentiation?

**

95
New cards

What's the output of 2 * 3 * 2?

512 because it's right-associative: 2^(3^2)

96
New cards

Which library must be imported before using math.pow()?

import math

97
New cards

What does this output? def calc_square(x): return x * x; print(calc_square(calc_square(2)))

16

98
New cards

What is the output of print_shipping_charge(18) if defined with (item_weight * 0.95) for 15-20 range?

17.1

99
New cards

What is the output of print_shipping_charge(6) given the 0-10 range formula (item_weight * 0.75)?

4.5

100
New cards

What is the output of print_shipping_charge(25)?

Nothing printed — no matching elif condition