CH 2. BEGINNING WITH C Flashcards
C language was developed by ____________.
DENNIS RITCHIE
C was developed at ___________.
AT & T Bells laboratory
state the features of c language?
The features of c language are as follows:
- Robust language: c is a strong/structured language.
- general purpose: can perform both system and application tasks/programs.
- case sensitive language: c only accepts short letters otherwise its considered as an error.
- portable: c can be programmed in several devices it will execute the same output.
- c is a middle and low level language: c is categorised as both user level language (high level language) and machine level language(low level language).
- fast and efficient: c can be programmed and can execute the programs in a quick and efficient way.
- Modularity: c can solve large problems by dividing the tasks into modules/functions/procedures.
state whether the following statement is Right or wrong;
c can only perform application tasks
wrong.
c is general purpose i.e it can perform both application and system tasks.
state whether the following statement is Right or wrong:
other letters apart from the short letters in programming in c is considered as error.
Right
state whether the following statement is Right or wrong:
c can give several outputs in different devices.
wrong.
output of the same program doesnt differ in devices if it is programmed in C.
state whether the following statement is Right or wrong:
c can be both user level and high level language.
wrong.
As user level is called as high level language. c can be both machine level language (low) and user level language (high)
what is modularity in c?
modularity is a feature of c where it divides big tasks into short modules/functions/procedures in order to execute them efficiently.
write a basic c program that includes printf
#include #include void main() { printf("welcome to c language"); getch(); clrscr(); }
what is the use of:
printf()
the printf function is used to print an output.
what is the use of:
main()
the main function is denotes the line from which execution of a program starts.
what are comment lines?
comment lines ( /* *\ ) are non executable statements in a program i.e which are ignored by compiler which is used for understanding the programs.
______ in programs helps in debugging and testing programs.
comment lines
__ is a special character used in printf.
/n new line
/n denotes _____.
new line
lines in {} has to end with _____.
semicolon.
uppercase letters are used for ____.
symbolic constants
each statement in c must end with ___.
semicolon.
___ indicates beginning of a function.
open brace bracket. {
___ indicates end of a function.
closed braced bracket. }
program in c should have ____ extension.
.c
What is C character set?
1.A character denotes any alphabet,digits,special symbols, white spaces etc.
2. A character set comprises of the foll:
Letters or alphabets:A,B,C….,X,Y,Z a,b,c,…,x,y,z
Digits: 0123456789
Special characters: #@!$%^&*()?,;:”’+×÷=/_
White spaces: blanks, horizontal tabs, newline, formfeed, carriage return.
What are c tokens?
1.Smallest individual unit in c is called as tokens
2. The types of tokens are as follows:
Keywords/identifiers/constants/strings/ special symbols/ operators.
What are keywords in c?
Keywords are words whose meanings have already been defined and the meanings cannot be changed.
Keywords are also called as reserved words.
There are 32 keywords in c.
There are ___ keywords in c
32
Keywords should be written in ___.
Lowercase letters
What are identifiers in c
Identifiers are names given to arrays, functions and strings.
These names are userdefined.
They are made of combination of letters&digits.
Cant be more than 8 characters long.
Use of underscore is permitted.
what are constants in c?
constants are fixed value which does not change during execution of program.
what are the types of constants in c?
there are two main types of constants in c namely,
numeric constants and character constants.
numeric constants include integer and real constants whereas character constants includes single character constants and strings.
what are integer constants?
integer constants include constants which doesnot include decimal. integer constants are sequence of digits and they must have atleast one digit. integer constant can be positive or negative.
if there are no signs preceding integer constants, they are assumed to be ____.
positive
state true or false:
Embedded spaces, commas, special characters are allowed in integer constants.
false
state and explain the types of integer constants
integer constants can be categorised into 3 types:
decimal constants
includes sequence of digits which can be positive or negative
octal constants
digits from 0 to 7with leading 0
hexadecimal constants
Sequence of digits from 0to 15 starting from OX,Ox and represents A/a to F/f for 10 to 15.
give examples of following:
decimal integer constants
32561
74628933
022164
give examples of following:
octal integer constants
0x43
0X57
0x664
give examples of following:
hexadecimal integer constants
OX45AD
Ox34
explain real constants
real constants are used to represent values that vary continously like temperature, distance etc.
it has a decimal point. can be positive or negative.
state and explain the ways of representing real constants.
there are two ways of representing real constants namely: decimal form and exponential form
in decimal representation, the constant has a decimal point. can be positive or negative. eg. 12.563
exponential form, the constants are divided into 2 parts: mantissa and exponenet and the form is mantissa e exponent. both mantissa and exponent value can be positive and negative. eg: 2.4e9 (e9 multiply by 10^9)
exponential notation is also called ____
scientific notation
explain: single character constants
single character constants include a single character (single alphabet, single digit, single special symbol) inside single quotation marks.
eg ‘s’