Anda di halaman 1dari 2

Assignment-1

Q1.a) Why is C language known as middle level language? State some


features of C.
Ans. The first aspect ideally requires a language that is close to the machine,
so that all important aspects of a machine are handled simply and efficiently in
a way that the programmer need not worry about it. The second aspect ideally
requires language that is close to the problem to be solved, so that concepts
of a solution can be expressed directly and briefly.
The low level language serves only the first aspect, that is, they are close to the
machines, the high level language serve the second aspect, that is, they are
programmer. The language c serve both the aspects that is why they called as
middle level language.
Features of C:
Middle level language.
Portable.
Modular programming.
Powerful.

Q1.b) What is a syntax error? How do we treat it?
Ans. Syntax error is compile time error. It occurs because of violation of
general rule or the command is not written in a proper way. It is detected by
the compiler when we compile the program.
Eg. - printf(%d,n) error
printf (%d,n); correction.

Q1.d) I n what ways switch case differ from if statement?
Ans. The only difference between in switch case and if statement is that in
switch case we cannot use floating type numbers but in If statement we can use
floating type numbers.


Q1.e) Why is #include used in c programming?
Ans. Statements which begin with # is termed as pre-processor director. # is a
pre-processor director which tells the compiler that before compiler that
before compiling add library in a program.
Eg. #include<stdio.h>

Q2. Explain the following in c:
(a) Data types
(b) Operators

Ans.a) Data types are types of data. It refers to location or bunch of types
represented as a box like structure in memory which can hold any value and
can change its value during the execution of the program.
Eg: - char stores 1 bytes of a memory.
Int stores 2 bytes of a memory.
b) An operator are represented by operators and the objects of the operations
are referred to as operands. An operator is a symbol or letter used to indicate a
specific operation or variable in a program.
Eg: -Arithmetic operator-+,-,*, %.
Relational operator-<,>, <=,>=, =, ==,!=.