C Programming Question With Answers
- Posted by Engineering Helpline Pvt. Ltd
- Categories c programming, C Programming Question With Answers, First Semester
- Date April 1, 2018
- Comments 0 comment
1. Define software. Explain different types of software.
Software is a collection of machine readable instructions that directs a computer to perform some specific tasks. It is an ordered sequence of instructions given for changing the state of the computer hardware in a certain predefined sequence. Generally software can be categorized as system software and application software. The detail descriptions of system software and application software along with their sub-categories are given below:
•System software: It is a type of computer software designed to operate the computer hardware, to provide basic functionality and to provide a platform for running application software. System software include device drivers, operation systems etc. It is responsible for controlling, integrating and managing the individual hardware components of a computer system so that they can work together harmoniously. Its purpose is to hide the complex details of the hardware.
•Operating system is the main system software which controls all parts of the computer system. The major function of OS are to handle all the hardware connected to the system, coordinate and manage use of other resources and provide common services for computer programs. Application programs usually require an operating system to function.
•Device driver is a computer program that operates or controls a particular type of device that is attached to a computer. A device driver simplifies programming by acting as translator between a hardware device and the applications that use it.
•Application software: It is a type of computer software that causes a computer to perform useful tasks that a user wishes to perform. It utilizes capacities of a computer directly to a dedicated task. Application software includes word processing software, database software, multimedia software, graphics software etc. It can be categorized as:
•Tailored (custom) software is software that is specially designed for some specific organizations or other user. It is developed for a single user that accommodates the particular preferences and expectations of the user.
•Packaged (off the shelf) software is software which performs some specific function or calculation which is useful for more than one computer user and is sufficiently well documented to be used without modifications on a defined configuration of some computer system.
1
2. Compare application software with system software.
The comparisons of application and system software are:
•Application software utilizes the capacities of a computer to perform a dedicated task to benefit the user whereas system software manages and integrates computer’s capabilities but doesn’t utilize the capacities in the performance to benefit the user.
•System software provides the platform for the application software to run on the system whereas application software provides the platform for the end users to use the capacities of the system to solve various problems.
•System software deals with the hardware (architecture of the system) whereas the application software interacts with end user.
•System software consists of low level programs that interact with the computer at a very basic level.
3. What is a programming language? Explain different types of programming language.
Programming Language is a standardized communication technique for describing instructions to a computer. Each programming language has a set of syntactic and semantic rules used to define computer programs. The different types of programming language are described below.
•Low Level Languages are those languages which are closer to the hardware. They are specific to the hardware so cannot run on different hardware. Knowledge of hardware is required to develop such programs using low level languages. It can be divided into Machine language and Assembly language.
▪Machine Language is the closest language to the hardware in which the instructions are given in the form of 0’s and 1’s.
Advantages:
o It makes fast and efficient use of computers. o Translator is not required.
Disadvantages:
o Programmer should have hardware knowledge.
o All memory addresses and operation codes are needed to be remembered. o Testing and Debugging are difficult to carry out.
o They are machine dependent.
2
▪Assembly Languages are those languages which used mnemonics in place of 0’s and 1’s.
Each instruction is represented by symbols instead of just using bits. The program written in assembly languages must be converted to machine language.
Advantages:
o Easier to understand and use as compared to machine language. o Programs are normally very fast and very compact.
o Timings can be calculated very precisely and program flow is easily controlled.
Disadvantages:
o Good Understanding of the hardware is required. o Machine dependent
•High Level language is a language with strong abstraction from the details of the computer and uses natural language elements, making the process of developing a program simpler and more understandable relative to a lower level language. These languages are English like and are very close to the human languages. They are machine independent. High level languages are required to convert into machine level languages with the help of the translators. Rather than dealing with registers, memory addresses and stacks, they deal with variables, arrays, objects, functions, loops, threads etc. it can be categorized as:
▪Procedural oriented languages (Imperative languages): In these languages one or more related blocks of statements that perform some complete function are grouped together into a procedure. If the same sequence of operations is needed elsewhere in the program, a simple statement can be used to refer back to that procedure. A procedure may be a list of instructions directing a computer, step by step, what to do, usually having a linear order of execution from the first statement to the second and so forth with occasional loops and branches. Procedural programming languages include C, C++, FORTRAN, Pascal and BASIC.
▪Problem Oriented Languages (Declarative languages): These languages were developed to solve specific problems or develop specific applications. These languages focus on what work is to be performed rather than how to perform the work. These languages are usually limited to a very specific application and it might use syntax that is never used in other programming languages. These languages are specially focused on database management systems. SQL, CSS, FUSION is some of the examples of problem oriented languages.
▪Natural Languages: There languages are supposed to have the form of human cognition and human intelligence. With these languages human can easily communicate or interact with
3
computers without the requirement of knowledge of any special programming languages. These are generally used in Artificial Intelligence and Expert System. LISP and PROLOG are few natural languages commonly in practice.
Advantages of High level Languages
•Support high level of abstraction.
•Easier to learn and use. Since the languages are very close to human languages.
•Easier to test and debug.
•They are machine independent. Software written in high level language can be used in any computer system with different architecture.
Disadvantages of High Level Languages
•Requires more memory space and time.
4.Compare assembly language with machine language.
Assembly language and machine language are both low level language. Its comparison is as shown.
•Assembly languages used mnemonics while machine language uses 0’s and 1’s to represent operational codes and operand.
•Assembly languages need a translator to convert into machine language.
•Comparatively assembly languages are easier to understand and use than machine language. But machine languages are a bit fast and efficient.
•Both are machine dependent and programmer must have the knowledge about hardware before using each language.
5. Write the difference between high level and low level language.
The difference between high level and low level language are:
•Low level languages are machine oriented whereas high level languages are problem oriented.
•Programs developed using low level languages run faster and take less storage space.
•Low level languages are used to develop system software whereas high level languages are used
to design application software.
6. Explain, briefly, about the generations of programming language.
The various generations of programming language are explained below.
•First Generation: The first generation of programming languages is all about machine code. Code of the first generation programming language was entered through physical switches on the computer and involved commands to move data bits to and from registers, compute on these and more. Machine language can be taken as first generation programming language.
4
•Second Generation: To minimize the difficulty, the operational codes were represented by a mnemonics which in some way describes the action of the machine code (such as save, mov, add, load). The source codes were needed to be assembled into machine code before it can be executed by a processor with the help of an assembler. Such languages are sometimes still used for kernels and device drivers, i.e. the core of the operating system and for specific machine parts. Assembly language was used as a second generation languages.
•Third Generation: Languages of third generation were closer to human languages. The flaws of first and second generation were dealt by making the language machine independent and including programmer friendly features. These languages require a compiler to make machine code for the processor. Third generations which are high level languages are sometimes referred as imperative languages. Imperative means that the code is executed line by line in sequence. Few Examples are FORTRAN, C, C++, Java, C# etc.
•Fourth Generation Languages are designed to reduce programming effort and the time it takes to develop software, resulting in a reduction in the cost of software development. Languages have been designed with a specific purpose which includes query language, report generators etc. These languages are referred as declarative languages since it describes what computation should be performed but not how to perform it. Characteristics of fourth generation languages can be summarized as portable, closer to human language, database supportive, simple and requires less effort, non procedural. SQL, NOMAD, FOCUS are some of the examples of fourth generation language.
•Fifth Generation Language also known as natural language provides a visual or graphical interface to develop software. It allows user to interact with computers without needing any specialized knowledge. These languages are generally used for writing programs for artificial intelligence, neural network, plasma computing etc. LISP, PROLOG, Mercury are some of the examples of fifth generation languages.
7.What are the characteristics of a well written program?
A feature of software defines the distinguishing characteristics of software based on performance, portability or functionality. Some of the important characteristics of well written computer programs can be:
•Integrity refers to the accuracy of the calculations.
•Clarity refers to the overall readability of the program.
5
•Simplicity: The structure and logic of the program must be as simple as possible to enhance the clarity and accuracy of the program.
•Efficiency is concerned with execution speed and efficient memory utilization.
•Modularity means dividing the program into small modules which are independent of each other. It enhances the accuracy and clarity and facilitates future program alterations.
•Interoperability is the ability of the software to exchange information with other applications and make use of information transparently.
•Portability is the ability of the software to function in different platforms and environments Some others desirable characteristics may be security, flexibility, scalability, reliability etc.
8.Explain about recent trends of software.
In the early days of software development, software was difficult to develop as they used machine languages which made them efficient and faster but on the other hand became non portable and lacked lot of user friendly features. But as the programming language developed, the software has been very user friendly and provides a visual interface or a graphical user interface which has made it much easier for user to interact.
Development of software has taken a huge stride in modern era. In recent years, DevOps and agile development methodology has been heavily used for software development [1]. Nowadays the focus is on cloud computing which in general means a virtual hard drive that is accessible to the network of computers.
Cloud computing is a computing paradigm in which tasks are assigned to a combination of connections, software and services accessed over a network. This network of servers and connections is collectively known as cloud. Using different medium as an access point, users can reach into the cloud for resources whenever required.
9. Explain different phases or steps of developing software.
The following phases are included in a software development.
•Problem Analysis: This is the first step of software development in which we define our objectives, analyze our input, processing and output requirements. Depending on the size and complexity of the problem, a clear statement of the problem is made. And the types and number of inputs and outputs are evaluated. Finally, a mechanism to convert available resources into final productive results must be determined.
6
•Algorithm Development and Flow Diagram: In this phase, a general outline of the problem is sketched using algorithm and flow chart. Algorithms are used to define a set of steps or procedures to be followed to solve a given problem while flowcharts are the diagrammatic representation of the steps to solve a particular problem.
•Coding: It is the process of writing a program using a particular programming language. Though high level languages are more preferred, low level language can be used as well to write a program. Depending upon the ease and accessibility, the programmer may use any platform to write a program.
•Compilation and Execution: When the programs are written into high level language, then it needs to be converted into low level language. This conversion is done by compiler and the process is called compilation. After the compilation process, an executable program will generate which when opened is set to execution. Different inputs are provided to check if the defined objectives are fulfilled or not.
•Debugging and Testing: Testing is the process of finding errors in the program while debugging is the mechanism to remove the different errors that are present in the program. General syntax error will be pointed by the compiler, but the run time errors must be checked by providing different sets of inputs to the program and tracing the output.
•Program Documentation: It is done for future reference which can be analyzed for better software development in later days. Documentation includes all the information about the program.
10.List the advantages and disadvantages of using flowchart.
The various advantages and disadvantages of using flowchart are listed as:
Advantages:
•Communication: As diagrams are better way to provide information, flowchart will communicate the logic of the whole system concisely and efficiently.
•Effective Analysis: Problem can be analyzed more effectively resulting in reduction in cost and time
•Proper Documentation: As flowchart contains information about the working of the system, it helps to make documentation better.
•Efficient Coding: the flowchart acts as a guide for the programmer to write a code in more efficient manner, since the steps and requirements are clearly defined in diagram.
•Proper Debugging: The flowchart, sometimes, can be helpful in debugging process.
7
•Efficient Program Maintenance: The maintenance of operating program becomes easy with the help of flowchart. It helps the programmer to put efforts more efficiently on that
section.
Disadvantages:
•Complex and clumsy: when the program gets quite complicated, the flowchart can be more complex than it is imagined to be.
•Difficulty in modifications: When some alterations are to be done, the flowchart may require re-drawing.
You may also like
Applied mechanis And Its Solutions
6 January, 2020
c programming notes
17 April, 2019
Structure: Array VS Structure: Pointer and Structure:
4 February, 2019
A structure is a collection of variable (of different data types) referenced under one name, providing of convenient means of keeping related information together. A structure definition forms a template that may be used to create structure variable. The general …
