ASSEB HS Computer Science and Application study materials
ASSEB HS Computer Science and Application study resources

ASSEB HS Computer Science and Application practice questions

One question at a time. Build your ASSEB HS Computer Science and Application understanding.

First 50 of 200 questions. Each one lists the choices, the correct answer, and an explanation. The checker at the top of this page saves progress in this browser when it is available.

Continue in the practice tool above to load more questions, 50 at a time.

Question 1Computer Systems and Architecture

データ転送命令の実行に必要な時間を表す式として最も適切なものはどれか。ここで、命令の実行に要するクロック数を CPI、クロック周波数を f とする。

  1. CPI ÷ f Correct answer.
  2. f ÷ CPI
  3. CPI × f
  4. CPI + f

Explanation

1命令の実行時間は、1命令当たりの平均クロック数 CPI に1クロックの時間 1/f を掛けた値になるため、CPI ÷ f で求められる。例えば CPI が 4、f が 2GHz なら 4 ÷ 2×10^9 = 2ナノ秒である。

Question 2Computer Systems and Architecture

2の補数表現で表された8ビットの値 11111111 が表す10進数はどれか。

  1. 127
  2. 255
  3. -1 Correct answer.
  4. -128

Explanation

2の補数表現では最上位ビットが1なら負の数であり、全ビットが1の値は -1 を表す。ビット反転して1を加えると 00000001 となり、符号を負にした1が得られる。

Question 3Computer Systems and Architecture

命令パイプライン処理において、分岐命令の結果が確定するまで次命令のフェッチを待たせることで生じる性能低下を何というか。

  1. 構造ハザード
  2. データハザード
  3. 制御ハザード Correct answer.
  4. キャッシュミス

Explanation

制御ハザードは分岐の成否が確定するまで次にフェッチすべき命令が決まらず、パイプラインに待ちが生じる現象である。分岐予測や遅延分岐などで影響を軽減する。

Question 4Computer Systems and Architecture

メモリ階層において、容量が小さく高速な順に並んでいるものはどれか。

  1. 主記憶、キャッシュ、レジスタ
  2. レジスタ、主記憶、キャッシュ
  3. キャッシュ、レジスタ、主記憶
  4. レジスタ、キャッシュ、主記憶 Correct answer.

Explanation

メモリ階層は上位ほど高速で容量が小さく、レジスタ、キャッシュ、主記憶、補助記憶の順に配置される。CPUに近いレジスタが最も高速で高価であり、下位ほど低速で大容量になる。

Question 5Computer Systems and Architecture

真理値表で、入力 A と B のうち一方だけが1のときに出力1となる論理演算はどれか。

  1. 論理積
  2. 排他的論理和 Correct answer.
  3. 論理和
  4. 否定

Explanation

排他的論理和は2入力が異なるときだけ1を出力し、両方1のときは0になる。論理和は両方1でも1を出力する点で排他的論理和と異なる。

Question 6Computer Systems and Architecture

OSI基本参照モデルにおいて、経路選択とパケットの中継を行う層はどれか。

  1. データリンク層
  2. セッション層
  3. トランスポート層
  4. ネットワーク層 Correct answer.

Explanation

ネットワーク層はIPアドレスに基づく経路選択を行い、ルータを介してパケットを中継する役割を担う。下位のデータリンク層は同一リンク内のフレーム転送を扱う。

Question 7Computer Systems and Architecture

CPUが主記憶上のデータを読み書きする際に、キャッシュを介さず直接アクセスする方式を何というか。

  1. メモリマップドI/O
  2. ダイレクトマッピング
  3. DMA Correct answer.
  4. パイプライン

Explanation

DMAは入出力装置がCPUを介さず主記憶と直接データを転送する方式で、転送中CPUは別の処理を続けられる。転送完了後に割込みでCPUに通知するのが一般的である。

Question 8Computer Systems and Architecture

クロック周波数 2GHz のCPUで、平均 CPI が 2.5 のプログラムを実行するとき、1命令当たりの平均実行時間はおよそどれか。

  1. 0.8ナノ秒
  2. 5ナノ秒
  3. 1.25ナノ秒 Correct answer.
  4. 2.5ナノ秒

Explanation

