Answer:
A. for an if-else statement in python, if the condition is false, The else statement is executed.
B. if the condition of the if-statement is true, the indented block of code is executed.
Explanation:
The if-statement is a conditional statement in programming for decision making. It is also known as branching as it makes decisions based on two paths. It comes with another keyword called 'else'.
The If-else statement makes a decision based on the output of a condition which is defined in the if-statement. If the condition is met, the code block just after the if-statement is executed, but the else-statement block is executed if otherwise.
Answer:
c. 2
Explanation:
As the routers are only involved with the process of finding the best route to reach an IP address (the destination hosts), they don't look at the IP Datagram payload (which includes the transport protocol header), only to IP header.
So, the only transport processes that "talk"each other, are the one on the source host (defining TCP or UDP source port/s, and the other on the destination host (defining TCP or UDP destination port/s), so two applications (or more) in both machines can exchange data.
Answer:
The program in C++ is as follows:
#include <fstream>
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
string filename;
cout<<"Filename: ";
cin>>filename;
ifstream inFile(filename);
if(!inFile) {
cout << endl << "Cannot open file " << filename;
return 1; }
ofstream fout;
ifstream fin;
fin.open("invalid-numbers.txt");
fout.open ("invalid-numbers.txt",ios::app);
double sum = 0; int valid = 0; int invalid = 0;
double num = 0;
while(!inFile.eof()) {
inFile >> num;
if(num >= 0 && num<=110){ sum+=num; valid++; }
else{ invalid++;
if(fin.is_open()){
fout<<fixed<<setprecision(2)<<num<<"\n"; } } }
fin.close();
fout.close();
inFile.close();
cout<<"Total values: "<<valid+invalid<<endl;
cout<<"Invalid values: "<<invalid<<endl;
cout<<"Valid values: "<<valid<<endl;
cout<<"Average of valid values: "<<fixed<<setprecision(2)<<sum/valid<<endl;
double inv;
ifstream inFiles("invalid-numbers.txt");
while(!inFiles.eof()) {
inFiles >> inv;
cout<<inv<<"\n";
}
inFiles.close();
return 0;
}
Explanation:
See attachment for source file where comments are used to explain each line
Answer:
d. DNS kiting
Explanation:
Domain kiting can be defined as the process by which a person removes a domain name during the grace period or trial period (Free) of five days and immediately register it again for another period of five days. The individual can then repeat this process indefinitely, so it is basically possible for him/her to have the domain registered without paying.