0% found this document useful (0 votes)
4 views5 pages

C Program I

The document provides definitions and explanations of key concepts in the C programming language, including structured programming, character sets, tokens, constants, identifiers, and data types. It also covers operators, type conversion, preprocessor directives, and examples of loops and functions. Additionally, it outlines the importance of keywords and storage classes in C, along with a series of questions for further exploration of C programming concepts.

Uploaded by

Divya Priya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views5 pages

C Program I

The document provides definitions and explanations of key concepts in the C programming language, including structured programming, character sets, tokens, constants, identifiers, and data types. It also covers operators, type conversion, preprocessor directives, and examples of loops and functions. Additionally, it outlines the importance of keywords and storage classes in C, along with a series of questions for further exploration of C programming concepts.

Uploaded by

Divya Priya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

TWO MARKS

1. Definec:
*Cisa structuredprogramming language.
*cwasdevelopedin1970sbyDennisRitchieatbelltelephonelaboratories

2. Whatarecharacterset?
1.lette
rs
2.digit
s
3. specialcharacters
4. whitespace

3. Definec tokens:
Thesmallestindividualunitsareknownasctokens.

4. Defineconstant:
Constantsarefixedvaluesthatdonotchangeduringtheexecutionoftheprogram.

5. Whatisidentifier?
Identifiers are referring to the names of variables, functions and arrays.
These are theuser -defined names.

6. Definestring constants:
Astringconstantisasequenceof characterenclosedindoublequotes.
Example: “hello”

7. Whatisvariable?
Avariableis datanamethatmaybe usedtostore thevalue.

8. Definedatatypeandtheirtypes:
Clanguage isrich in itsdata type.ThereareThreetypes:
Primaryorfundamentaldatatyp
e Derived data type
Userdefineddatatype

9. Definevoid:
Void isanemptydata type. Itreturns nothing.The voidtype hasnovalue.

10. Defineoperators:
Anoperatorisasymbolthatistoperformmathematicalorlogicalmanipulation.Itis
used in program to manipulate data and variables.

11. Definetypeconversion:

CS3251_PIC
Theoperandsaredifferenttypesintheexpression.Thelowertypeisautomatically
converted to the higher type before the operation proceeds.

CS3251_PIC
13. DefinetypecasteOperators:
The process of such local conversion of variable is known as casting value or type
modifier ortype caste operator.

14. Defineexpressions:
The combination of operand and operators form the expression. The operand may
be variableor constants.

15. Whatarethevarioustypesofoperators? C
supports the following types of operators
Unary
Unary Plus +
UnaryMinus-
Increment ++
Decrement --
Binary
Arithmetic +,-,*,/,%
Relational<,>,<=,>=,
==,!= Logical &&,||,!
Bitwise&,|,^,<<
,>> Assignment
=
Shorthandassignment+=, -=,*=,/=,%=
Ternary
?:
Special
Sizeof(), *.->

16. Writea for loop toprintfrom 10 to1


for(i=10;i>0;i--)
printf("%d",i);

17. WriteanytwopreprocessordirectivesinC
Preprocessor directive instructions are used to instruct the preprocessor
to expand/translate the source program before compilation
Thetwotypesofpreprocessordirectivesare,
#define to define Macro , Global constant
#include to include library files

18. ListdifferentdatatypesavailableinC
Data types are used to specify the type of a variable. In c, the data types are
classified into 3 category. They are,
PrimaryorBuilt-in:int,char,float
Derived : array, enum,
pointer User defined :
function, structure

CS3251_PIC
19. WriteaC programto findfactorial ofa givennumberusing Iteration
voidmain()
{
int
N=5,I,fact=1;
for(i=1;i<=N;i
++)
fact=fact*i;
printf(―Thefactorialvalueof%dis=%d‖,N,fact);
}

20. Whatistheuseofpreprocessor directive?


- Used to translate one high level language statement into another high level
language statement.
- Usedtoinstructthepreprocessorthathowitperformsthetranslationbefore
compilation.
- Usedtoperformconditionalcompilation.
- UsedtoincludeotherCfilesorlibraryfiles.

21. Whatisthevariable?Illustratewithanexample
- Variableisanamedstoragearea
- Usedtoassignanameto a value
- To declare a variable, we need to specify the data type of the value and the
variablename
Datatypevariable_name;
- Example
int reg;floatavg;

22. Definestaticstorageclass
- Storageclassspecifiesthevisibility&lifetimeof avariable
- Staticstorageclassinitializesavariableto0.
- Longerlifetime–Existsthroughouttheexecutionofprogram
- Visibilitytoall-Anyfunctioncanaccessthevariable-Sharedbyall

23. Whatis theuseof#define preprocessor


The#definepreprocessordirectiveisusedtodefin
ea Global constant #define PI 3.14
Macro #definebig(a,b)a>b?a:b
When a compiler reads the macro name, it replaces the macro name by its
expansion. When it reads the constant label, it replaces the label by its value.

24. Whatistheimportance ofkeywordsinC?


Keywordsarereserved identifiers
Theyperformsaspecifictask,specifiesthedatatyp
e Keyword can not be used as an identifier
Ex:for,if,int
CS3251_PIC
16 MARKS

1. Explainthedecisionmakingstatementincwithexampleprograms.

2. Explaintheloopingstatementincwithexampleprograms.

3. ExplainoperatorsinC

4. Explainpreprocessordirective.

5. ExplainindetailaboutProgrammingParadigm

6. ExplaintheapplicationsofCLanguage

7. Explainindetailabout theStructureoftheC Program

8. ExplainindetailabouttheDatatypes

9. ExplainindetailabouttheCTokens

CS3251_PIC

You might also like