Answer:
Because you're using "elif".
If I were to have this code:
if *blank*:
*action 1*
elif *blank*:
*action 2*
If and elif is basically saying "one or the other". Since 10 is >= 2, it prints out only whistle. Instead of elif, you were to replace them all with "if", it would print out:
whistle
snap
clap
Answer:
#include <stdio.h>
#include <string.h>
int main(void) {
char simonPattern[50];
char userPattern[50];
int userScore;
int i;
userScore = 0;
scanf("%s", simonPattern);
scanf("%s", userPattern);
for(i = 0;simonPattern[i]!='\0';i++){
if(simonPattern[i]!=userPattern[i]){
userScore=i;
break;
}
}
printf("userScore: %d\n", userScore);
return 0;
}
Explanation:
- Use a for loop that runs until it does not reach the end of simonPattern.
- Check whether the current index of simonPattern and userPattern are not equal and then assign the value of i variable to the userScore variable and break out of the loop.
- Finally display the user score.
Answer:
1.1.1.1, 54.45.43.54, and 255.255.255.0
Answer:
Option (D) is the right answer.
Explanation:
DHCP term used as a short form of dynamic host configuration protocol, which is used to assigns the IP address automatically according to the network.
According to the scenario, the system is getting the wrong IP address that resulting in internet disconnection which is a failure of the DHCP server because it is responsible for assigning the right IP address to the system.
Hence option (D) is the most appropriate answer.
While other options are wrong because of the following reasons:
- Static IP is the type of IP address which is fix and doesn't change in the system after rebooting, hence it has no connection in the change of IP address.
- If the DHCP server is working well there is no chance of interference from the surrounding device.
- Network setting has no connection with computer power supply as SMPS is used to give power and boot system only.