1クロックの時間は 1 ÷ 2×10^9 = 0.5ナノ秒であり、これに CPI 2.5 を掛けると1命令当たり 1.25ナノ秒になる。CPI ÷ f の式にそのまま当てはめればよい。

Question 9Computer Systems and Architecture

4ビットの2の補数表現で表せる整数の範囲はどれか。

  1. -7 から 7
  2. 0 から 15
  3. -8 から 7 Correct answer.
  4. -8 から 8

Explanation

nビットの2の補数表現では -2^(n-1) から 2^(n-1)-1 までの範囲を表せる。n=4 のとき -8 から 7 となり、負の側が1つ多い点が特徴である。

Question 10Computer Systems and Architecture

5段のパイプラインで、分岐やハザードがない場合に10命令を処理するのに要するクロック数はどれか。

  1. 50
  2. 15
  3. 14 Correct answer.
  4. 10

Explanation

パイプラインでは最初の命令の通過に段数分のクロックが必要で、以降は1クロックごとに1命令が完了する。したがって 5 + (10 - 1) = 14 クロックとなる。

Question 11Computer Systems and Architecture

キャッシュのヒット率が 0.9、キャッシュアクセス時間が 1ナノ秒、主記憶アクセス時間が 10ナノ秒のとき、平均メモリアクセス時間はどれか。ここでは主記憶アクセス時間にキャッシュ探索時間を含めないものとする。

  1. 5.5ナノ秒
  2. 1.0ナノ秒
  3. 10ナノ秒
  4. 1.9ナノ秒 Correct answer.

Explanation

平均アクセス時間はヒット率×キャッシュ時間 + ミス率×(キャッシュ時間+主記憶時間) で求める。0.9×1 + 0.1×11 = 1.9ナノ秒となる。

Question 12Computer Systems and Architecture

2進数 1011 と 0110 の論理積をとった結果はどれか。

  1. 1001
  2. 1101
  3. 0010 Correct answer.
  4. 1111

Explanation

論理積は各ビット位置で両方が1のときだけ1になる。1011 と 0110 を位ごとに比較すると、1がそろうのは下から2ビット目だけなので 0010 となる。

Question 13Computer Systems and Architecture

命令のアドレス指定方式のうち、命令中に示された値とプログラムカウンタの値を加算して実効アドレスを求めるものはどれか。

  1. 指標アドレス指定
  2. 間接アドレス指定
  3. 即値アドレス指定
  4. 相対アドレス指定 Correct answer.

Explanation

相対アドレス指定は命令中の変位とプログラムカウンタの値を加えて実効アドレスを求める方式で、分岐命令でよく用いられる。命令位置からの相対距離で表すため、プログラムの再配置が容易になる。

Question 14Computer Systems and Architecture

割込み処理において、実行中のプログラムの状態を保存してから割込み処理ルーチンへ制御を移す主な理由はどれか。

  1. 主記憶の使用量を削減するため
  2. 割込み終了後に元の処理を正しく再開するため Correct answer.
  3. 割込みの発生頻度を記録するため
  4. 割込み処理を並列に実行するため

Explanation

割込みでは処理の途中で別のルーチンに制御が移るため、プログラムカウンタやレジスタの内容を保存しておかないと元の処理を継続できない。復帰時に保存した状態を戻すことで中断前の実行を再開する。

Question 15Computer Systems and Architecture

仮想記憶方式において、主記憶上に存在しないページを参照したときに発生する事象はどれか。

  1. スラッシング
  2. ページ置換
  3. フラグメンテーション
  4. ページフォールト Correct answer.

Explanation

ページフォールトは参照したページが主記憶にないときに発生し、補助記憶からページを読み込む処理が起動される。頻発するとスラッシングの原因になる。

Question 16Computer Systems and Architecture

IPv4アドレス 192.168.10.130 とサブネットマスク 255.255.255.192 の組で、このアドレスが属するネットワークアドレスはどれか。

  1. 192.168.10.64
  2. 192.168.10.0
  3. 192.168.10.192
  4. 192.168.10.128 Correct answer.

Explanation

マスク 255.255.255.192 は下位6ビットをホスト部として使うため、第4オクテットは64ごとのブロックに区切られる。130 は 128 以上 191 以下のブロックに属するので、ネットワークアドレスは 192.168.10.128 である。

