Match the definition with the vocabulary word that best fits the definition.
|
The library used for formatting output. |
|
|
The location of a variable in memory |
|
|
The library used to read and write to files |
|
|
Data that is passed back to the calling function as the function ends. |
|
|
When an argument is passed to a function this way, a copy of the argument (or of the value stored in the argument variable) is copied into a function parameter variable. |
|
|
A statement that invokes a function. |
|
|
A variable defined inside a function that retains its value between function calls. |
|
|
Two functions that have the same name but different parameters are said to be... |
|
|
A constant that is defined outside the main and all function definitions. The scope of the variable is the entire program. |
|
|
A variable that is defined within a function body. The scope of the variable is just that function. |
|
|
This operator is used to calculate the remainder of two integers |
|
|
The library that you use when reading and writing to the console Choices: do while if else and iomanip not scope pass by value while or function static variable global constant for function definition return value % switch cstdlib function call local variable address overloaded iostream fstream |
|
/* here all the examples with examples are given in c++ */ The library used for formatting output. Program code: #include<iostream> #include<iomanip> // library used for output formatting using namespace std; main() { cout<<"hello world"<<endl; cout<<setw(15)<<" it is c++"; } Output:
Explain: Here for iomanip library is used for output formatting. The function set() function is defined in iomanip and setw takes value 15, means the first character of “it is c++" will start 15 character right from the left. |
iomanip |
|
The location of a variable in memory Program code: #include<iostream> #include<iomanip> using namespace std; main() { int p=10; cout<<&p; } Output:
Explain: Here variable p has the location in memory, which is denoted by &p. It is 0X22feac |
address |
|
The library used to read and write to files Program code: #include <iostream> #include <fstream> // library is used for file read write operation using namespace std; int main () { ofstream fo; // open file output mode to write data in file ifstream fi; // open file output mode to write data in file string line; fo.open ("data.txt"); // open file write mode fo << "Writing this to a file.\n"; // content stored in file fo.close(); fi.open ("data.txt"); // open file read mode if (fi.is_open()) { while ( getline (fi,line) ) // read from the file { cout << line << '\n'; } fi.close(); } } Output:
Explain: Here fstream is a library which is used to read and write data in file. Here using stream classes ofstream and ifstream, the message “Writing this to a file” is stored in file data.txt and read from file data.txt respectively. |
fstream |
|
Data that is passed back to the calling function as the function ends. Program code: #include<iostream> #include<iomanip> using namespace std; int sum(int a,int b) { int z; z=a+b; return(z); } main() { int x,y,c; cout<<"Enter first value: "; cin>>x; cout<<"Enter another value: "; cin>>y; c=sum(x,y); // return the value of z to c cout<<"Addition is: "<<c; } Output:
Explain: Here the addition of a and b is stored in variable z. This variable return the value (a+b) to calling function sum(x,y) and the returned value is stored in variable c. |
return value |
|
When an argument is passed to a function this way, a copy of the argument (or of the value stored in the argument variable) is copied into a function parameter variable. Program code: #include<iostream> #include<iomanip> using namespace std; // here variables x,y are copied into function parameter a,b int sum(int a,int b) { int z; z=a+b; return(z); } main() { int x,y,c; cout<<"Enter first value: "; cin>>x; cout<<"Enter another value: "; cin>>y; c=sum(x,y); cout<<"Addition is: "<<c; } Output:
Explain: Here the values of argument x, y 10,20 respectively(as per output) are passed to variable a,b of sum() function parameters. So z will store 10+20=30 |
pass by value |
|
A statement that invokes a function. Program code: #include<iostream> using namespace std; float volume(float); main() { float x, y; cout<<"Enter side: \n"; cin>>x; y = volume(x); // function calling cout<<"\nThe volume is: "<<y<<"\n"; } float volume(float p) { float n; n = p * p * p; return n; } Output
Explain: Here volume() function is calling function in main with the syntax: y = volume(x); Function calling invoke volume() function in main() function. |
function call |
|
A variable defined inside a function that retains its value between function calls. Program code: #include<iostream> #include<iomanip> using namespace std; void cal() { /* variable is declared as static */ static int count = 0; cout<<count<<" "; count++; } main() { for (int i=0; i<5; i++) /* cal() function increase the count variable which is declared in cal() function but can retain the value in main function call also */ cal();
} Output
Explain: Here count variable is static, is is declared in cal() function , but its value retains in main function. So running loop 5 times in main function variable count prints the values 0 1 2 3 4 through cal() function. |
static variable |
|
Two functions that have the same name but different parameters are said to be... Program code: #include<iostream> #include<iomanip> using namespace std; double area(double a, double b) // same function with two parameter { double z; z=a*b; return(z); } double area(double r) // same function with one parameter { double z; z=3.141*r*r; return(z); } main() { double m,n,p,c,d; cout<<"Enter the length: "; cin>>m; cout<<"Enter the breadth: "; cin>>n; cout<<"Enter the radius: "; cin>>p; c=area(m,n); // same function with two parameter cout<<"Area of rectangle is: "<<c<<endl; d=area(p); // same function with one parameter cout<<"Area of circle is: "<<d; } Output:
Explain: Here area() function is overloaded, in one area function there are two parameters a,b In another area() functions there is one parameter r. |
overloaded |
|
A constant that is defined outside the main and all function definitions. The scope of the variable is the entire program. Program code: #include<iostream> #include<iomanip> using namespace std; /*constant value pi=3.141 as global variable used in two functions */ const double pi=3.141; double area_cylinder(double a, double b) { double z; z=2*pi*a*a+b*(2*pi*a); //pi is used return(z); } double area_circle(double r) { double z; z=pi*r*r; //pi is used return(z); } main() { double m,n,p,c,d; cout<<"Enter the hieght: "; cin>>m; cout<<"Enter the radius: "; cin>>p; c=area_cylinder(m,p); cout<<"Area of cylinder is: "<<c<<endl; d=area_circle(p); cout<<"Area of circle is: "<<d; } Output
Explain: Here variable pi is declared as constant and its scope is within entire program. Here pi is used in area_cylinder() and area_circle() function as global constant. |
global constant |
|
A variable that is defined within a function body. The scope of the variable is just that function. Program code: #include<iostream> #include<iomanip> using namespace std; double add( double a, double b) { // scope of the variable c is within the function. // it can not be used in sub function double c; c=a+b; return(c); } double sub( double a, double b) { c=a-b; // the variable c is declared in c return(c); } main() { double m,n,p,c,d; cout<<"Enter a value: "; cin>>m; cout<<"Enter another value: "; cin>>p; c=add(m,n); cout<<"Addition is: "<<c<<endl; d=sub(m,n); cout<<"Substract is: "<<d; } Output “Error:” ‘c’ was not declared in this scope
Explain: Here scope of variable c is local as within add () function. So it cannot be used in sub () function. So error occurs. |
local variable |
|
This operator is used to calculate the remainder of two integers Program code: #include<iostream> #include<iomanip> using namespace std; main() { int m,p; int c; cout<<"Enter a value: "; cin>>m; cout<<"Enter another value: "; cin>>p; c=m%p; cout<<"Remainder is: "<<c<<endl;
} Output
Explain: Here % is used to calculate remainder of two values. If one value is 3 and another is 2. So, remainder will be 3%2 =1 |
% |
|
The library that you use when reading and writing to the console Program: #include<iostream> #include<iomanip> using namespace std; main() { int m,p; int c; cout<<"Enter a value: "; cin>>m; cout<<"Enter another value: "; cin>>p; c=m%p; cout<<"Remainder is: "<<c<<endl;
} Output:
Explain: Here in iostream library cout and cin are defined. cout is used to display data at console. cin is used for taking input from cosole. |
iostream |
Match the definition with the vocabulary word that best fits the definition. The library used for...
Match the definition with the vocabulary word that best fits the definition. One of the three loops in C++. The first line of the loop consists of three distinct parts (initialize, compare, increment) Nested if statements are one way to do a choice between multiple options. This statement does the same for integers and characters. These are used to bound blocks of code in C++. These characters are used to specify characters in C++. A logical operator that changes true...
C++
Part 1, c. Match each of the vocabulary words at the right with the BEST definition on the left. This operator is shorthand for adding a value to something ✓ Choose... This keyword is used to de-allocate memory allocated with the new operator. protected exit The increment operator for C++ This method is used to "Clean up" when an object is deleted. private Destructor Operator When you are accessing a method through a pointer, you can use this operator...
Please answer question 1-4
4. Vocabulary: Match definition to its word. There will be some words left over. (DUP some words left over. (50 points, 5 points each) part of the processor that performs actions such as mathematics, testing, and moving data the processor uses this computed memory location to access data used to combine multiple partial programs into a single executable how instructions are stored as machine code A. Indirect B. event handler c. pointer D. assembler E. control...
QUESTION 2 Copy of 1-3 Vocab Match the vocabulary word for each definition below A relational database chart that is used to map the infor-mation from the entity relationship diagram A. Nulls the unique identifier for each row of data B. Unique Links data in one table to the data in a second table by re-ferring to the PK column in the second table C. Table instance chart Indicates if a column must contain a value D. Foreign key (FK)...
C++ LANGUAGE
The following formula can be used to determine the distance an
object falls in a specific time period:
d = 1 2 g t 2
where d is the distance in meters, g is 9.8, and t is the amount
of time, in seconds, the object has been falling.
Write a function named fallingDistance that accepts an
object's falling time in seconds as an argument. You must
define a named constant for g using a meaningful name and...
For this c++ assignment, Overview write a program that will process two sets of numeric information. The information will be needed for later processing, so it will be stored in two arrays that will be displayed, sorted, and displayed (again). One set of numeric information will be read from a file while the other will be randomly generated. The arrays that will be used in the assignment should be declared to hold a maximum of 50 double or float elements....
A. File I/O using C library functions File I/O in C is achieved using a file pointer to access or modify files. Processing files in C is a four-step process: o Declare a file pointer. o Open the desired file using the pointer. o Read from or write to the file and finally, o Close the file. FILE is a structure defined in <stdio.h>. Files can be opened using the fopen() function. This function takes two arguments, the filename and...
implement a class called PiggyBank that will be used to represent a collection of coins. Functionality will be added to the class so that coins can be added to the bank and output operations can be performed. A driver program is provided to test the methods. class PiggyBank The PiggyBank class definition and symbolic constants should be placed at the top of the driver program source code file while the method implementation should be done after the closing curly brace...
Your will write a class named Gasket that can be used to build Gasket objects (that represent Sierpinski gaskets) that you can display graphically. Your Gasket class is defined in the provided file Gasket.h. DO NOT CHANGE the file Gasket.h. The attributes and methods defined for class Gasket are described below. ·sideLength an int that holds the length of each side of the Gasket. The length of the side is measured as a number of pixels ·xLocation an int that holds the x coordinate (in pixels)...
Python 2.7.14 Programming Assignment Shape Drawing With
Notepad++(PLEASE READ AND FOLLOW THESE INSTRUCTIONS THOROUGLY AS
THIS ASSIGNMENT IS FOR PYTHON 2.7.14. ONLY AND I REALLY NEED THIS
TO WORK!!! ALSO PLEASE HAVE THE CODE PROPERLY INDENTED, WITH
WHATEVER VARIABLES DEFINED, WHATEVER IT TAKES TO WORK FOR PYTHON
2.7.14. I feel like nothing I do is working and I'm trying
everything I can think of. ):
In this assignment, the student will create a Python script that
implements a series of...