In: Computer Science
Q What were the main design goals of the ALGOL programming
language?
o To describe algorithms in publications
o To be machine independent
o To teach non-science students
o To mimic standard mathematical notation
o To standardise software development tools
Q The types of variables used in a programming language can be
statically declared as part of the source code of a computer
program. Define and give an example of explicit variable
declaration and implicit variable declaration [2 marks]:
1 )
a ) To describe algorithms in publications
b ) To be machine Independent
c ) To mimic standard mathematical notations
d ) To teach non science students
2 )
Difference between the Implicit and explicit type of declaration is :
Implicit type of declaration is used by the compiler itself
But explicit type of declaration is not done by the computer but by the user
C code :
#include <stdio.h>
void main()
{
int a, float b; char c;
b = c // After the compilation compiler itself turns it into b = (float) c Because the Datatype size of 'b' is greater than 'c'
c = (char) b // Implicit declaration because the size of the Data type of 'c' is less than the Data type of 'b'
}
Explicit declaration is used when the Size of the data type from the Left hand is greater than the Right hand side
Implicit declaration is used when the Size of the data type from the Left hand is less than the Right hand side