Loop takes only positive numbers and terminates once it encounters a negative numbers.
Answer and Explanation:
Using javascript:
Var positiveInt= window.prompt("insert positive integer");
While(positiveInt>=0){
Alert("a positive integer");
Var positiveInt= window.prompt("insert positive integer");
}
Or we use the do...while loop
Var positiveInt= window.prompt("insert positive integer");
do{
Var positiveInt= window.prompt("insert positive integer");
}
While (positiveInt>=0);
The above program in javascript checks to see if the input number is negative or positive using the while loop condition and keeps executing with each input until it gets a negative input
Answer:
/*
I don't know what language you're using, so I'll write it in javascript which is usually legible enough.
*/
console.log(buildSequence(30));
function buildSequence(maxVal){
maxVal = Math.abs(maxVal);
var n, list = [];
for(n = 1; n < maxVal; n++){
/*
to check for odd numbers, we only need to know if the last bit
is a 1 or 0:
*/
if(n & 1){ // <-- note the binary &, as opposed to the logical &&
list[list.length] = n;
}else{
list[list.length] = -n;
}
}
return list.implode(',');
}
Its answer D because I took the same test and it told me that my answer was right that I put down and it was D.
Answer:
NAT
Proxy
IPv6
Explanation:
Network Address Translation (NAT) allows a local area network (LAN) to connect to the internet using only one external IP address. The LAN addresses (typically 192.168.x.x) can be used over and over again.
A proxy is a computer that makes requests to the internet on behalf of the computers on a LAN. It is a more restricted flavour compared to the NAT, but the effect is the same.
IPv6 is a new addressing scheme that will use a 48 bits address space rather than a 32 bits address space of IPv6, and that would provide plenty of addresses.