1. Describe fundamental concepts in computer programming.
2. Differentiate between high and low-level languages.
3. Demonstrate basic debugging techniques.
4. Develop simple calculations in Python.
1. Describe fundamental concepts in computer programming.
There are few basic fundamental concepts in computer programming that include variables (data types), control structure, data structures, syntax and tool i.e. programming language. Syntax varies from one language to other language. Variables are the data types that are used to store and hold the results of the calculations performed in a computer program. A computer program is set of instructions that are executed serially in the order they are written in order to implement an algorithm.
2. Differentiate between high and low-level languages.
A program written in high level language (HLL) is easy to read, understand and provides flexibilities in terms of portability to other high level programming language. HLL programs are normally for implementing a large project program or algorithms as they are human like language programs and can be implement in much easier way as compared to low level language programs. Programs written I HLL are easy to understand and debug. HLL are machine independent language. A compiler compiles the code from high level language to binary or machine language.
However, low level languages (LLL) are in form of mnemonics and interact directly with registers and memories of the microprocessor/microcontroller. They can directly interact with the hardware/firmware of the application. Also as the instructions written in LLL are machine dependent and can not be ported to other language i.e. LLL are machine dependent. At the same time, program written in LLL are fast and memory efficient.
Also, the low level language programs are very hard to debug and understand for a new person to engage in. But, LLL programs are mostly used to develop operating systems, device drivers, databases and applications that requires direct hardware access. Further, LLL are classified into two types: assembly level and machine language (binary). An interpreter or assembler is required to convert LLL to assembly or binary level code.
The use of LLL over HLL is a trade off between the memory requirement and speed of operation. LLL are fast over the HLL but at the same time debugging is hard. HLL are slower as compared to LLL but large algorithms can only be implemented using HLL.
3. Demonstrate basic debugging techniques.
Debugging techniques are used to debug the computer program in order to find any logical error coming out of the algorithm implementation. There are different debugging techniques available in python and are listed below:
- Print and check
- Assert and check
- Logging module
- pdb (Python debugger)
- Traces in code
- Use of break points
4. Develop simple calculations in Python.
Below is a code to get the sum of all elements of an array 'a':
a = [1, 3, 5, 34, 56, 78, 98]
Sum = 0
for r in rage(0,len(a)):
Sum = Sum + a[r]
print("Sum = ",Sum)
Comments
Leave a comment