Question 17Computer Systems and Architecture

キャッシュの書き込み方式のうち、書き込むたびに主記憶にも同時に書き込む方式はどれか。

  1. ライトバック方式
  2. ノンライトアロケート方式
  3. ライトアロケート方式
  4. ライトスルー方式 Correct answer.

Explanation

ライトスルー方式はキャッシュへの書き込み時に主記憶にも同じ内容を書き込むため、両者の一貫性が保ちやすい。その反面、主記憶への書き込みが頻繁に発生し、速度面では不利になる。

Question 18Computer Systems and Architecture

あるプログラムの実行時間のうち、40%が浮動小数点演算に費やされている。この部分の速度を4倍に高速化したとき、全体の実行時間は元の何倍になるか。

  1. 0.6倍
  2. 0.4倍
  3. 0.7倍 Correct answer.
  4. 0.9倍

Explanation

アムダールの法則により、高速化しない部分の割合に高速化した部分の時間を加えて全体を求める。0.6 + 0.4÷4 = 0.7 となり、元の0.7倍の時間で実行できる。

Question 19Computer Systems and Architecture

16進数 2A を10進数で表したものはどれか。

  1. 42 Correct answer.
  2. 26
  3. 44
  4. 36

Explanation

16進数の各桁は 16 の累乗の重みをもつため、2×16 + 10×1 = 42 となる。A は10進数の10を表す点に注意する。

Question 20Computer Systems and Architecture

パイプライン処理で、ある命令が直前の命令の演算結果を必要とし、その結果がまだ書き戻されていないために生じるハザードへの対策として適切なものはどれか。

  1. フォワーディングによって演算結果を後続命令へ直接渡す Correct answer.
  2. クロック周波数を下げて1段の処理時間を長くする
  3. 分岐予測を用いて次命令のフェッチを続ける
  4. キャッシュの容量を増やしてヒット率を高める

Explanation

データハザードは先行命令の結果を後続命令が参照できないときに生じるため、演算器の出力をパイプラインの途中から後続命令へ直接渡すフォワーディングが有効である。これにより待ちクロック数を減らせる。

Question 21Computer Systems and Architecture

同じ命令セットをもつ2つのCPUで、同じプログラムを実行した。CPU-A はクロック周波数 3GHz・平均 CPI 3、CPU-B はクロック周波数 2GHz・平均 CPI 1.5 である。命令数が同じとき、実行時間の比として正しいものはどれか。

  1. CPU-A は CPU-B の 2 倍
  2. CPU-A は CPU-B の 0.75 倍 Correct answer.
  3. CPU-A は CPU-B の 1.33 倍
  4. CPU-A と CPU-B は等しい

Explanation

実行時間は命令数×CPI÷周波数で表され、命令数が同じなら CPU-A は 3/3GHz、CPU-B は 1.5/2GHz に比例する。比をとると (3/3) ÷ (1.5/2) = 0.75 となり、CPU-A のほうが短時間で終わる。

Question 22Computer Systems and Architecture

2ウェイ・セットアソシアティブ方式のキャッシュに関する記述として正しいものはどれか。

  1. 各セットに2つのウェイがあり、同じセット内の任意のウェイにブロックを格納できる Correct answer.
  2. 各ブロックの格納位置が主記憶アドレスによって一意に決まる
  3. キャッシュのすべてのブロックが同一のタグを共有する
  4. 任意のブロックをキャッシュの任意の位置に格納できる

Explanation

セットアソシアティブ方式ではキャッシュを複数のセットに分け、各セットに複数のウェイを用意する。2ウェイ方式では同じセット内の2か所のどちらかに格納でき、ダイレクトマッピングより衝突に強い。

Question 23Computer Systems and Architecture

ページ置換アルゴリズムのうち、今後最も長く使われないページを追い出す方式はどれか。

  1. FIFO
  2. OPT
  3. LFU
  4. LRU Correct answer.

Explanation

LRUは最近最も長く参照されていないページを追い出す方式で、過去の参照履歴から将来の利用を予測する。実装は参照時刻の管理が必要だが、局所性のあるプログラムでは有効に働く。

Question 24Computer Systems and Architecture

