Answer:
/*
* Program to write data to text file.
*/
#include<iostream>
#include<fstream>
#include<string.h>
using namespace std;
int main()
{
//Variable to name and age of a person.
string name;
int age;
cout<<"Enter your name"<<endl;
cin>>name;
cout<<"Enter your age"<<endl;
cin>>age;
//Creating object of ofstream.
ofstream file;
file.open ("outdata.txt");
//Writing data to file named outdata.txt
file<<name<<" "<<age;
file.close();
}
Output:
Enter your name
John
Enter your age
25
Content of Output.txt:
John 25
Explanation:
To write data to a file ofstream object is used. An ofstream object file is created first and then using this object a file named "outdata.txt" is created.
Finally using shift operator (<<), by means of operator overloading, name and age of person is transferred to file outdata.txt.
Answer:
a. grep 'b[au]nk$' myLine
Explanation:
grep is a command used for searching a specified pattern in a given text.
Our goal is to match the character sequence - bank or bunk at the end of line in a given line referenced by myLine.
The regular expression for the specified match criterion is:
b[au]nk$
The second character can be either a or u.
$ indicates match at end of line.
So the overall grep command is :
grep 'b[au]nk$' myLine
Answer:
See the explanation below
Explanation:
An image showing the range of cells is attached.
The task is to use autofill to fill the range of A9:H11 with the formatting from the range of A7:H8;
As shown in the image some cells are already filled. First, we highlight the cells A7:H8 and then we move the cursor to the end of the selected cell (precisely end of H8) over what is called Fill Handle and the cursor then turns into a black plus sign.
Hold down the right mouse button and drag over the wanted range of cells (A9:H11) and release.
A list of options is presented, this options include:
Copy cells, Fill series, Fill formatting only, Fill without formatting and so on.
From the displayed options, we select "Fill formatting only" and the cell (A9:H11) will have the same formatting as the cells (A7:H8).
Answer: Desk checking
Explanation:
The desk checking is one of the type of informal way manual testing in which the programmer use this method for evaluating or checking the coding or the different types of algorithm logic in the system.
- It helps in identifying the errors in the program so that it can be executed properly without any interruption in the system.
- It is one of the effective way for the error detection and also known as the modern debugging tool.
According to the given question, the desk checking is the term which is used to refers to the programmers for reading the given program step by step each statement. Therefore, Desk checking is the correct answer.
Therefore, Desk checking is the correct answer.
Answer:
// here is code in c.
#include <stdio.h>
// main function
int main()
{
// variable to store year
int year;
printf("enter year:");
// read the year
scanf("%d",&year);
// if year>=2101
if(year>=2101)
{
printf("Distant future");
}
//if year in 2001-2100
else if(year>=2001&&year<=2100)
{
printf("21st century");
}
//if year in 19011-2000
else if(year>=1901&&year<=2000)
{
printf("20th century");
}
// if year<=1900
else if(year<=1900)
{
printf("Long ago");
}
return 0;
}
Explanation:
Read the year from user.After this, check if year is greater or equal to 2101 then print "Distant future".If year is in between 2001-2100 then print "21st century".If year is in between 1901-2000 then print "20th century".Else if year is less or equal to 1900 then print "Long ago".
Output:
enter year:2018
21st century