Pages

Monday, February 18, 2008

Questions based on C

ASCII means American Standard Code for Information Interchange


Q1:What is C?
Ans:C is high level programing language and It was developed by Dennis M.Ritche along unix and later was developed as an outgrowth of BCPL(Basic Combined Programming Language)
by Martin Richards

Q2:what is datatype? and How many types?
Ans:A datatype defines a set of values and the operations that can be performed on them.

DatatypeDescriptionSize(bytes)Range
charsingle character
1
0 to 255
intan integer
2
-32767 to +32767
floatfloating point no.
4
approx 7 digits of precision
doublefloaing point no.
8
approx 15 digits of precision

Q3:Steps in learning C language are:
Ans:1.Character Set Alphabets,Digits and Special Symbols
2.Datatypes,Constants,Variables and Keywords
3.Instructions
4.Functions,Program
Q4:Rules to write C program
Ans:1.All C statements must end with semicolon.
2.C is case sensitive.
3.Braces must always match upon pairs
4.comments cannot be enclosed.
Ex:/*A simple C program*/ is not valid
5.A comment can be split into one or more lines
Q:what are preprocessor commands?
Ans:C supports two state statements.They are 1.#include
2.#define
Q:What is function?
Ans:A function is a self contained block of statements that perform a coherent task of some kind.
Q:what is an Operater?
Ans:An operator is a symbol that tells the computer to perform certain mathematical or logical manipulations.
Q:Write a small Programe to addition of Two Numbers
Ans: /******************************
* To Addition of two Numbers *
* Author :- Nagarjuna *
******************************/
#include<stdio.h>
void main()
{
int a,b,c;
printf("Enter Two Numbers : ");
scanf("%d%d",&a,&b);
c=a+b;
printf("The Result is : %d",c);
}

Q:what is an array?
Ans:An array is a collection of elements of similar types.

No comments: