Interview Questions on Tokens too Constants inward C Language
1. What is a C Token?
Tokens are the basic edifice blocks of C programming. In a C source program, the basic chemical element recognized yesteryear the compiler is the "token."
The compiler initiative of all groups the characters into tokens. H5N1 token is source-program text that the compiler does non intermission downward into constituent elements.
Example: if, for, while, sum, add, +, -, /, ++, +=, = etc.
2. List the unlike types of C Tokens?
C has vi types of Tokens.
Keyword: for representative int, char, while, else, class.
Identifier: for representative main, amt, area, radius etc.
Constant: for representative 121, 500, -150.
String: for representative “PRIT”, “Hello” etc.
Operators: for representative + - * /
Special symbols: for representative { }, @, [ ] etc.
3. What is an identifier?
Identifiers are names for entities inward a C program, such every bit variables, arrays, functions, structures, unions too labels.
An identifier tin hand the axe hold out composed alone of uppercase, lowercase letters, underscore too digits, but should start alone amongst an alphabet or an underscore.
If the identifier is non used inward an external link process, too so it is called every bit internal. Example: Local variable. If the identifier is used inward an external link process, too so it is called every bit external. Example: Global variable.
An identifier is a string of alphanumeric characters that begins amongst an alphabetic graphic symbol or an underscore graphic symbol that are used to stand upward for diverse programming elements such every bit variables, functions, arrays, structures, unions too so on.
Actually, an identifier is a user-defined word. There are 53 characters, to stand upward for identifiers. They are 52 alphabetic characters (i.e., both majuscule too lowercase alphabets) too the underscore character. The underscore graphic symbol is considered every bit a missive of the alphabet inward identifiers. The underscore graphic symbol is normally used inward the pump of an identifier. There are 63 alphanumeric characters, i.e., 53 alphabetic characters too 10 digits (i.e., 0-9).
4. What are the rules to hold out followed for Identifiers?
There are sure enough rules that should hold out followed piece naming c identifiers:
• They must start amongst a missive of the alphabet or underscore (_).
• They must consist of alone letters, digits, or underscore. No other especial graphic symbol is allowed.
• It should non hold out a keyword.
• It must non incorporate white space.
• It should hold out upward to 31 characters long every bit alone initiative of all 31 characters are significant.
Some examples of c identifiers:
_A9: Valid identifier.
Temp.var: Invalid identifier every bit it contains especial graphic symbol other than the underscore.
void: Invalid every bit it is a keyword.
5. What is Internal Identifier?
If the identifier is non used inward an external link process, too so it is called every bit internal. These identifiers are every bit good known every bit internal names; includes the names of local variables. It has at to the lowest degree 31 important characters.
6. What is External Identifier?
If the identifier is used inward an external link process, too so it is called every bit external. These identifiers are every bit good known every bit external names; include portion names too global variable names that are shared betwixt source files. It has at to the lowest degree 63 important characters.
7. Define Keyword?
C programs are constructed from a laid of reserved words which provide command too from libraries which perform especial functions.
The basic instructions are built upward using a reserved laid of words such every bit main, for, if, while, default, double, extern, for, int etc.
C demands that they are used alone for giving commands or making statements. You cannot job default, for example, every bit the cite of a variable. An sweat to produce so volition upshot inward a compilation error. The keywords are every bit good called ‘Reserved words’.
Keywords receive got standard, predefined meanings inward C. These keywords tin hand the axe hold out used alone for their intended purpose; they cannot hold out used every bit programmer-defined identifiers.
Keywords are an essential portion of a linguistic communication definition. They implement specific features of the language. Every C discussion is classified every bit either a keyword or an identifier.
A keyword is a sequence of characters that the C compiler readily accepts too recognizes piece existence used inward a program.
Note that the keywords are all lowercase. Since majuscule too lowercase characters are non equivalent, it is possible to utilize an majuscule keyword every bit an identifier.
8. List unlike types of keywords?
C linguistic communication supports 32 keywords which are given below.
auto, double, int, struct, break, else, long, switch, case, enum,typedef, char, extern, return, union, const, float, short, unsigned, continue, for, signed, void, default, goto, sizeof, volatile produce if static while, register.
9. What are the restrictions applied for keywords?
• Keywords are the words whose pregnant has already been explained to the C compiler too their meanings cannot hold out changed.
• Keywords tin hand the axe hold out used alone for their intended purpose.
• Keywords cannot hold out used every bit user-defined variables.
• All keywords must hold out written inward lowercase.
10. State the pregnant of the next keywords inward C: auto, double, int, long?
auto: car is used to define a variable of storage shape automatic.
For example: car int var1;
This disputation suggests that var1 is a variable of storage shape car too information type int. Variables declared inside portion bodies are automatic yesteryear default. They are recreated each fourth dimension a portion is executed. Since, automatic variables are local to a function; automatic variables are every bit good called local variables.
double too float: double too float are used for indicating floating type variables. Keywords float too double stand upward for unmarried precision too double precision floating dot information respectively.
For example: float variable1;
double variable2;
Here, variable1 is unmarried precision floating type variable whereas, variable2 is a double precision floating type variable.
int: int is used for indicating the variable is of type integer.
For example: int var0;
Here, var0 is a variable of type integer.
long: Specifies a variable tin hand the axe concur fairly large integer type of data.
Syntax: long int var1;
11. What are Qualifiers?
Qualifiers or modifiers are identifiers that may precede the scalar information types (except float) to specify the release of bits used for
representing the respective type of information inward memory. The qualifiers inward C are short, long, signed, too unsigned.
12. What is a string?
A string is a sequence of characters ending amongst NULL. It tin hand the axe hold out treated every bit a one–dimensional array of characters terminated yesteryear a NULL character.
13. What is a constant?
A constant is a value that does non modify during the programme execution. H5N1 constant used inward C does non occupy memory.
14. What is an Operator?
An operator is a symbol or a especial graphic symbol that tells the calculator to perform sure enough mathematical or logical manipulations which is applied to operands to hand a result. It tin hand the axe operate on integer too existent numbers.
Operators are used inward programs to manipulate information too variables. They normally shape a portion of mathematical or logical expressions.
15. What are Special symbols?
The next especial symbols are used inward C having some especial pregnant too thus, cannot hold out used for some other purpose.
For Example: [] () {},:: * … = #
Braces {}: These opening too ending curly braces marks the start too destination of a block of code containing to a greater extent than than 1 executable statement.
Parentheses (): These especial symbols are used to signal portion calls too portion parameters.
Brackets []: Opening too closing brackets are used every bit array chemical element reference. These signal unmarried too multidimensional subscripts.
16. What is a constant?
Constant inward C linguistic communication is that detail whose value remains same during the execution of the programme from the commencement till the destination of a program.
Constant may hold out a numeric constant or an unknown numeric constant. Although a constant's value is specified alone once, a constant may hold out referenced many times inward a program.
Using a constant instead of specifying a value multiple times inward the programme tin hand the axe non alone simplify code maintenance, but it tin hand the axe every bit good furnish a meaningful cite for it too consolidate such constant bindings to a touchstone code location (for example, at the beginning).
17. How to declare too job constants? :
The keyword const tin hand the axe hold out added to the proclamation of an object to brand that object a constant rather than a variable.
The full general syntax of constant proclamation is:
Syntax: const data-type cite = value;
Here const is known every bit a keyword that must hold out used to declare a constant. Name is the cite of the constant, data-type is the type of the information which nosotros are declaring too value is the constant value of the data-type.
For example: const int manager_id=001;
Here nosotros declared a constant named every bit manager_id of type integer which is assigned a value 001.
There are ii elementary ways inward C to define constants:
• Using #define preprocessor.
• Using const keyword.
The #define Preprocessor: Following is the shape to job #defines preprocessor to define a constant:
#define identifier value
For example:
• #define FIRST_NUMBER 1
The const Keyword: You tin hand the axe job const prefix to declare constants amongst a specific type every bit follows:
const type variable = value;
For example:
• const float pie =3.147;
• const int radius =4;
• const char c = 'A';
18. What is the produce goodness of using #define to declare a constant?
Using the #define method of declaring a constant enables you lot to declare a constant inward 1 house too job it throughout your program. This helps brand your programs to a greater extent than maintainable, because you lot ask to maintain alone the #define disputation too non several instances of private constants throughout your program.
For instance, if your programme used the value of pi (approximately 3.14159) several times, you lot mightiness wishing to declare a constant for pi every bit follows #define PI 3.14159.
Using the #define method of declaring a constant is belike the close familiar agency of declaring constants to traditional C Programmers. Besides existence the close mutual method of declaring constants, it every bit good takes upward the to the lowest degree memory.
Constants defined inward this mode are only placed direct into your source code, amongst no variable infinite allocated inward memory. Unfortunately, this is 1 argue why close debuggers cannot inspect constants created using the #define method.
19. What is the divergence betwixt Constants too Variables?
A constant, Variable or a keyword tin hand the axe hold out formed from whatsoever combination of Alphabets, Digits too Special Symbols. H5N1 constant is an entity whose value does non modify throughout the programme execution.
A variable is an entity whose value keeps on changing throughout the programme execution. However, it’s non a dominion that the value of the variable volition change.
A variable value mightiness stay same throughout the programme execution. However the principal divergence betwixt variable too constant is that nosotros can’t modify the value of constant inward betwixt the program, but nosotros tin hand the axe modify the value of the variable during programme execution.
Variable's syntax is: data_type variable_name;
Constant's syntax is: const information type constant_name=value;
Variables tin hand the axe hold out initialized afterward its proclamation where every bit constants must hold out initialized at the fourth dimension of their proclamation otherwise they volition bring a garbage value.
Let us bring an example:
We define a variable named x inward a program. Let us say x=3.After onetime during execution nosotros modify the value of x to 6. Now, x=6.Here value of x is getting changed. But the value of three too 6 volition never change. Hence, x is called a variable too three is called a constant.
20. What are the unlike types of Constants inward C language?
There are iv basic types of constants inward C. They are:
• Integer constants
• Floating-point constants
• Character constants
• String constants
Integer too floating-point constants stand upward for numbers. They are oftentimes referred to every bit numeric-type constants.
21. What are the rules to hold out applied to all numeric-type constants?
The next dominion applies to all numeric type constants:
• Comma too blank spaces cannot hold out included inside the constants.
• Constants tin hand the axe hold out preceded yesteryear a – or + sign, if desired. If either sign does non precede the constant it is assumed to be positive.
• The value of a constant cannot overstep specified minimum too maximum bounds. For each type of constant, these saltation vary from 1 C compiler to another.
22. What are Integer constants inward C language?
Integer constants are whole numbers without whatsoever fractional part. Thus integer constants consist of a sequence of digits.
An "integer constant" is a decimal (base 10), octal (base 8), or hexadecimal (base 16) release that represents an integral value.
Use integer constants to stand upward for integer values that cannot hold out changed.
23. What are the rules for constructing Integer constants?
• An integer constant must receive got at to the lowest degree 1 digit.
• It must non receive got a decimal point.
• It tin hand the axe either hold out positive or negative.
• No commas or blanks are allowed inside an integer constant.
• If no sign precedes an integer constant, it is assumed to hold out positive.
• The allowable gain for integer constants is -32768 to 32767.
24. What are decimal integers?
A decimal integer constant consists of whatsoever combination of digits taken from the laid 0 through 9. If the decimal constant contains ii or to a greater extent than digits, the initiative of all digit must hold out something other than 0. The next are valid decimal integer constants.
Examples:
0
1
1234
-786
25. What are octal integer constants?
An octal integer constant tin hand the axe consist whatsoever combination of digits taken from the laid 0 through 7. However, the initiative of all digit must hold out 0, inward club to position the constant every bit an octal number. The next are valid octal integer constants.
Examples:
0
01
0125
0555
26. What are hexadecimal integer constants?
A hexadecimal integer constant must start amongst either 0x or 0X. It tin hand the axe too so hold out followed yesteryear whatsoever combination of digits taken from the laid 0 through nine too H5N1 through F (either upper-case or lower-case). The next are valid hexadecimal integer constants.
Examples:
0X0
0x1
0XAB125
-0x555
27. What are unsigned too long integer constants?
Unsigned integer constants: Exceed the ordinary integer yesteryear magnitude of 2, they are non negative. H5N1 graphic symbol U or u is prefixed to release to arrive unsigned.
Long Integer constants: These are used to overstep the magnitude of ordinary integers too are appended yesteryear L.
For example,
50000U decimal unsigned.
1234567889L decimal long.
0123456L octal long.
0777777U octal unsigned.
28. What are existent or Floating-point constants inward C language?
A existent or floating-point constant is a base-10 release that contains either a decimal dot or an exponent or both.
A floating-point constant tin hand the axe hold out written inward ii forms: Factorial shape or Exponential form.
A floating-point constant inward a fractional shape must receive got at to the lowest degree 1 digit each to the left too correct of the decimal point. H5N1 floating-point inward exponent shape consists of a mantissa too an exponent. The mantissa itself is represented every bit a decimal integer constant or a decimal floating-point constant inward fractional form. The missive of the alphabet E or e too the exponent follow the mantissa. The exponent must hold out a decimal integer. The actual release of digits inward the mantissa too the exponent depends on the calculator existence used.
29. What are the Rules for constructing Real constants (Fractional Form)?
Rules for constructing Real constants (Fractional Form) are,
• H5N1 existent constant must receive got at to the lowest degree 1 digit
• It must receive got a decimal point
• It could hold out either positive or negative
• If no sign precedes an integer constant, it is assumed to hold out positive.
• No commas or blanks are allowed inside a existent constant.
E.g.: +867.9, -26.9876, too 654.0
30. What are the Rules for constructing Real constants (Exponential Form)?
Rules for constructing Real constants (Exponential Form) are,
• The mantissa portion too the exponential portion should hold out separated yesteryear the missive of the alphabet ‘e’
• The mantissa may receive got a positive or negative sign(default sign is positive)
• The exponent must receive got at to the lowest degree 1 digit
• The exponent must hold out a positive or negative integer (default sign is positive)
• The gain of existent constants inward exponential shape is -3.4e38 too +3.4e38
E.g.: +3.2e-4, 4.1e8, -0.2e+4, -3.2e-4
1. What is a C Token?
Tokens are the basic edifice blocks of C programming. In a C source program, the basic chemical element recognized yesteryear the compiler is the "token."
The compiler initiative of all groups the characters into tokens. H5N1 token is source-program text that the compiler does non intermission downward into constituent elements.
Example: if, for, while, sum, add, +, -, /, ++, +=, = etc.
2. List the unlike types of C Tokens?
C has vi types of Tokens.
Keyword: for representative int, char, while, else, class.
Identifier: for representative main, amt, area, radius etc.
Constant: for representative 121, 500, -150.
String: for representative “PRIT”, “Hello” etc.
Operators: for representative + - * /
Special symbols: for representative { }, @, [ ] etc.
3. What is an identifier?
Identifiers are names for entities inward a C program, such every bit variables, arrays, functions, structures, unions too labels.
An identifier tin hand the axe hold out composed alone of uppercase, lowercase letters, underscore too digits, but should start alone amongst an alphabet or an underscore.
If the identifier is non used inward an external link process, too so it is called every bit internal. Example: Local variable. If the identifier is used inward an external link process, too so it is called every bit external. Example: Global variable.
An identifier is a string of alphanumeric characters that begins amongst an alphabetic graphic symbol or an underscore graphic symbol that are used to stand upward for diverse programming elements such every bit variables, functions, arrays, structures, unions too so on.
Actually, an identifier is a user-defined word. There are 53 characters, to stand upward for identifiers. They are 52 alphabetic characters (i.e., both majuscule too lowercase alphabets) too the underscore character. The underscore graphic symbol is considered every bit a missive of the alphabet inward identifiers. The underscore graphic symbol is normally used inward the pump of an identifier. There are 63 alphanumeric characters, i.e., 53 alphabetic characters too 10 digits (i.e., 0-9).
4. What are the rules to hold out followed for Identifiers?
There are sure enough rules that should hold out followed piece naming c identifiers:
• They must start amongst a missive of the alphabet or underscore (_).
• They must consist of alone letters, digits, or underscore. No other especial graphic symbol is allowed.
• It should non hold out a keyword.
• It must non incorporate white space.
• It should hold out upward to 31 characters long every bit alone initiative of all 31 characters are significant.
Some examples of c identifiers:
_A9: Valid identifier.
Temp.var: Invalid identifier every bit it contains especial graphic symbol other than the underscore.
void: Invalid every bit it is a keyword.
5. What is Internal Identifier?
If the identifier is non used inward an external link process, too so it is called every bit internal. These identifiers are every bit good known every bit internal names; includes the names of local variables. It has at to the lowest degree 31 important characters.
6. What is External Identifier?
If the identifier is used inward an external link process, too so it is called every bit external. These identifiers are every bit good known every bit external names; include portion names too global variable names that are shared betwixt source files. It has at to the lowest degree 63 important characters.
7. Define Keyword?
C programs are constructed from a laid of reserved words which provide command too from libraries which perform especial functions.
The basic instructions are built upward using a reserved laid of words such every bit main, for, if, while, default, double, extern, for, int etc.
C demands that they are used alone for giving commands or making statements. You cannot job default, for example, every bit the cite of a variable. An sweat to produce so volition upshot inward a compilation error. The keywords are every bit good called ‘Reserved words’.
Keywords receive got standard, predefined meanings inward C. These keywords tin hand the axe hold out used alone for their intended purpose; they cannot hold out used every bit programmer-defined identifiers.
Keywords are an essential portion of a linguistic communication definition. They implement specific features of the language. Every C discussion is classified every bit either a keyword or an identifier.
A keyword is a sequence of characters that the C compiler readily accepts too recognizes piece existence used inward a program.
Note that the keywords are all lowercase. Since majuscule too lowercase characters are non equivalent, it is possible to utilize an majuscule keyword every bit an identifier.
8. List unlike types of keywords?
C linguistic communication supports 32 keywords which are given below.
auto, double, int, struct, break, else, long, switch, case, enum,typedef, char, extern, return, union, const, float, short, unsigned, continue, for, signed, void, default, goto, sizeof, volatile produce if static while, register.
9. What are the restrictions applied for keywords?
• Keywords are the words whose pregnant has already been explained to the C compiler too their meanings cannot hold out changed.
• Keywords tin hand the axe hold out used alone for their intended purpose.
• Keywords cannot hold out used every bit user-defined variables.
• All keywords must hold out written inward lowercase.
10. State the pregnant of the next keywords inward C: auto, double, int, long?
auto: car is used to define a variable of storage shape automatic.
For example: car int var1;
This disputation suggests that var1 is a variable of storage shape car too information type int. Variables declared inside portion bodies are automatic yesteryear default. They are recreated each fourth dimension a portion is executed. Since, automatic variables are local to a function; automatic variables are every bit good called local variables.
double too float: double too float are used for indicating floating type variables. Keywords float too double stand upward for unmarried precision too double precision floating dot information respectively.
For example: float variable1;
double variable2;
Here, variable1 is unmarried precision floating type variable whereas, variable2 is a double precision floating type variable.
int: int is used for indicating the variable is of type integer.
For example: int var0;
Here, var0 is a variable of type integer.
long: Specifies a variable tin hand the axe concur fairly large integer type of data.
Syntax: long int var1;
11. What are Qualifiers?
Qualifiers or modifiers are identifiers that may precede the scalar information types (except float) to specify the release of bits used for
representing the respective type of information inward memory. The qualifiers inward C are short, long, signed, too unsigned.
12. What is a string?
A string is a sequence of characters ending amongst NULL. It tin hand the axe hold out treated every bit a one–dimensional array of characters terminated yesteryear a NULL character.
13. What is a constant?
A constant is a value that does non modify during the programme execution. H5N1 constant used inward C does non occupy memory.
14. What is an Operator?
An operator is a symbol or a especial graphic symbol that tells the calculator to perform sure enough mathematical or logical manipulations which is applied to operands to hand a result. It tin hand the axe operate on integer too existent numbers.
Operators are used inward programs to manipulate information too variables. They normally shape a portion of mathematical or logical expressions.
15. What are Special symbols?
The next especial symbols are used inward C having some especial pregnant too thus, cannot hold out used for some other purpose.
For Example: [] () {},:: * … = #
Braces {}: These opening too ending curly braces marks the start too destination of a block of code containing to a greater extent than than 1 executable statement.
Parentheses (): These especial symbols are used to signal portion calls too portion parameters.
Brackets []: Opening too closing brackets are used every bit array chemical element reference. These signal unmarried too multidimensional subscripts.
16. What is a constant?
Constant inward C linguistic communication is that detail whose value remains same during the execution of the programme from the commencement till the destination of a program.
Constant may hold out a numeric constant or an unknown numeric constant. Although a constant's value is specified alone once, a constant may hold out referenced many times inward a program.
Using a constant instead of specifying a value multiple times inward the programme tin hand the axe non alone simplify code maintenance, but it tin hand the axe every bit good furnish a meaningful cite for it too consolidate such constant bindings to a touchstone code location (for example, at the beginning).
17. How to declare too job constants? :
The keyword const tin hand the axe hold out added to the proclamation of an object to brand that object a constant rather than a variable.
The full general syntax of constant proclamation is:
Syntax: const data-type cite = value;
Here const is known every bit a keyword that must hold out used to declare a constant. Name is the cite of the constant, data-type is the type of the information which nosotros are declaring too value is the constant value of the data-type.
For example: const int manager_id=001;
Here nosotros declared a constant named every bit manager_id of type integer which is assigned a value 001.
There are ii elementary ways inward C to define constants:
• Using #define preprocessor.
• Using const keyword.
The #define Preprocessor: Following is the shape to job #defines preprocessor to define a constant:
#define identifier value
For example:
• #define FIRST_NUMBER 1
The const Keyword: You tin hand the axe job const prefix to declare constants amongst a specific type every bit follows:
const type variable = value;
For example:
• const float pie =3.147;
• const int radius =4;
• const char c = 'A';
18. What is the produce goodness of using #define to declare a constant?
Using the #define method of declaring a constant enables you lot to declare a constant inward 1 house too job it throughout your program. This helps brand your programs to a greater extent than maintainable, because you lot ask to maintain alone the #define disputation too non several instances of private constants throughout your program.
For instance, if your programme used the value of pi (approximately 3.14159) several times, you lot mightiness wishing to declare a constant for pi every bit follows #define PI 3.14159.
Using the #define method of declaring a constant is belike the close familiar agency of declaring constants to traditional C Programmers. Besides existence the close mutual method of declaring constants, it every bit good takes upward the to the lowest degree memory.
Constants defined inward this mode are only placed direct into your source code, amongst no variable infinite allocated inward memory. Unfortunately, this is 1 argue why close debuggers cannot inspect constants created using the #define method.
19. What is the divergence betwixt Constants too Variables?
A constant, Variable or a keyword tin hand the axe hold out formed from whatsoever combination of Alphabets, Digits too Special Symbols. H5N1 constant is an entity whose value does non modify throughout the programme execution.
A variable is an entity whose value keeps on changing throughout the programme execution. However, it’s non a dominion that the value of the variable volition change.
A variable value mightiness stay same throughout the programme execution. However the principal divergence betwixt variable too constant is that nosotros can’t modify the value of constant inward betwixt the program, but nosotros tin hand the axe modify the value of the variable during programme execution.
Variable's syntax is: data_type variable_name;
Constant's syntax is: const information type constant_name=value;
Variables tin hand the axe hold out initialized afterward its proclamation where every bit constants must hold out initialized at the fourth dimension of their proclamation otherwise they volition bring a garbage value.
Let us bring an example:
We define a variable named x inward a program. Let us say x=3.After onetime during execution nosotros modify the value of x to 6. Now, x=6.Here value of x is getting changed. But the value of three too 6 volition never change. Hence, x is called a variable too three is called a constant.
20. What are the unlike types of Constants inward C language?
There are iv basic types of constants inward C. They are:
• Integer constants
• Floating-point constants
• Character constants
• String constants
Integer too floating-point constants stand upward for numbers. They are oftentimes referred to every bit numeric-type constants.
21. What are the rules to hold out applied to all numeric-type constants?
The next dominion applies to all numeric type constants:
• Comma too blank spaces cannot hold out included inside the constants.
• Constants tin hand the axe hold out preceded yesteryear a – or + sign, if desired. If either sign does non precede the constant it is assumed to be positive.
• The value of a constant cannot overstep specified minimum too maximum bounds. For each type of constant, these saltation vary from 1 C compiler to another.
22. What are Integer constants inward C language?
Integer constants are whole numbers without whatsoever fractional part. Thus integer constants consist of a sequence of digits.
An "integer constant" is a decimal (base 10), octal (base 8), or hexadecimal (base 16) release that represents an integral value.
Use integer constants to stand upward for integer values that cannot hold out changed.
23. What are the rules for constructing Integer constants?
• An integer constant must receive got at to the lowest degree 1 digit.
• It must non receive got a decimal point.
• It tin hand the axe either hold out positive or negative.
• No commas or blanks are allowed inside an integer constant.
• If no sign precedes an integer constant, it is assumed to hold out positive.
• The allowable gain for integer constants is -32768 to 32767.
24. What are decimal integers?
A decimal integer constant consists of whatsoever combination of digits taken from the laid 0 through 9. If the decimal constant contains ii or to a greater extent than digits, the initiative of all digit must hold out something other than 0. The next are valid decimal integer constants.
Examples:
0
1
1234
-786
25. What are octal integer constants?
An octal integer constant tin hand the axe consist whatsoever combination of digits taken from the laid 0 through 7. However, the initiative of all digit must hold out 0, inward club to position the constant every bit an octal number. The next are valid octal integer constants.
Examples:
0
01
0125
0555
26. What are hexadecimal integer constants?
A hexadecimal integer constant must start amongst either 0x or 0X. It tin hand the axe too so hold out followed yesteryear whatsoever combination of digits taken from the laid 0 through nine too H5N1 through F (either upper-case or lower-case). The next are valid hexadecimal integer constants.
Examples:
0X0
0x1
0XAB125
-0x555
27. What are unsigned too long integer constants?
Unsigned integer constants: Exceed the ordinary integer yesteryear magnitude of 2, they are non negative. H5N1 graphic symbol U or u is prefixed to release to arrive unsigned.
Long Integer constants: These are used to overstep the magnitude of ordinary integers too are appended yesteryear L.
For example,
50000U decimal unsigned.
1234567889L decimal long.
0123456L octal long.
0777777U octal unsigned.
28. What are existent or Floating-point constants inward C language?
A existent or floating-point constant is a base-10 release that contains either a decimal dot or an exponent or both.
A floating-point constant tin hand the axe hold out written inward ii forms: Factorial shape or Exponential form.
A floating-point constant inward a fractional shape must receive got at to the lowest degree 1 digit each to the left too correct of the decimal point. H5N1 floating-point inward exponent shape consists of a mantissa too an exponent. The mantissa itself is represented every bit a decimal integer constant or a decimal floating-point constant inward fractional form. The missive of the alphabet E or e too the exponent follow the mantissa. The exponent must hold out a decimal integer. The actual release of digits inward the mantissa too the exponent depends on the calculator existence used.
29. What are the Rules for constructing Real constants (Fractional Form)?
Rules for constructing Real constants (Fractional Form) are,
• H5N1 existent constant must receive got at to the lowest degree 1 digit
• It must receive got a decimal point
• It could hold out either positive or negative
• If no sign precedes an integer constant, it is assumed to hold out positive.
• No commas or blanks are allowed inside a existent constant.
E.g.: +867.9, -26.9876, too 654.0
30. What are the Rules for constructing Real constants (Exponential Form)?
Rules for constructing Real constants (Exponential Form) are,
• The mantissa portion too the exponential portion should hold out separated yesteryear the missive of the alphabet ‘e’
• The mantissa may receive got a positive or negative sign(default sign is positive)
• The exponent must receive got at to the lowest degree 1 digit
• The exponent must hold out a positive or negative integer (default sign is positive)
• The gain of existent constants inward exponential shape is -3.4e38 too +3.4e38
E.g.: +3.2e-4, 4.1e8, -0.2e+4, -3.2e-4