Answer:
while (Num>=0) {
System.out.println("enter a another number");
Num = in.nextInt();
}
Explanation:
The complete java code prompting a user to enter a number until a negative number is entered is given below:
import java.util.Scanner;
public class num6 {
public static void main (String [] args) {
Scanner in = new Scanner(System.in);
System.out.println("enter a number");
int Num = in.nextInt();
while (Num>=0) {
System.out.println("enter a another number");
Num = in.nextInt();
}
System.out.println("Done.");
return;
}
}
Answer:
Following is the algorithm to interchange the value of two variable x and y.
step 1:Read the two integer x and y.
step 2 :t=x
Step 3: x=y
step 4: y=t
The minimum number of assignment to do this is 3
Explanation:
After reading two integer x & y, create a variable "t" of integer type.
with the help of variable "t", we can swap the value of variable x and y.
It requires 3 assignment to interchange the value.
Answer:
4. A Denial of Service attack (DDOS attack).
Explanation:
A DDOS attack is a malicious attempt to disrupt the normal traffic to a service.
In essence, it sends an enormous amount of requests to the service, until the server is overwhelmed because it can't handle that much traffic, and collapses in an overflow.
Thus, regular users are not able to access their services.
Usually, attackers use a botnet, a network of "zombie" computers that have been previously infected with a malware that allows the attacker to remotely control them, then the botnet starts to send a flood of traffic from different locations, and make the attacker difficult to detect or track.
Answer:
1: A loop will continue running until the defined condition returns false . ... You can type js for , js while or js do while to get more info on any of these. ... initialization - Run before the first execution on the loop. ... But it can be used to decrement a counter too.
2: The loop increments the value of new while the loop condition is true. The end value of new is 3.
3: We could use some sort of finger recognition or face so they don’t have to type in their password.
4: give them a second chance for their date of birth.
5: sum = 0 must be before for loop. If inside for loop, it will keep resetting sum to 0 each iteration.
Explanation: