Fundamental Small Question 2 (Answer)

Answer of Fundamental Small Question 2


1. How is character constant represented?

Ans:- A Character constants is written within single quotes. For example, ‘K’, ‘\’, and ‘5’.

2. How is string constant represented?

Ans:- A string constants is a sequence of zero or more characters enclosed within double quotes. For example, “X”, “656”, “ ”, and “RAJ”.

3. List the printable escape sequences.

Ans:- These are printable escape sequence : \\, \”, \’, and \?.

4. List the non graphic escape sequences.

Ans:- These are the non-graphic escape sequence :

\0 :- null character

\a :- alert

\b :- backspace

\t :- horizontal tab

\n :- new line

\v :- vertical tab

\f :- form feed

\r :- carriage return

5. What is the symbolic constant?

Ans:- If a constants is given a name, it becomes a symbolic constant or manifest. For example,

#define MAX 20

Defines the symbolic constant MAX to represent the constant value 20.

6. How is variable declared?

Ans:- Format (syntax):-

Data_type var1, var2, var3,……..,varn;

Ex.:- int a, b; float x, y;

7. What is initialization of a variable?

Ans:- If a variable is assigned a value in the declaration itself, it is known as initialization. For example,

Int x = 10, y = 5;

8. How are comments included in a C program?

Ans:- Single line or multiline comments are included between /* and */. Nested comments are not allowed in ANSI C. For example,

/* This is a function */

9. List white space characters in C.

Ans:- Blank space, new line, horizontal tab, vertical tab, carriage return and form feed are white space characters in C.

10. What is statement terminator? What is separator?

Ans:- Each statement is ended with a semicolon, so a semicolon is a statement terminator. Whereas, a white space character or a comment is a separator used to separate tokens.

11. List the token in C.

Ans:- Identifiers, keywords, constants, string constants, operators and separators are C tokens.

12. Identify the tokens in the expression if(mark >= 50).

Ans:- Here:

The keyword if is a token, the character ( is the next token, the variable mark is the subsequent token, the operator >= is the next token, the constant 50 is the next token, and the character ) is the next token.

13. What are lvalue and rvalue?

Ans:- Each variable has got two values, which are left value and right value whose short names are lvalue and rvalue. The lvalue denotes an object that is the address of the data object. The rvalue is the value residing in that address. An lvalue represents a memory location where a value may be stored; it denotes an object that refers to a storage location of the data object. The term lvalue is used, based on the principle of its appearance, on the left side of an assignment statement. Consider the following statements:

Int x, y;

X = 5;

Y = X;

In the first assignment statement, X is an lvalue. Hence, X is treated as a name for a particular memory location and the value 5 is stored in the memory location. In the second assignment statement, X is not an lvalue and hence the value stored in the memory location is referred to, by X. Thus, in some statements an operand must be an lvalue. If an lvalue appears in any other context, it is replaced by the value stored in that memory location.

14. What is the value of sizeof(char)?

Ans:- The value returned by sizeof(char) is always 1 since char uses only one byte in any machine. For other data types, the number of bytes used to represent a data type depends on the implementation of a compiler.

15. What is the current version of C?

Ans:- C99 is the current version of C. The character set is changed by supporting Unicode characters in this version. It includes additional data types, such as bool, complex, variable-length arrays, and variable structure members and some more new syntax also. Since there is a substantial change, most compilers have not yet implemented C99. The specification of new C99 may be obtained from ISO web site.



Fundamental Small Question 2

Some Small Question 2


1. How is character constant represented?


2. How is string constant represented?


3. List the printable escape sequences.


4. List the non graphic escape sequences.


5. What is the symbolic constant?


6. How is variable declared?


7. What is initialization of a variable?


8. How are comments included in a C program?


9. List white space characters in C.


10. What is statement terminator? What is separator?


11. List the token in C.


12. Identify the tokens in the expression if(mark >= 50).


13. What are lvalue and rvalue?


14. What is the value of sizeof(char)?


15. What is the current version of C?