0% found this document useful (0 votes)
34 views

Assignment 2 CH 2 C Programming Basics

Uploaded by

Diya Ukani
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)
34 views

Assignment 2 CH 2 C Programming Basics

Uploaded by

Diya Ukani
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/ 2

Branch: Computer Engineering (CS & CSE)

Subject Name: Computer Programming


Subject Code: 01CE1101
Sem: B.Tech Sem - 1

Assignment 2
(Chapter – 2 : C-Programming Basics)

1. Explain a general structure of a standard C program with an example.


2. What is a token? What are the different types of tokens available in C language? Explain
each of the token type with suitable example.
3. Define Keywords and Identifiers in C language. Give minimum two clear differences between
Keywords and Identifiers.
4. State weather the following statements are True/False?
a. Any valid printable ASCII character can be used in an identifier.
b. All variables must be given a type when they are declared.
c. Declarations can happen anywhere in a program.
d. ANSI C treats the variables name and Name to be same.
e. The underscore can be used anywhere in an identifier.
f. The keyword void is a datatype in C.
g. Floating point constants, by default, denote float type values.
h. Like variables, constants have a type.
i. Character constants are coded using double quotes.
j. Initialization is the process of assigning a value to a variable at the time of
declaration.
k. All static variables are automatically initialized to zero.
l. The scanf function can be used to read only one value at a time.
5. Which of the following are invalid constants and why?
a. 0.0001 d. 5 x 1.5 g. 99999
b. +100 e. 75.45 E-2 h. “15.75”
c. -45.6 f. -1.79 e + 4 i. 0.00001234
6. Which of the following are invalid variable names and why?
a. Minimum f. Sum Total k. Row1
b. doubles g. N1+N2 l. Column-
c. float h. n$ total
d. First.name i. Row Total
e. 3rd_row j. &name
7. Find errors, if any, in the following declaration statements.
Int x;
float letter, DIGIT;
double = p, q
exponent alpha, beta;
m, n, z: INTEGER
short char c;
long int m; count;
long float temp;
Branch: Computer Engineering (CS & CSE)
Subject Name: Computer Programming
Subject Code: 01CE1101
Sem: B.Tech Sem - 1

8. What would be the value of variable X after execution of the following statements?
int x, y = 10;
char z = ‘a’;
x = y + z;
9. Identify syntax errors in the following program. After corrections, what output would you
expect upon execution of the program?
#define PI 3.14159
main()
{
int R, C; /* R – Radious of a circle
float perimeter; /* C – Circumference of circle */
float area; /* Area of Circle */
C = PI
R = 5;
Perimeter = 2.0 * C * R;
Area = C*R*R
printf(“%f”, “%d”, &perimeter, &area);
}
10. Explain, how the following declarations shall be interpreted by the compiler?
a. const int class_size = 50;
b. volatile int class_size = 50;
c. volatile const int class_size = 50;

You might also like