Introduction to programming and C


1. What is a Program?
Ans: set of instructions passed to a computer that tells it to do some task.

2. What are the basic steps before executing a program (by the programmer) written by the same programmer)
Ans: a)Algorithm/logic/plan preparation
b)Coding
c)Transformation (Compilation/ Interpretation)(conversion of high level language to low level).
d)Execution

3. What is a programming language?
Ans: It is a medium of communication between user and the computer.Used for writing programs.

4. What is a Syntax?
Ans : The set of rules that govern the writing of a particular statement in a particular programming language.

5. What is a Symantic?
Ans : The meaning of a syntax

6. Define efficiency of a Program
Ans: A program is said to be efficient if it runs with maximum speed and uses minimum memory(resources).

7.Features of LLL Vs HLL
Ans:
LLL
HLL
Platform dependent
platform independent (not tied to any one h/w architec.)
Program development is slow
faster
Runs efficiently
less efficiently


8. What is meant by System software and Application software?
Ans: System software:The software used to run and maintain the system.eg:Operating system.
Application software:The software used to perform a specific task.eg:M word,excel,ppt etc.

9. What is a statement?
Ans: Any expression, including an assignment or a function call can be a statement.

10. Differentiate Compilation & Interpretation
Ans: Compilation :Converting entire source program into object code at a time.
 Interpretation:Converts the source program into object code line by line.

11. What is Structured Programming?
Ans: A program, which consists of:
a)Sequence
b)Decision
c)Looping

12. What is an Assembly Code?
Ans: Symbolic representation of machine code instructions.
Eg: MOV, PUSH, POP, ADD, SUB, MUL, DIV, LOOP, RET, CALL, SUB etc.

14. When is low-level programming used?
Ans:Low-level programming is typically used only for very small programs (because it is a very slow process),
or for segments of code that are highly critical and must run as efficiently as possible.

15.  What is C?
Ans:
a)It is a Middle level programming language.It combines both the features of low level and high level.
b)It is derived from BCPL and B.
c)Invented by Dennis Ritche in 1972 at AT &T bell's.

16.  Explain the necessity of learning C (Why anyone can learn C)?
Ans:It is a userfriendly language.It is the basic language for any other programming languages.It is very simple.

17. Name some popular software developed using C?
Ans: Unix, Windows, Linux, Solaris, Macintosh, IBM OS/400 etc Operating Systems
Desktop Computer Games

18. Mention different types of errors in C?
Ans: a)Compile time(Syntax) errors.eg: missing semicolon, improper “ and {
b)Runtime errors.eg:division by zero.
c)Data errors
d)Logical errors

19. What does linking mean?
Ans: It  provides instructions to the compiler to link required functions from the system library.
eg:It informs compiler to link printf(),scanf() functions from standard library stdio.

20. What is typecasting?
Ans:Temporary conversion of a variable from one type into another type
Eg : c = (float) a / b;

21.What are the characteristics of C?
Ans: a) Every c program requires a main() function from where the execution start.
b) c programs are written in lowercase letters.
c) Every executable statement in c should terminate with a semicolon.
d) c is a free form language(we can write any number of statements in one line separated with semicolon).

22. In header files weather the functions are declared or defined?
Ans:declared.

23. What are the types of constants in c?
Ans: 1. Numeric constants
1.1.Integer constants
1.2.real or floating point constants
2. Character constants
2.1.single character constants
2.2.string constants

24. What is the use of typedef and enumerations?
Ans: typedef and enum are user defined datatypes.
Used to create a new datatype name for an existing datatype.
eg: typedef longint s;
s a,b,c;
enumerations used to declare variables that store list of names.

enum days {sun,mon,tue,wed,......};
days a1,a2,a3;

25. Difference between pre increment and post increment?
Ans:Pre increment:It first increments the value of the variable next it will assign the value to the left hand side variable.
post increment:It first assigns the value to the variable on the left hand side and then increments the value.
eg: a=5; a=5
b=++a; b=a++;
here b=6 a=6 here b=5 a=6