AP (Advanced Placement) · AP Computer Science A

Algorithms with Selection and Repetition:練習題

5 條多項選擇題即時批改,另有 1 條文字題附完整解題步驟,全部圍繞「Algorithms with Selection and Repetition」。

6 條題目10 免費,無需登記
第 1 題
1

How many times will the following loop execute?
for (int i = 0; i < 10; i += 3) {
  System.out.println(i);
}

第 2 題
1

Given that a, b, and c are boolean variables, which of the following expressions will always evaluate to the same value as (a && b) || (a && c)?

第 3 題
1

A student is writing a program to find the largest power of 2 that is less than or equal to a positive integer n. Which of the following code segments correctly computes this value and stores it in ans?

第 4 題
1

Which of the following logical expressions is equivalent to the expression !(a || b) according to De Morgan's Laws?

第 5 題
1

What is the output of the following code segment?
int count = 0;
for (int i = 1; i <= 3; i++) {
  for (int j = 1; j < 3; j++) {
    count++;
  }
}
System.out.println(count);

第 6 題
5

A program is designed to analyze a sequence of integers entered by a user until the user enters -1.
Part a: Using a while loop, write a logic flow that calculates the sum of all positive even integers entered.
Part b: Integrate an if-else structure to track the maximum value among the entered positive integers.
Part c: If the user enters the sequence: 4, 7, 2, 10, -1, determine the final values of the sum and the maximum. Show the state of these variables after each iteration.

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

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

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

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

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

立即練習