AQA A Level · Computer Science 7517

字典:練習題

4 條多項選擇題即時批改,另有 4 條文字題附完整解題步驟,全部圍繞「字典」。

8 條題目18 免費,無需登記
第 1 題
1

Which of the following describes a dictionary as an abstract data type?

第 2 題
1

A 4-vector over \( \mathbb{R} \) is represented as a dictionary mapping indices to values. Given the vector:
\( 0 \mapsto 2.0 \)
\( 1 \mapsto 3.14 \)
\( 2 \mapsto -1.0 \)
\( 3 \mapsto 2.72 \)
Which of the following is the correct representation of this vector in Python dictionary syntax?

第 3 題
1

A dictionary is used to represent a sparse vector in a high-dimensional space. If a vector in \( \mathbb{R}^5 \) is defined as \( v = [0, 1.5, 0, 0, -3.2] \), which dictionary representation is both memory-efficient and logically correct based on the index-to-value mapping?

第 4 題
1

A programmer is representing a document containing the words 'The green, green grass grows' as a dictionary by mapping each unique word to its frequency of occurrence. What would be the correctly formatted dictionary representation, ignoring letter case?

第 5 題
2

A dictionary is a data structure consisting of key-value pairs. Describe the primary method used to access a value within a dictionary.

先自己寫一次答案,再對照解題步驟。

第 6 題
4

Explain why a dictionary can be considered a valid representation of a vector, and provide an example of the vector \([0.5, 0.0, 1.2]\) represented as a dictionary.

先自己寫一次答案,再對照解題步驟。

第 7 題
5

A Dictionary is used to represent the sparse vector \( [0, 0, 4.5, 0, -1.2] \) where indices map to values. Provide the dictionary representation and explain why this is more efficient than a 1D array for very large sparse vectors.

先自己寫一次答案,再對照解題步驟。

第 8 題
3

A Dictionary is an abstract data type that stores key-value pairs. Consider the following dictionary representing the inventory of a small store:
Inventory = {"Apple": 50, "Banana": 20, "Orange": 30}

a. What is the value associated with the key "Banana"? (1 point)
b. Describe the logical result of performing the operation Update(Inventory, "Apple", 45). (1 point)
c. What occurs if a programmer attempts to add a new key "Apple" with a different value? (1 point)

先自己寫一次答案,再對照解題步驟。

* thinka提供的內容由AI生成,可能並非總是準確或最新。請將其用作輔助資源,並與官方材料進行核實。

你已看過標準答案,接下來輪到批改你的答案。

這一頁可以告訴你好答案的樣子,卻無法指出你的答案欠缺什麼。thinka 按真實評分準則批改你的文字答案,約 15 秒完成。

想多做幾條同類題目?立即開始練習呢個課題,即做即批改。

立即練習