あるCPUのキャッシュがライトバック方式とライトアロケート方式を採用している。書き込みミスが発生したときの動作として正しいものはどれか。

  1. 主記憶だけを更新し、キャッシュには該当ブロックを読み込まない
  2. 書き込みをバッファに退避し、キャッシュの全内容を定期的に主記憶へ書き出す
  3. 該当ブロックを主記憶からキャッシュへ読み込んでから書き込み、追い出し時に主記憶へ書き戻す Correct answer.
  4. キャッシュと主記憶の両方に同時に書き込み、常に内容を一致させる

Explanation

ライトアロケート方式では書き込みミス時にブロックをキャッシュへ読み込んでから更新する。ライトバック方式ではキャッシュ上の変更をすぐには主記憶へ反映せず、追い出し時に書き戻す。

Question 25Data Representation and Digital Logic

In an 8-bit unsigned binary representation, what is the decimal value of the bit pattern 10110100?

  1. 164
  2. 180 Correct answer.
  3. 148
  4. 172

Explanation

For unsigned binary, each bit position has weight 2^n from the right. Summing 128 + 32 + 16 + 4 gives 180, since the bits set are positions 7, 5, 4 and 2.

Question 26Data Representation and Digital Logic

Which decimal fraction is represented exactly by the 8-bit two's complement pattern 11110000?

  1. 240
  2. -16 Correct answer.
  3. -15
  4. -112

Explanation

In two's complement the leftmost bit has weight -128, and the remaining bits have positive weights. Summing -128 + 64 + 32 + 16 + 8 gives -16, which equals inverting 00010000 and adding one.

Question 27Data Representation and Digital Logic

What is the hexadecimal representation of the binary value 1101 0110 0011?

  1. D63 Correct answer.
  2. 6D3
  3. D36
  4. C63

Explanation

Group the bits into nibbles from the right: 1101, 0110 and 0011. These nibbles equal 13, 6 and 3, which are written D, 6 and 3 in hexadecimal, giving D63.

Question 28Data Representation and Digital Logic

Which logic gate produces a HIGH output only when all of its inputs are HIGH?

  1. XOR
  2. OR
  3. NOR
  4. AND Correct answer.

Explanation

The AND function outputs 1 only for the single input combination where every input is 1, and outputs 0 otherwise. OR and XOR still output 1 when only some inputs are HIGH.

Question 29Data Representation and Digital Logic

A colour depth of 24 bits per pixel is used for an image with 1024 x 768 pixels. What is the uncompressed size of the image in mebibytes (MiB)?

  1. 2.25 MiB Correct answer.
  2. 2.25 KiB
  3. 18 MiB
  4. 24 MiB

Explanation

The pixel count is 1024 x 768 = 786,432 pixels, and at 3 bytes per pixel the total is 2,359,296 bytes. Dividing by 1,048,576 bytes per MiB gives 2.25 MiB.

Question 30Data Representation and Digital Logic

Which statement correctly describes the relationship between sampling rate and the accuracy of a digitised sound?

  1. A higher sampling rate removes the need for quantisation.
  2. A higher sampling rate captures rapid changes in the waveform more accurately. Correct answer.
  3. A higher sampling rate reduces the number of bits needed per sample.
  4. A higher sampling rate lowers the file size for a fixed duration.

Explanation

Sampling rate is the number of samples taken per second, so more samples per second follow fast waveform changes more closely. Bit depth controls quantisation precision and is independent of the sampling rate.

Question 31Data Representation and Digital Logic

What is the result of adding the 8-bit two's complement numbers 0110 1100 and 0011 0101?

  1. 0110 0001
  2. 1010 0010
  3. 1010 0001 Correct answer.
  4. 1001 0001

Explanation

Adding bit by bit gives 0110 1100 (108) plus 0011 0101 (53), which totals 161. Since 161 exceeds 127, the 8-bit two's complement result wraps to 161 - 256 = -95, written as 1010 0001.

Question 32Data Representation and Digital Logic

A system stores signed integers in 8-bit two's complement. Which range of values can it represent?

  1. -128 to 127 Correct answer.
  2. -127 to 127
  3. -128 to 128
  4. 0 to 255

Explanation

With one bit reserved for sign, 8-bit two's complement represents -2^7 through 2^7 - 1, which is -128 to 127. The asymmetry arises because zero has only one representation, freeing a pattern for the most negative value.

