M3-R4: PROGRAMMING AND PROBLEM SOLVING THROUGH ‘C’ LANGUAGE July- 2013, Answer

1. Multiple Choice

1.1 : D
Explanation :  Smallest individual unit of program is known token. Eg. (,},1,A,;

1.2 : A

1.3 : A

Explanation : Identifier is user defined name given to function, variable, structure, union, array etc. followings are rules to name an identifier.
• An identifier may have numbers but not used as first character
• Special symbol is not allowed
1.4 :  C

1.5 :  A

1.6 : A

1.7 :  D

Explanation : Printf function has right to left associativity.

1.8 : D

1.9 : C

1.10: D

2. True/False

2.1 : T
Explanation :   http://girfahelp.blogspot.in/2017/08/preprocessor-directive.html

2.2 : T

2.3 : T

2.4 :  T

2.5 :  F
Explanation :  This is an example of loop without body . Loop will be execute as per given condition.

2.6 : T

2.7 : T

2.8 : F

Explanation :   Algorithms are an approach through which we write steps to solve a particular problem before get start of actual coding. It is not mandatory that an algorithm must use graphics. Flow chart is use to graphically represent logic of a program.

2.9 : F
Explanation :   No all pointers in cl language takes same size. In 16 bit compiler version all pointer takes 2 byte. Because a pointer has to store location of memory and 2 byte is sufficient to store an address.

We specify data type while making a pointer because data type tells computer that how many byte it will jump when a number is added to a pointer.

For example int pointer jump 2 byte by adding 1 in same way character 1, floats 2 and so on.

2.10 : F

3: Match the column

3.1 : B

3.2 :  J
Explanation : = , ? ,

3.3 : B

3.4 : E

3.5 : H

3.6 : D

3.7 : M
Explanation : Numeric literals can have suffixes that determine their types. These suffixes are optional, as the compiler can usually tell from context what kind of constant you’re intending.
 Data Type Suffix Meaning int u or U unsigned int int l or L long int ul, uL, Ul, UL, lu, lU, Lu, or LU unsigned long int ll or LL long long int ull, uLL, Ull, ULL, llu, llU, LLu, or LLU unsigned long long double f or F float double l or L long double
You probably won’t need to use suffixes for integer types, but here are examples:
 unsigned int nValue = 5u; // unsigned int long nValue2 = 5L; // long
By default, floating point literal constants have a type of double. To convert them into a float value, the f or F suffix can be used:

float fValue = 5.0f; // float

double d = 6.02e23; // double (by default)

3.8 :  K

3.9 : A
Explanation : In the C Programming Language, the ftell function returns the current file position indicator for the stream pointed to by stream.

Syntax

The syntax for the ftell function in the C Language is:

long int ftell(FILE *stream);

3.10. F

4. Fill in the Blanks

4.1 : L

4.2 : E

Explanation : Data types that are derived from fundamental data types are called derived data types. Derived data types don't create a new data type but,instead they add some functionality to the basic data types.
In C, two derived data type are : Array & Pointer.
Array : An array is a collection of variables of same type. They are stored in contagious memory allocation.
e.g
``````int a[10];
char chi [20]; ``````
Pointer :
A pointer is a special variable that holds a memory address (location in memory) of another variable.
``````int i=10;
int *j;
j=&i;``````
Here, j is a integer pointer as it holds an address of an integer variable i.

4.3 : B

4.4 : K

4.5 :  D

4.6 : L

4.7 :  C
Explanation :  http://girfahelp.blogspot.in/2016/10/if-statement-c-language.html

4.8 : I

4.9 : F

4.10 :  J