Search Header Logo
Python

Python

Assessment

Presentation

•

Information Technology (IT)

•

10th Grade

•

Practice Problem

•

Hard

Created by

Deema Alluhayb

Used 2+ times

FREE Resource

328 Slides • 28 Questions

1

media

2

Multiple Choice

Why is mastering advanced Python concepts important for AI and machine learning development?

1

Because Python is the only language used in AI

2

To write clean, modular, and production-ready code for ML pipelines

3

Because Python is easy to learn

4

To avoid using other programming languages

3

media

4

Open Ended

How can applying clean coding principles benefit your work in AI projects?

5

media

6

Multiple Choice

Which of the following is NOT a reason why Python is popular for AI development?

1

Rich library ecosystem

2

Clean, readable syntax

3

Limited community support

4

Interactive development

7

media

8

Open Ended

What are the four main data types in Python, and give an example of each?

9

media

10

Multiple Select

Which of the following are common use cases for Python lists in AI?

1

Store feature vectors and embeddings

2

Hold training/test data splits

3

Store model predictions and labels

4

Store only string values

11

media

12

Fill in the Blank

In Python, the code 'for epoch in range(10): train_model()' is an example of a ___ loop.

13

media

14

Open Ended

How does list comprehension improve code efficiency compared to traditional for loops in Python?

15

media

16

Multiple Choice

Which string method would you use in Python to remove leading and trailing whitespace from a string?

1

lower()

2

strip()

3

split()

4

replace()

17

media

18

Multiple Choice

What are the main advantages of writing modular code as shown in the 'AFTER: Modular Function' example compared to the 'BEFORE: Repeated Code' example?

1

It reduces code duplication and bug risk.

2

It makes code harder to test.

3

It requires more lines of code.

4

It makes code less maintainable.

19

media

20

Open Ended

Describe how modular code and reusable utility functions (as seen in slides 0 and 1) contribute to easier testing and maintenance in software projects.

21

Multiple Choice

How do shared metric utilities, as described in the 'From Scripts to Reusable AI Utilities' slide, help in machine learning projects?

1

They make code less readable.

2

They reduce bugs when comparing different models.

3

They increase the need for repeated code.

4

They make it harder to document code.

22

media

23

media

24

Fill in the Blank

Fill in the blank: In Python, the keyword used to define a function is ___

25

media

26

Multiple Choice

Which of the following are best practices when defining function parameters in Python?

1

Put required parameters first, optional parameters with defaults last.

2

Always use only positional arguments.

3

Never use default values.

4

Put optional parameters first.

27

media

28

Open Ended

Explain how the use of *args and **kwargs can improve the flexibility of function signatures in Python. Provide an example scenario where this would be beneficial.

29

media

30

Multiple Choice

Which of the following is NOT a recommended way to return results from a function in Python, as shown in the image?

1

Returning a single value

2

Returning multiple values as a tuple

3

Returning a dictionary with named results

4

Returning results using print statements

31

media

32

Fill in the Blank

Fill in the blank: According to the LEGB rule, Python searches for variables in the following order: Local → Enclosing → ___ → Built-in.

33

Open Ended

Explain the difference between local and global variable scope in Python, and why it is considered best practice to avoid global variables.

34

media

35

Multiple Select

Which of the following are benefits of documenting functions with docstrings, as described in the image?

1

Helps team collaboration

2

Auto-generates API docs

3

Slows down code execution

4

Easier maintenance

36

media

37

Open Ended

Give an example of how a higher-order function can be used to process a list of numbers in Python. Explain your reasoning.

38

media

39

Multiple Choice

Which of the following is NOT a common use case for decorators, based on the image?

1

Timing/profiling functions

2

Logging function calls

3

Sorting lists

4

Authentication checks

40

media

41

media

42

Multiple Choice

Which of the following is NOT a recommended engineering practice when designing a reusable data_utils module?

1

Keep I/O separate from transforms

2

Return new DataFrames

3

Use implicit column names

4

Use explicit column names

43

media

44

media

45

Multiple Select

Which of the following characteristics apply to Python lambda functions?

1

Can contain multiple statements

2

Implicit return without the return keyword

3

Best for simple, one-time operations

4

Can include if/for blocks inside

46

media

47

Multiple Choice