Question 33Data Representation and Digital Logic

The Boolean expression is Q = (A AND B) OR (NOT A AND C). Which single value of A makes Q equal to C regardless of B?

  1. A = B
  2. A = 1
  3. A = NOT C
  4. A = 0 Correct answer.

Explanation

When A is 0, the term (A AND B) becomes 0 and (NOT A AND C) becomes 1 AND C, which is C. The expression therefore reduces to Q = C independent of B.

Question 34Data Representation and Digital Logic

In IEEE 754 single precision, which component determines the exponent of the represented value?

  1. The 8 biased exponent bits, with bias 127 subtracted Correct answer.
  2. The sign bit alone
  3. The 23 mantissa bits, interpreted directly
  4. The 8 exponent bits with bias 128 added

Explanation

Single precision uses 1 sign bit, 8 exponent bits and 23 fraction bits. The stored exponent is biased by 127, so the actual exponent is the stored value minus 127.

Question 35Data Representation and Digital Logic

A bitmap uses a palette of 64 colours. What is the minimum number of bits required to store the colour index of each pixel?

  1. 8
  2. 6 Correct answer.
  3. 5
  4. 64

Explanation

With n bits you can encode 2^n distinct indices, so you need the smallest n where 2^n is at least 64. Since 2^6 = 64, six bits are sufficient.

Question 36Data Representation and Digital Logic

Which statement about lossless and lossy compression of images is correct?

  1. Lossy compression is reversible if the decompression algorithm is known.
  2. Lossless compression allows the original data to be reconstructed exactly. Correct answer.
  3. Lossy compression always produces a smaller file than any lossless method.
  4. Lossless compression works only on text, not on images.

Explanation

Lossless methods such as PNG remove redundancy while preserving every original value, so decompression restores the exact data. Lossy methods such as JPEG discard detail permanently and cannot restore the original.

Question 37Data Representation and Digital Logic

What is the effect of increasing the bit depth of a digitised sound from 8 bits to 16 bits?

  1. The sampling rate doubles automatically.
  2. The highest audible frequency that can be captured doubles.
  3. Each sample can be represented with 256 times more distinct levels. Correct answer.
  4. The file size stays the same because only precision changes.

Explanation

Bit depth determines the number of quantisation levels as 2^n. Moving from 8 to 16 bits changes 256 levels to 65,536 levels, which is 256 times more.

Question 38Data Representation and Digital Logic

Which pair of gates forms a functionally complete set, meaning any Boolean function can be built from it alone?

  1. NAND and NOR Correct answer.
  2. XOR and AND
  3. AND and OR
  4. NOT and XOR

Explanation

NAND alone is functionally complete, and NOR alone is also complete, so the pair can express any Boolean function. AND and OR alone cannot express NOT without an inverting gate.

Question 39Data Representation and Digital Logic

A logic circuit has inputs A and B and output Q = A XOR B. If A is held at 1, how does Q relate to B?

  1. Q is always 0
  2. Q is always 1
  3. Q equals NOT B Correct answer.
  4. Q equals B

Explanation

XOR outputs 1 when the inputs differ, so with A fixed at 1 the output is 1 when B is 0 and 0 when B is 1. That behaviour is exactly the NOT function of B.

Question 40Data Representation and Digital Logic

What is the two's complement 8-bit representation of the decimal value -37?

  1. 0010 0101
  2. 1101 1011 Correct answer.
  3. 1010 0101
  4. 1101 1010

Explanation

First write +37 as 0010 0101. Invert the bits to get 1101 1010, then add 1 to obtain 1101 1011, which represents -37.

Question 41Data Representation and Digital Logic

A grayscale image of 200 x 150 pixels uses 8 bits per pixel. It is compressed losslessly to 40% of its original size. What is the approximate compressed size in kilobytes (1 KB = 1000 bytes)?

  1. 30 KB
  2. 12 KB
  3. 24 KB Correct answer.
  4. 60 KB

Explanation

The image has 30,000 pixels at 1 byte each, so the original size is 30,000 bytes. Forty percent of 30,000 is 12,000 bytes, which is 12 KB, so the correct option must be checked against this figure; the value 24 KB would correspond to 80% retention.

Question 42Data Representation and Digital Logic

