Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

C Chapter 1

Q. C is a Middle Level Language Why?


Ans :- C is a Middle Level Language (M.L.L.) because it has the both features of High Level Language (H.L.L.) and Low Level Language(L.L.L.). 
    
         The general I/O functions, Operators, Iteration statements etc make it the H.L.L. But "pointer" and other functions of "Embedded C' make it L.L.L. Using C programmer can write the Embedded Code like Assembly Language to control the Hardware without using any third party tool, such as O.S. It is must easy and powerful Language then Assembly Language. These features make it L.L.L.

        But I/O Functions, Operators, Iteration statements, various data types etc make C H.L.L. These features allow to write the large code which is very user friendly. for e.g. scanf(), printf(), if, else, for etc are the features of C which make it H.L.L.

       We find the both features of H.L.L. and L.L.L.in C, So, we can say that C is M.L.L.


Q. Why we use return 0; in C Program?

Ans:-  By default all function in C has the int return type. In main() function when there is no return type specify or int is declare as a return type in that case at the end of main() function we use the
return 0;
0 is an integer value and globally accepted which indicate that "OK the program execution is successful" or "The program worked fine".


Q. What is Algorithm and what are the parameters for good Algorithm?

Ans:- Algorithm is a concise list of steps to solve any particular problem. It is not an English word. It is  pronounced AL-go-rith-um, this word is come form a name of mathematician Mohmmed ibn-Musa-al-Khwarizmi, who was the part of royal court of Baghdad from  about 780 to 850.

    Algorithm is the sequential list of steps to solve particular problem. Algorithm is the first steps to solve any problem because a Programmer always write an Algorithm after analysis and understand the problem before making the coding or programming. 

    Parameters for a good Algorithm :-

1. A good Algorithm is same in all languages.
2. A good Algorithm has the finite number of steps.
3. A good Algorithm always define the Input and Output precisely. 
4. Each steps of Algorithm should be clear and unambiguous. 
5. A good Algorithm should not have the computer code instead it is always in simple language, which is understood able and similar to programming language. 


Q. What is Flowchart?

Ans:- Flowchart is the graphical representation of Algorithm Or A Flowchart is the formalized graphics representation of Algorithm or Logical Sequence. To Draw the flowchart we have to use some symbols/standard graphics given below :-





Q. Define the variable declaration rules in c.

Ans:- In C Language a variable always declare with there data type before using. A variable is declare in the beginning of functions. There are some rules which we must have to follow at the time of variable declaration in C.

1.  A variable name should be start with '_' Underscore or a Character.
2. A number can be use in variable name but not in beginning. 
3. Any sign except '_' Underscore is not allowed in variable name.
4. Any keyword can't be used as a variable name.
5. Variable name is case sensitive.
6. White/Blank Space in variable name is not allowed.
7. Only first 31 characters of variable name is consider by compiler, length of variable can be exceed from 31 characters but first 31 characters of two or more variable should be differ.
A Table of valid or invalid variable names are given below:-

Q. What is the structure of a C program? Define
Ans:- 
Documentation Section :- This section contains the detail about program, that what we are going to build. This section consist the comments lines such as program name, author name, date of program, title etc for e.g. /*A Welcome program in c*/


Header Section :- This section is also known as link section. In this section we include the corresponding header files of which functions() and keywords we use in the program. It provides instructions to the compiler to link functions from the system library for e.g.
printf(), scanf() – stdio.h
clrscr(), getch() -  conio.h

Definition Section :- In this section we write the symbolic constants such as macros (macros known as symbolic constants) e.g.
#define TAX 12.44

Declaration Section :- In this section we declare the use define function. We declare the [return type] [function name]([argument list]).

main section() :- Each C program must have a main() function, this is the entry point of program, more than one main() function in a same  C program is not allowed. The only part of program execute which associate with main() function direct or indirect.

Sub-program section :- This is section where programmer define the user define functions as per the requirement. 


Q. What are the keywords? And how many keywords in C?

Ans:-  Keywords are some reserve words in C, whose has the specific meaning and user can’t change them. Keywords also not use as a variable name. There are 32 keywords in C. e.g. if, else, for,  etc.
Q. What is the tokens?

Ans:-
Tokens are the basic building blocks of C Programming. Each and every individual unit, Individual words, punctuation, characters etc are called tokens in C.
Token Examples
No
Token Types
Example 1
Example 2
1
Keyword
if
While
2
Constants
number
Sum
3
Identifier
10
-28
4
String
“Satish”
“Khokhar”
5
Special symbols
@
*
6
Operators
&&
++

Explanation





No comments:

Post a Comment