What is the result of applying the following code? numbers = [1, 2, 3, 4, 5] squared = list(map(lambda x: x**2, numbers)) Choose the correct output.

1

[1, 2, 3, 4, 5]

2

[2, 4, 6, 8, 10]

3

[1, 4, 9, 16, 25]

4

[1, 8, 27, 64, 125]

48

media

49

Fill in the Blank

Fill in the blank: The pandas .apply() method can be used to apply a function to each element of a Series or each ___ of a DataFrame.

50

media

51

Open Ended

Describe the difference between column-wise and row-wise operations using .apply() in pandas DataFrames. When would you use each?

52

Open Ended

Explain how lambda functions and the .apply() method can be used together to clean and transform data in a pandas DataFrame. Provide an example scenario.

53

media

54

media

55

media

56

media

57

media

58

media

59

media

60

media

61

media

62

media

63

media

64

media

65

media

66

media

67

media

68

media

69

media

70

media

71

media

72

media

73

media

74

media

75

media

76

media

77

media

78

media

79

media

80

media

81

media

82

media

83

media

84

media

85

media

86

media

87

media

88

media

89

media

90

media

91

media

92

media

93

media

94

media

95

media

96

media

97

media

98

media

99

media

100

media

101

media

102

media

103

media

104

media

105

media

106

media

107

media

108

media

109

media

110

media

111

media

112

media

113

media

114

media

115

media

116

media

117

media

118

media

119

media

120

media

121

media

122

media

123

media

124

media

125

media

126

media

127

media

128

media

129

media

130

media

131

media

132

media

133

media

134

media

135

media

136

media

137

media

138

media

139

media

140

media

141

media

142

media

143

media

144

media

145

media

146

media

147

media

148

media

149

media

150

media

151

media

152

media

153

media

154

media

155

media

156

media

157

media

158

media

159

media

160

media

161

media

162

media

163

media

164

media

165

media

166

media

167

media

168

media

169

media

170

media

171

media

172

media

173

media

174

media

175

media

176

media

177

media

178

media

179

media

180

media

181

media

182

media

183

media

184

media

185

media

186

media

187

media

188

media

189

media

190

media

191

media

192

media

193

media

194

media

195

media

196

media

197

media

198

media

199

media

200

media

201

media

202

media

203

media

204

media

205

media

206

media

207

media

208

media

209

media

210

media

211

media

212

media

213

media

214

media

215

media

216

media

217

media

218

media

219

media

220

media

221

media

222

media

223

media

224

media

225

media

226

media

227

media

228

media

229

media

230

media

231

media

232

media

233

media

234

media

235

media

236

media

237

media

238

media

239

media

240

media

241

media

242

media

243

media

244

media

245

media

246

media

247

media

248

media

249

media

250

media

251

media

252

media

253

media

254

media

255

media

256

media

257

media

258

media

259

media

260

media

261

media

262

media

263

media

264

media

265

media

266

media

267

media

268

media

269

media

270

media

271

media

272

media

273

media

274

media

275

media

276

media

277

media

278

media

279

media

280

media

281

media

282

media

283

media

284

media

285

media

286

media

287

media

288

media

289

media

290

media

291

media

292

media

293

media

294

media

295

media

296

media

297

media

298

media

299

media

300

media

301

media

302

media

303

media

304

media

305

media

306

media

307

media

308

media

309

media

310

media

311

media

312

media

313

media

314

media

315

media

316

media

317

media

318

media

319

media

320

media

321

media

322

media

323

media

324

media

325

media

326

media

327

media

328

media

329

media

330

media

331

media

332

media

333

media

334

media

335

media

336

media

337

media

338

media

339

media

340

media

341

media

342

media

343

media

344

media

345

media

346

media

347

media

348

media

349

media

350

media

351

media

352

media

353

media

354

media

355

Open Ended

Reflecting on the week's lessons, how do you think mastering modular and reusable functions can benefit your future AI projects?

356

Multiple Choice

What are some key Python concepts that are essential for AI development, as highlighted in the Python Review session?

1

List comprehensions, modular code, and clean coding principles

2

Web development frameworks and APIs

3

Mobile app development tools

4

Game development libraries

media

Show answer

Auto Play

Slide 1 / 356

SLIDE