8. State The Differences Between Program Testing & Debugging.
Answer: Program Testing is the process of checking program, to verify that it satisfies its requirements and to detect errors. These errors can be of any type - Syntax errors, Run-time errors, Logical errors and Latent errors. Testing include necessary steps to detect all possible errors in the program. This can be done either at a module level known as unit testing or at program level known as integration testing.
Debugging is a methodical process of finding and reducing the number of bugs in a computer program making it behave as expected. One simple way to find the location of the error is to use print statement to display the values of the variables. Once the location of the error is found, the error is corrected and debugging statement may be removed.
9. State The Differences Between Top down & Bottom Up Approaches?
Answer: A top-down approach is essentially breaking down a system to gain insight into its compositional sub-systems. In a top-down approach an overview of the system is first formulated, specifying but not detailing any first-level subsystems. Each subsystem is then refined in greater detail, sometimes in many additional subsystem levels, until the entire specification is reduced to base elements. In short the top down approach means decomposing of the solution procedure into subtasks. This approach produces a readable and modular code that can be easily understood and maintained.
A bottom-up approach is essentially piecing together systems to give rise to grander systems, thus making the original systems sub-systems of the emergent system. In a bottom-up approach the individual base elements of the system are first specified in great detail. These elements are then linked together to form larger subsystems, which then in turn are linked, sometimes in many levels, until a complete top-level system is formed.
10. State The Differences Between Interpreted & Compiled Languages?
Answer: In interpreted languages, the instructions are executed immediately after parsing. Both tasks are performed by the interpreter. The code is saved in the same format that we entered. Interpreted languages include the MS-DOS Batch language (the OS itself is the interpreter), shell scripts in Unix/Linux systems, Java, Perl etc.
Advantages of interpreted languages include relative ease of programming and no linker requirement. Disadvantages include poor speed performance and that we do not generate an executable (and therefore distributable) program. The interpreter must be present on a system to run the program.
In compiled languages, the instructions into machine code and store them in a separate file for later execution. Many modern compilers can compile (parse) and execute in memory, giving the 'appearance' of an interpreted language.
However, the key difference is that parsing and execution occurs in two distinct steps. Examples of compiled languages include Visual Basic, C/C++, Delphi and many others. In a compiled environment, we have several separate files like: source code (the text instructions), object code (the parsed source code) and the executable (the linked object code).
There is definitely an increase in complexity in using compilers, but the key advantages are speed performance and that one can distribute stand-alone executables.
11. Briefly Explain What Do You Understand By Stepwise Refinement Of The Program?
Answer: The concept of "Stepwise Refinement" means to take an object and move it from a general perspective to a precise level of detail and this cannot be done in one jump but in steps. The number of steps needed to decompose an object into sufficient detail is ultimately based on the inherent nature of the object. "Stepwise Refinement" of program represents a "divide and conquer" approach to design.
In simple words, break a complex program into smaller, more manageable modules that can be reviewed and inspected before moving to the next level of detail. Stepwise refinement is a powerful paradigm for developing a complex program from a simple program by adding features incrementally.
Some of the steps taken for refinement of a program are:
- Analysis of the algorithm used to develop the program, and analysis of various parts of the program and then making appropriate changes to improve the efficiency of the program.
- Keep the program simple to improve memory efficiency.
- Evaluation and incorporation of memory compression features.
- Debugging and testing performed first to module level and then to interface level.
- Take care of correct working and clarity while making it faster.
12. What Is The Difference Between Declaring A Variable & Defining A Variable?
Answer: The difference between declaring a variable and defining a variable is that while declaring a variable, the compiler verifies if the variable has been defined elsewhere but does not allocate memory for that variable. It is a kind of explicit declaration of a variable.
But while defining a variable, the compiler allocates specific memory for the variable and initializes the variable to some value. Normally, variables are declared after defining.
13. What Is Looping?
Answer: Loop is a control structure used to perform repetitive operation. Some programs involve repeating a set of instruction either a specified number of times or until a particular condition is met. This is done using a loop control structure. A program loop consists of two parts: Body of the loop and control statement. The control statement tests certain conditions and then decides repeated execution or termination of statements. Most real programs contain some construct that loops within the program, performing repetitive actions on a stream of data or a region of memory.
14. How Would You Distinguish Between Looping/Iteration & Recursion?
Answer: Some of the points that distinguish between recursion and looping/iteration are:
- Recursive function is a function that is partially defined by itself whereas Iterative Instructions are loop based repetitions of a process.
- Recursion Uses selection structure Iteration uses repetition structure Infinite recursion occurs if the recursion step does not reduce the problem in a manner that converges on some condition whereas an infinite loop occurs with iteration or looping if the loop-condition test never becomes false.
- Recursion terminates when a base case is recognized whereas Iteration/looping terminates when the loop condition fails.
- Recursion is usually slower then iteration/looping due to overhead of maintaining stack whereas Iteration/looping does not use stack so it's faster than recursion.
- Recursion uses more memory than iteration/looping.
- Infinite recursion can crash the system whereas infinite looping uses CPU cycles repeatedly.
- Recursion makes code smaller whereas Iteration makes code longer.
11) Which bitwise operator is used for checking whether a particular bit is ON or OFF?
12) Which bitwise operator is used for turning OFF a particular bit in a number?
13) What is equivalent of multiplying an unsigned int by 2: left shift of number by 1 or right shift of number by 1?
14) What is Enumeration?
15) What is a structure?
16) What are the differences between a structure and a union?
17) What is meant by union?
18) What are the advantages of unions?
19) How can typedef be used to define a type of structure?
20) What is enumeration constant?
...Return To C Questions INDEX.
...Return To C Programming INDEX.
... Return To HR Interview Index
Comments
Post a Comment
Please share your opinions and suggestions or your experience in the comments section. This way we can all help each other...
Experienced guys can share their resumes at admin@interview-made-easy.com