Skip to main content

ads1

Class 10th Chapter 10 Introduction to C language

CH-10 



 Introduction to C Language 

 

Programming language when used allows us to write an instruction that has only one meaning.

Computers however do not understand the language that we speak neither does it understand the programming language. It only understands 0 and 1.

The problem of computers not understanding our language is solved by using software programs called translators. This translator is known as compiler.

A good program should possess following characteristics :

1. A program must end after finite number of steps.

2. The instructions of program must be precisely defined, i.e. it should not have multiple
meaning.

3. All the instructions must be effective, i.e. they should be carried out exactly.

4. A program may take zero or more inputs.

5. A program may produce one or more outputs.

Structure of C Program

C program is a set of blocks called functions. A function is made up of one or more statements used for performing a predefined task.

It is always a good practice to use comments within the functions as it improves the readability and understanding of the program. C language has 2 type of comment single line :- // and multiline comment as /* and */

C provides inbuilt or library functions. Some examples are pow(), sqrt() etc. These functions have a predefined purpose like pow() is used for calculating value of x raised to given power.

 A scope of C variable is decided by using opening and closing curly braces { }.


The characters here can be divided into four categories.

1. Letter
2.Digits
3. White spaces
4. Special Characters.

Keyword :- To be specific ANSI C standard supports 32 predefined words. These predefined words in C language are known as keyword.

auto ,double ,int ,struct

break ,else ,long ,switch

case ,enum ,register ,typedef union

char ,extern ,return ,const

float ,short ,unsigned ,continue

for ,signed ,void ,default ,goto

sizeof ,volatile ,do ,static ,while

Identifier :- A word that a user can construct by making use of C character set is known as identifier. It consists of set of letters, digits and some special characters

Variable :- AC program generally accepts input, this input comes in a form of data. To store and manipulate a data we use memory space.

These rules have been mentioned below :
1. Variable name cannot be same as keyword.
2. Variable name consists of letter, digit and under score. No other special character is allowed.
3. The first character of variable name must be a letter or under score.
4. The maximum length of variable name as per ANSI standards is 31 characters.
5. The variable names are case sensitive hence num, nuM, nUM, nUm and Num are considered as different variables.

Constant :- The entities of C that do not change its value throughout the execution of program are known as constant.

1) Which of the following is an extension of C program file ?

(a) c
(b) h
(c) s
(d) t

(2) Which of the following number refers to number of C character categories?

(a) 0
(b) 2
(c) 4
(d) 8

(3) Which of the following C character categories does the symbol = belong ?

(a) Letter
(b) Blank Space
(c) Special Character
(d) Digit

(4) Which of the following is a valid keyword of C ?

(a) ofsize
(b) sizeof
(c) forsize
(d) sizefor

(5) Which of the following is an invalid variable name in C?

(a) Register
(b) Register
(c) registre
(d) register

(6) Which of the following is an invalid integer constant in C ?

(a) OxG
(b) OxA
(c) OxB
(d) 0xD

(7) Which of the following is valid real constant in C?

(a) -2.0.5e5
(b) -20.5e5.5
(c) -20.5e5
(d) -20.5e.5

(8) Which of the following is valid single character constant in C ?

(a) 'a'
(b) 'la'
(c)"a"
(d) Both a and b

(9) The preprocessor directive #define is used to define which of the following in C ?

(a) String constant
(b) Symbolic constants
(c) Integer constant
(d) Single character constant
 
(10) Which of the following function key is used to directly execute a program ?

(a) F7
(b) F9
(c) F5
(d) F8



ads2

Popular posts from this blog

1. Given the school result data, analyses the performance of the students on #different parameters, e.g subject wise or class wise.

1. Given the school result data, analyses the performance of the students on #different parameters, e.g subject wise  or class wise. Solution :-   # x-axis is shows the subject and y -axis # shows the markers in each subject # import pandas and matplotlib  import pandas as pd  import matplotlib.pyplot as plt # Simple Line Chart with setting of Label of X and Y axis, # title for chart line and color of line  subject = ['Physic','Chemistry','Mathematics', 'Biology','Computer'] marks =[80,75,70,78,82] # To draw line in red colour plt.plot(subject,marks,'r',marker ='*')     # To Write Title of the Line Chart plt.title('Marks Scored') # To Put Label At Y Axis plt.xlabel('SUBJECT')           # To Put Label At X Axis plt.ylabel('MARKS')             plt.show() Output :- 

Class 10th Chapter 7 Functions in Calc

   Functions in Calc Calc provide built-in standard functions for mathematical, logical, statistical, date and time, financial and other calculations on numbers and text. The process of inserting a function is similar for all functions.That is, to use a function we need to enter a correct spelling of the function along with necessary arguments. This is known as syntax of the functions. t is possible to loose the grip on it and easy to introduce errors. To avoid this, you may take help of function wizard. The Calc support some more functions that support logical decision making. These functions are AND, OR, and NOT. (1) In which of the following ways we can enter a function in Calc ? (a) Directly typing function name in a cell nan (b) Function wizard or selecting from tool bar (c) A and B both (d) Depends on functions (2) A function can start with which of the following options ? (a) '='sign (b) Alphabets (c) Numbers (d) Any of these (3) Which of the following is not a logical...

11. Write a Java program to input basic salary of an employee and calculate its Gross salary according to following:

    11. Write a Java program to input basic salary of an employee and calculate its Gross salary according to following: Basic Salary <= 10000 : HRA = 20%, DA = 80% Basic Salary <= 20000 : HRA = 25%, DA = 90% Basic Salary > 20000 : HRA = 30%, DA = 95% Static Solution :-  class salary {     public static void main(String args[])     {     double basic=20000.50,gross,da,hra;     if(basic <=10000)     {         da = basic * 0.8;         hra = basic *0.2;     }              else if(basic <=20000)     {         da = basic * 0.9;         hra = basic *0.25;     }     else     {         da = basic * 0.95; ...