Introduction To programming - Assignment

advertisement
Northern India Engineering College
Shastri Park, Delhi
Department of Computer Science
Assignment: Introduction to Programming (ET CS-108)
Subject Facilitator: Shipra Varshney
Marks: 05
Instructions:
1. Last date of submission on or before: 15th April 2014.
2. Only hand written assignments will be accepted.
3. No assignment will be accepted after due date.
Q1. A) Define break and continue statement with example.
B) Differentiate a constant and a variable in C.
C) What are syntactical, logical and run time errors in programming? Explain with
examples.
D) Distinguish b/w keywords and identifiers in C. How many keywords are there in C?
E) List various phases of compilation. What is the function of linker and loader?
Q2. A) What are preprocessor directives? Explain with suitable examples and their uses?
B) Evaluate the following expressions:i) a=6, b=3, c=4, d=1, e=2, f=10;
a+b-(c+d)*3%e+f/9;
ii) int i=8;
j=++i*++i* ++i;
printf(“i=%d j=%d”, i,j);
Q3. A) What is the key difference between for and do while loops? Explain with example/code.
What is the minimum number of times a while loop can be executed?
B) Write a program in C to print the multiplication table of given number using do-while
loop?
C) Describe various operators used in C. Name the operators which have highest and least
precedence?
Q4. A) What is the use of mentioning return type of a function? By default a function returns
which type of a value? Also explain how values of an array are passed in the function.
B) What is the difference between a function & recursive function? Write a recursive function
that can count its own occurrence.
C) Describe formal argument, actual argument, function declaration and function definitions.
Q5. A) Write a C program to sort a list of strings into alphabetical order.
B) Explain passing pointers as function arguments with an example.
C) Explain how pointers are passed to a function.
D) Write a Program to reverse the character of a string.
Q6. A) Write short notes on union data types, enumerable data types.
B) What is static Memory allocation and Dynamic memory allocation? How are these
implemented in C?
C) Discuss all string functions with the help of examples.
Q7. Explain the given below with suitable syntax/ programs:1)
fopen(), fclose()
2)
fgetc(),fputc(),fgets(),fprintf(),fscanf()
3)
Sequential v/s random files
4)
Formatted v/s unformatted I/O
functions.
5)
Working of arrays as pointers.
References:
1. Herbert schildt: “C: The complete Reference”.
2. Yashwant Kanetkar -“C Programming”, and “Test your C skills”.
3. Balaguruswamy - “Programming in C Language”.
Download