C PROGRAMMING SAMPLE QUESTIONS FOR EXAMS AND IntervieWS
Published by Rashmi
Version 1.0
Copyright 2020
Author: Rashmi
Preface
The Author is in Computer Science and Engineering teaching field for Engineering colleges.
During the service when the questions are asked on any sub-topic of C programming, many students used to get confusion to give the right answer. The same way they used to get confusion from the questions raised by the interviewer also for Jobs.
In order to share the knowledge in the form of questions and show the C program solutions in the form of Kindle book.
The are many C Programming books. In general the students seek the real programming questions either for their exams or for the job interviews.
The current version of this kindle book contains the basic syntax or usage of the C programs sub-topic with a solved C program for the students understanding. The programs are tested and the same output is written in this book.
The reader can right away look into the questions and the answers with program.
This book will have periodical updates.
Good Luck!
Contents
1. What is Problem Solving ?
1.1 What are the Problem Solving Tools?
In order to solve any problem the following should be done. They are:
1) Problem definition phase
2) Getting started on a problem
3) Use of specific examples
4) Similarities among problem
5) Working backwards from solution
6) General problem-solving strategies
1) Problem definition phase: Initially the problem should be identified from the given question required by the user.
2) Getting started on a problem: Based on the problem we should identify the requirements.
3) Use of specific examples: Consider a simple example for the given problem and solve it.
4) Similarities among problem: Based on the examples identify the similarities and identify a solution to solve a large number of problems.
5) Working backwards from solution: After identification of the solution we have to check if it correct or not.
6) General problem-solving strategies: Steps involved in the problem solving process are shown as following.
Become aware of the problem
Define the problem
Choose the particular problem to be solved
Identify potential solutions
Evaluate the valid potential solutions to select the best one.
Develop an action plan to implement the best solution
1.2 What are the Problem Solving Techniques?
Procedure to Solve a Problem (Steps Involved in Problem Solving):
A computer cannot solve a problem on its own. One has to provide step by step solutions of the problem to the computer. In fact, the task of problem solving is not that of the computer. It is the programmer who has to write down the solution to the problem in terms of simple operations which the computer can understand and execute.
In order to solve a problem by the computer, one has to pass though certain stages or steps. They are
Understanding the problem
Analyzing the problem
Developing the solution
Coding and implementation.
1. Understanding the problem: Here we try to understand the problem to be solved in totally. Before with the next stage or step, we should be absolutely sure about the objectives of the given problem.
Analyzing the problem: After understanding thoroughly the problem to be solved, we look different ways of solving the problem and evaluate each of these methods. The idea here is to search an appropriate solution to the problem under consideration. The end result of this stage is a broad overview of the sequence of operations that are to be carries out to solve the given problem.
3. Developing the solution : Here the overview of the sequence of operations that was the result of analysis stage is expanded to form a detailed step by step solution to the problem under consideration.
4. Coding and implementation: The last stage of the problem solving is the conversion of the detailed sequence of operations in to a language that the computer can understand. Here each step is converted to its equivalent instruction or instructions in the computer language that has been chosen for the implantation.
1.3 How the Computer Acts as a Problem Solving Tool?
Question: What is the need for programming language?
Answer:
If we want the computer to solve the problem any number of times we need a programming language. Computer can repeatedly solve the problem any number of times. If we have to tell the computer to repeatedly solve the problem any number of times.
Question: What is a Problem?
Answer:
A Problem is an obstacle which makes it difficult to achieve a desired goal, objective or purpose.
Question: What is Problem Solving?
Answer:
Every problem in the real world needs to be identified and solved. Trying to find a solution to a problem is known as problem solving.
Question: How to Solve a Problem?
Answer:
If you have a problem you can solve it manually or solve the problem using a computer.
Question: What is computer? Explain parts of computer?
Answer:
Computer is a device capable of performing computations and making logical decisions at speed of millions and even billions of times faster than human being can.
Or
Computer is an electronics device which performs arithmetic and logical operations.
A computer system made of two major components. They are:
1. Software
2. Hardware.
The hardware component of the computer system consists of five parts: input devices, central processing unit (CPU), primary storage, output devices, and auxiliary storage devices
The input device is usually a keyboard where programs and data are entered into the computers. Examples of other input devices include a mouse, a pen or stylus, a touch screen, or an audio input unit.
The central processing unit (CPU ) is responsible for executing instructions such as arithmetic calculations,comparisons among data, and movement of data inside the system. Todays computers may have one ,two, or more CPUs . Primary storage which is also known as main memory, is a place where the programs and data are stored temporarily during processing. The data in primary storage are erased when we turn off a personal computer or when we log off from a time-sharing system.
The output device is usually a monitor or a printer to show output. If the output is shown on the monitor, we say we have a soft copy . If it is printed on the printer, we say we have a hard copy.
Auxiliary storage , also known as secondary storage , is used for both input and output. It is the place where the programs and data are stored permanently. When we turn off the computer, or programs and data remain in the secondary storage, ready for the next time we need them.
Question: What is a Computer Software?
Answer:
Computer software is divided in to two broad categories: system software and application software .System software manages the computer resources .It provides the interface between the hardware and the users. Application software, on the other hand is directly responsible for helping users solve their problems.
Question: What is the need of software?
Answer:
The need of software is to implement any specific task in a computer i.e. if you want to solve your problem through computer, then you have to develop software according to your problem and you have to install that software in your system. Then your system is ready to serve your requirement.