Question

In: Computer Science

The Questions Are of a Organization of Programming course. A variable can be characterized by a...

The Questions Are of a Organization of Programming course.

A variable can be characterized by a collection of attributes. What is one such attribute? The response is Implicit heap-dynamic allocation. Why is the response that?

Does static type binding require the programmer to specify the type of the variable in the program? Please Explain the answer and why it is the answer.

A certain variable is assigned a value. At that time, new storage is allocated for that variable to fit the new value. What kind of allocation was most likely used? Please provide an answer and please explain why the answer is the answer.

Solutions

Expert Solution

Variables generally have four attributes: an identifier, data location, type and value. They are assigned during program execution at different times.An identifier is a string of alphanumeric characters that begins with an alphabetic character or an underscore character that are used to represent various programming elements such as variables, functions etc.Data location shows the location of data stored.variable types specify the kind of information stored in a variable and value denotes what the variable holds.  

A binding is static if binding of attributes to variables first occurs before run time and remains unchanged throughout the program execution.If static, the type may be specified by either an explicit or an implicit declaration.

An explicit declaration is a program statement used for declaring the types of variables.it lists variable names and specifies their types.for eg- var x: int

An implicit declaration is a default mechanism for specifying types of variables (the first appearance of the variable in the program).for eg:x=3.Here value of x is int and will not change afterwards.

If it becomes necessary to generate variable with new value,we can use pointers and dynamic memory. Dynamically allocated variables live in a piece of memory known as the heap, these are requested by the running program using the keyword "new".This memory does not come from the program’s limited stack memory -- instead, it is allocated from a much larger pool of memory managed by the operating system(heap) .In modern machines, the heap can be gigabytes in size. A dynamic variable can be a single variable or an array of values, each one is kept track of using a pointer. After a dynamic variable is no longer needed it is important to deallocate the memory, return its control to the operating system, by calling "delete" on the pointer.


Related Solutions

What types of attributes can be characterized as strengths in the culture of an organization? What...
What types of attributes can be characterized as strengths in the culture of an organization? What can be considered as weaknesses? What are the essential elements of culture necessary for an organization to be successful? What should organizations avoid or change about their cultures? What impact can an organization’s culture have on the overall success of the organization? Post a summary of your thoughts regarding how the culture of an organization can become its greatest strength or most critical weakness....
The following two questions can be solved by dynamic programming. For each question, please describe optimal...
The following two questions can be solved by dynamic programming. For each question, please describe optimal substructure and express recurrence relation. Give pseudo-code and analyze time and space complexity of your algorithm. 1. Longest palindrome subsequence A palindrome is a nonempty string over some alphabet that reads the same forward and backward. Examples of palindromes are all strings of length 1, “civic”, “racecar”, and “aibohphobia” (fear of palindromes). Design a dynamic programming algorithm to find the longest palindrome that is...
how do you foster an organization culture that characterized by open communication high performance and an...
how do you foster an organization culture that characterized by open communication high performance and an engaged workforce.
The demand for tennis rackets can be characterized by the following point elasticities
The demand for tennis rackets can be characterized by the following point elasticities: price elasticity = -1.5, cross-price elasticity with tennis club membership fees= -2.0, and income elasticity = 3.0. Indicate whether each of the following statements is true or false, and explain your answer.A. A price increase for tennis rackets will decrease both the number of units demanded and the total revenue of sellers.B. The cross-price elasticity indicates that a 2% reduction in the price of tennis rackets will...
Can someone solve these two questions for an intro c++ course? 1. #include <iostream> using namespace...
Can someone solve these two questions for an intro c++ course? 1. #include <iostream> using namespace std; int main(int argc, char* argv[]) { char twostrings[] = "Hello! CS103L!"; char* p1; char* p2; //fill in the code required to print out Hello! and CS103L! on different lines //Hint: modify one character in the original string and set p1 and p2 correctly //Do not make any copies or new strings or arrays. You only need to modify the original array. // cout...
Hello i am working on an assignment for my programming course in JAVA. The following is...
Hello i am working on an assignment for my programming course in JAVA. The following is the assignment: In main, first ask the user for their name, and read the name into a String variable. Then, using their name, ask for a temperature in farenheit, and read that value in. Calculate and print the equivalent celsius, with output something like Bob, your 32 degrees farenheit would be 0 degrees celsius Look up the celsius to farenheit conversion if you do...
In this course, you have learned that computer programming is key to computer science. The ability...
In this course, you have learned that computer programming is key to computer science. The ability to program a succession of instructions to resolve a computing problem is a valuable skill that is integral to many aspects of modern life. You have also seen the versatility and distinguishing characteristics that make Python 3 a popular choice for programmers. End-of-Course Essay Write a 1- to 2-page essay in which you connect this course to your own career or personal life. Imagine...
The following questions are on recursion in C++ Programming. I had some trouble with these questions,...
The following questions are on recursion in C++ Programming. I had some trouble with these questions, can you please help me? Thank you! Consider the following recursive function void funcEx8(int u, char v) //Line 1 { //Line 2 if (u == 0) //Line 3 cout << u << " "; //Line 4 else //Line 5 { //Line 6 int x = static_cast (v); //Line 7 if (v < 'A') //Line 8 v = static_cast (x + 1); //Line 9 else...
Suppose that the market for doctor visits can be characterized by the following supply and demand...
Suppose that the market for doctor visits can be characterized by the following supply and demand equations: Q = 300 - P Q = 2P 10.4.   Problem Set #5 - Part II - 10.4 (D) Now, suppose that all consumers have health insurance. Health insurance allows consumers to see the doctor at half price (ie- there is 50% coinsurance). How many doctors' visits occur? A.  200 B.  150 C.  240 D.  120 E.  300
Carbon, hydrogen, and oxygen are not the only elements that can be characterized by combustion analysis....
Carbon, hydrogen, and oxygen are not the only elements that can be characterized by combustion analysis. If a compound also contains sulfur or nitrogen, then it will form CO_2?2?? (from the carbon), H_2?2??O (from the hydrogen), N_2?2?? (from any nitrogen), and SO_2?2?? (from any sulfur). The amount of oxygen in the original sample is determined from subtracting the masses of the other elements from the total, as in the combustion analysis described earlier. If a 0.500 g sample of a...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT