Write pseudocode to print the first 10 prime numbers.
What will be an ideal response?
num curr = 2
boolean isPrime
num totalPrimes = 0
while totalPrimes < 10
isPrime = true
for num x = 2 to curr -1
if curr mod x = 0
isPrime = false
endif
endfor
if isPrime = true
totalPrimes = totalPrimes + 1
print curr
endif
curr = curr + 1
endwhile
You might also like to view...
This is the point where the cable is connected to terminals in a modular plug, jack, or patch panel.
What will be an ideal response?
Which of the following statements is false?
a. In Java SE 8, an interface may declare default methods—that is, public methods with concrete implementations that specify how an operation should be performed. b. When a class implements an interface, the class receives the interface’s default concrete implementations if it does not override them. c. When you enhance an existing interface with default methods—any class that implemented the original interface will break. d. With default methods, you can declare common method implementations in interfaces (rather than abstract classes), which gives you more flexibility in designing your classes.
The _____ Auto Fill Option that fills the destination area using the format of the source area; no content is filled.
A. Copy Cells B. Fill Formatting Only C. Fill Without Formatting D. none of the above
Answer the following statement(s) true (T) or false (F)
1. The done bit is true when timer instruction is true or enabled. 2. The TON instruction is reset by making the rung go false. 3. A projector fan that continues to run after the light is turned off is an example of an off-delay timer. 4. Timer and counter instructions can be selected from the Timer/Counter tab on the Standard toolbar. 5. The TOF is a nonretentive instruction.