1- Variables are made up of 6 attributes list and briefly describe what each one tells us about a variable
2- Describe how lifetime scope are similar and how they different
Q1)
There are 6 attribute associated with a variable. The first three are very important to start programming . The last three are important as we advance
The name is Symbolic. It speaks about the "title" of the data that is being stored with the variable. The name might be the most vital property to the software engineer, since this is the means by which we "access" the variable. Each variable must have a specific/unique name. For eg, a variable storing age of person will be better relatable if it is name AgeOfPerson rather ‘x’, ‘y’ or something like this
The type represents what "kind" of data is stored with the variable. In C, Java the type of a variable must be explicitly declared when the name is created. Suppose we are storing the Age of person in completed years, it should be an integer rather than a float. We have different data types like int, char, float, bool
Eg of declaration of variable,
Char Name[];
int Score;
float AvgScore
This is the actual data store or assigned to the variable. We can change the value assigned to a variable by reassigning it later down the program. So it can be a variable which changes overtime
Eg; int Pupil_Age= 22;
Here we are giving a value of 22 to the variable Pupil_Age. We can alter it down by reassigning it to different number later
Great projects are "broken" into little independent areas (called functions) particularly like a decent book is broken into sections, and a decent section is additionally partitioned into passages, and so forth. A variable that is seen and utilized in one function isn't accessible in another area. This enables us to reuse variable names, for example, Name. In one function 'Name' could allude to the Name of a person, and in another capacity 'Name' could allude to the Model name of Sports car. Further this keeps us from "unknowingly" changing data that is vital to another piece of our program.
Consider there are 2 functions in a program
Void Main()
{ int Ret_Age(int id);
Int Ret_Price(int id);
}
Ret_Age function may be a function to give the age of student given an ‘id’ . Ret_price may give the price of a car given an ‘id’. Both the cases we use same variable name ‘id’ but it supports a different function
Similarily if a variable is declared in the main section it is accessible in the area of it only. They may be called local variables
Eg main()
{ float avg_points;
}
If the variables are declared outside the main they are called global variable and are accessible in the entire program
#include <stdio.h>
/* global variable declaration */
Char grade;
int main () {
}
The lifetime of a variable is the time period for which the value of the variable is valid or it may be accessible. The Life time of a variable is firmly related to the scope of the variable. At the point when a program starts, variables will be allocated or come alive when the program reaches the line of code where they are "declared". They are erased when the program leaves the "scope" of the variable.
We need not worry much about this aspect in high level programming languages right from C, Java,python as the low level languages needed to assign a memory block for the program first and then allocate accordingly for variables, Arithmetic operations. We might have to be careful if there are any functions in loop and they are iterated infinitely we might face problem in high level languages also
Q2) Life time refers to the time period the variable is available to access where as the Scope refers to the visibility of a variable that is declared
Consider the below example
#include <stdio.h>
void disp();
int i = 5; // global variable
int main()
{
++i; // variable n is not declared in the main() function
disp();
return 0;
}
void disp()
{
++i; // variable n is not declared in the display() function
printf("i = %d", i);
}
The output will be 7 as 'i' is defined globally and is accessible in function which it is not declared also. This talks about Scope
Consider another example
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main () {
char *st;
/* Initial memory allocation */
st = (char *) malloc(15);
strcpy(st, "HomeworkLibstudy");
printf("String = %s, Address = %u\n", st, st);
/* WE can see output similar to String= HomeworkLibstudy, Address=XX900
/* Deallocate allocated memory */
free(st);
printf("String = %s, Address = %u\n", st, st);
/* RETURNS ERROR AS IT MEMORY IS FREED
return(0); }
We have tried to acces the variable after it is deallcoated. This is about life time of a variable
1- Variables are made up of 6 attributes list and briefly describe what each one tells...
List all the elements of financial statements, then briefly describe each one, indicate how each show increases and decreases of themselves, and finally, give one example of each definition [element].
8. What are the three attributes of the “ideal” currency and briefly describe the benefits of each? 9. Other things equal, and assuming efficient markets, if a Honda Accord costs $23,375 in the U.S. then - at an exchange rate of 6.46 Swedish krona per U.S. dollar - the Honda Accord should cost how much in Sweden? Please show your work so I can learn how to solve the problem. Thank you so much.
The following list contains several variables that differentiate college students. List: physical attractiveness, intelligence, alcohol consumption, shyness, exam anxiety, hours of sleep per night, hours of television per week, alphabetical position of last name (A 5 1, B 5 2, and so on) a) Select one variable from the list and then think of seconds variable (on the list or one of your own) that should be positively related to the one you selected. Briefly describe how you would do...
There are 3 types of 3rd Party Dispute Resolutions. Please list each one, briefly describe and list an advantage and a disadvantage of each.
13. Briefly describe how a two degree of freedom system can be made to vibrate in one of its pure modes. sャ 2. (a) Sketch the amplitude ratio and phase angle for damping of 0.01 and 0.3, and indicate the peak amplitude values. Name the axes with correct numerica (b) Compare this amplitude diagram with a similar one that corresponds to base excitation, emphasizing t a single degree of freedom system subjected to harmonic force with phasizing the differences (15)...
what are the six steps in the marketing research process? list and briefly describe each and its importance.
A- List and describe (briefly) the AICPA 6 Ethical Principles : (25 pts) Principle Description 1- 2- 3- 4- 5- 6-
List and describe (briefly) the AICPA 6 Ethical Principles : (25 pts) Principle Description 1- 2- 3- 4- 5- 6-
need the answer for these questions, its one question with 5
parts
1. Briefly describe a previous experience of looking at your phone while you were trying to have a conversation with someone and what the impact was. 2. Based on your previous observations, what is your hypothesis for this experiment? 3. What is the independent variable in this experiment (independent is the variable "I change”)? a. What is the control group? b. What is the treatment group? 4. What...
List at least six protocols used on the Internet and briefly describe what each of them are used for.