Chapter
5 Review Question and Problem Set
Review
Question
2. What is the potential danger
of case sensitive names?
Answer:
The potential danger of case sensitive is the ambiguity between the
user and the program. For example with case sensitive variable the name of
variable “Angka” and “angka” has the different meaning for machine but the same
meaning for user.
3. In what way are reserved words
better than keyword?
Answer:
Reserved words are better than
keyword because reserved word cannot be used as the name and it can also be
used to redefine keywords.
7. Define binding and binding
time
Answer:
binding is association in a program it could be between variable and
its type or operation and symbol. Binding time is the time that is taken to
associate (binding).
9. Define static binding and
dynamic binding.
Answer:
Static binding is binding that happen before run time and it still
remains unchanged throughout program execution. Dynamic binding is binding that
happen during the run time and it might change in the program execution.
16. What is referencing environment
of a statement
Answer:
referencing environment of statement is the collections of all variable
that are visible in the statement.
18. What is block?
Answer:
In programming block is a section where variable and statement are
allocated.
Problem Set
1. Decide which of the following
identifier names is valid in C language.
Support your decision.
_Student
int
Student
123Student
Student123
Answer:
the valid identifier names in C language are _Student, Student and
Student123 because the valid identifier names in C should not be integer in
beginning, reserved word (int, float, etc.) and it doesn’t contain space.
2. What is l-value? Write a
statement in C language which gives the compile time error “l-value required”.
Answer: l
-value is an expression that refer to memory location.
int main()
{
int arr[]={1,2,3};
int i;
for(i=0;i<3;i++)
{
printf("\n%d",*arr);
arr++;
}
return 0;
}
4. Why is the type declaration of
a variable necessary? What is the value range of the int type variable in Java?
Answer:
Declaration of a variable is necessary because it define the type of
the variable that declared which make the variable unambiguous. The range value
of int type variable in java is 2.147.483.648 to 2.147.483.647.
Special thanks to Mr. Tri Djoko Wahjono, Ir., M.Sc.
Tidak ada komentar:
Posting Komentar