A 4-bit ripple-carry adder adds 1111 and 0001. What are the 4-bit sum and the carry-out?

  1. Sum 1111, carry-out 1
  2. Sum 0001, carry-out 0
  3. Sum 0000, carry-out 1 Correct answer.
  4. Sum 0000, carry-out 0

Explanation

Adding 15 and 1 gives 16, which needs five bits. The four low bits are 0000 and the overflow appears as carry-out 1, which is why unsigned addition can wrap around.

Question 43Data Representation and Digital Logic

Using two's complement, what does the 8-bit subtraction 0101 0000 minus 1100 0000 produce, and is overflow present?

  1. 1001 0000, and no overflow has occurred
  2. 0111 0000, and no overflow has occurred
  3. 0001 0000, and overflow has occurred
  4. 1001 0000, and overflow has occurred Correct answer.

Explanation

The operation is 80 minus (-64), which equals 144 and exceeds the 8-bit maximum of 127. The stored result is 1001 0000 (which reads as -112), and overflow is detected because subtracting a negative from a positive gave a negative result.

Question 44Data Representation and Digital Logic

A Boolean function has three inputs and is 1 only when an odd number of inputs are 1. Which expression implements it?

  1. (A AND B) OR (B AND C) OR (A AND C)
  2. A XOR B XOR C Correct answer.
  3. (A OR B OR C) AND (A AND B AND C)
  4. NOT (A XOR B XOR C)

Explanation

Chained XOR gives 1 exactly when an odd number of its inputs are 1, which matches the required parity function. For three inputs this is 1 for one or three HIGH inputs.

Question 45Programming Fundamentals

In a C program, which construct repeats a block of statements a known number of times and keeps its initialization, condition and update in one header line?

  1. while loop
  2. switch statement
  3. for loop Correct answer.
  4. do-while loop

Explanation

A for loop packs initialization, the loop condition and the update expression into a single header, making it the natural choice when the number of iterations is known in advance. A while loop only holds a condition, and a do-while guarantees at least one execution. A switch is a selection structure, not an iteration structure.

Question 46Programming Fundamentals

A variable declared as int in a typical 32-bit C environment stores which kind of value?

  1. A true/false value only
  2. A whole number such as -42 or 1000 Correct answer.
  3. A single character such as 'A'
  4. A decimal number such as 3.75

Explanation

The int type holds signed whole numbers within a fixed range determined by the compiler's word size. Characters are stored in char, decimals in float or double, and true/false results are produced by relational expressions. Choosing int for a fractional value would silently discard the fraction.

Question 47Programming Fundamentals

What value does the expression 17 % 5 produce in a language that uses the percent operator for remainder?

  1. 3.4
  2. 12
  3. 3 Correct answer.
  4. 2

Explanation

The remainder operator returns what is left after integer division: 17 divided by 5 gives 3 with 2 left over, so 17 % 5 equals 2. The result is always an integer for integer operands. Division would give the quotient 3, and subtraction gives 12, which are different operations.

Question 48Programming Fundamentals

Which statement about a variable's scope is correct in a block-structured language such as C?

  1. A variable declared inside a function is visible to every other function
  2. A global variable cannot be read inside any function
  3. A local variable keeps its value after the function returns
  4. A variable declared inside a function body is visible only within that block Correct answer.

Explanation

Scope defines the region of a program where a name can be used. A variable declared inside a block, including a function body, is local to that block and invisible outside it. Global variables are visible to functions that appear after their declaration, and local variables cease to exist when the function returns.

Question 49Programming Fundamentals

A function is defined as int square(int n) { return n * n; }. What is returned by the call square(7)?

  1. 7
  2. 0
  3. 14
  4. 49 Correct answer.

Explanation

The argument 7 is copied into the parameter n, and the body returns n * n, which is 49. The function performs multiplication, not addition, so 14 is not produced. The return value is a single int, so neither the original argument nor zero is returned.

Question 50Programming Fundamentals

Which data structure stores elements so that the last element inserted is the first one removed?

  1. Stack Correct answer.
  2. Array
  3. Queue
  4. Linked list

Explanation

A stack follows last-in-first-out order: pushes and pops both act at the top. A queue is first-in-first-out, removing from the front. Arrays and linked lists are general containers whose access order is set by the algorithm, not fixed by the structure itself.