0% found this document useful (0 votes)
3 views4 pages

Assignment For IP April25

The document contains a series of programming questions and tasks related to C language, covering topics such as memory types, programming languages, storage classes, operators, recursion, pointers, and array manipulation. It includes both theoretical questions and practical programming assignments, requiring the implementation of various functions and algorithms. The document is structured into three groups with varying complexity and marks allocation.

Uploaded by

deep32817
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)
3 views4 pages

Assignment For IP April25

The document contains a series of programming questions and tasks related to C language, covering topics such as memory types, programming languages, storage classes, operators, recursion, pointers, and array manipulation. It includes both theoretical questions and practical programming assignments, requiring the implementation of various functions and algorithms. The document is structured into three groups with varying complexity and marks allocation.

Uploaded by

deep32817
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/ 4

GROUP – A (5 X 2 mark = 10 marks)

1. Differentiate between primary and secondary memory.


2. Differentiate between high-level and low-level programming languages.
3. Describe the various storage classes?
4. Describe turnery operator with an example.
5. What will be the output of the following program segments?
#include <stdio.h>
int main()
{
int x = 5;
b = 10, z;
x + y = z;
printf("%d", z);
return 0;
}

6. What are bitwise operators in C? Give an example.


7. Explain the use of sizeof operator with an example.
8. What is recursion? Give a simple example.
9. Write the syntax of a for loop and explain with example.
10. Explain the difference between break and continue.
11. Write a program segment to swap two integers using pointers.
12. Convert the number (7CB4.FABE)16 to the Decimal number system.
13. What is typecasting? Give an example.
14. What are enumerated types?
15. Define const and volatile keywords in C.
16. Explain command line arguments with syntax.
17. What is meant by dangling pointer?

18. Convert the number (286.25)10 to the octal number system


19. Find the error in the following code, if any, and explain the output:
#include <stdio.h>
int main()
{
int a = 2;
for (;;)
{
if (a == 2)
{
break;
printf("Im Sita");
}
}
return 0;
}
20. Find the error in the following code, if any, and identify the output:
#include <stdio.h>

int main()
{
int N = 2 + 1;

if (N == 4)
{
/* unreachable code */
printf("equal");
}
return 0;
}
21. Find the output of the following code
Void main()
{
int val=1;
do{
val++;
++val;
}while(val++>25)
printf(“%d\n”,val);
}

GROUP – B (4 X 2 marks = 8 marks)


1) Write a program to evaluate the following using recursive function:

f(x)=x-x3/3!+x5/5!-x7/7!+..

2) What are void pointers? Explain difference between null and void pointer.
3) Write a C program to reverse a 1D array using pointers (no indexing).
4) Write a program to find GCD using recursive function.
5) Write a program to implement the following diagram using for loop.
*
***
*****
*******
*********
6) Explain the use of multi-dimensional arrays.
7) Write the output:

a) void main(){
int m[2];
int *p=m;
m[0]=100;
m[1]=200;
printf("%d%d",++*p,*p);
}

b) void main()
{
int val=1;
do{
val++;
++val;
}while(val++>25);

printf("%d\n",val);
}
8) What are pre-processor directives? Differentiate between macro and function with
necessary examples.
9) Write a program to sort an array in ascending order using pointers.
10)Write a program to count vowels and consonants in a string.
11)Compute the address of marks[18][4] in a 20×5 array stored in row-major order.
Base = 1000, word size = 2.

12)Describe string. Explain any three string handling function with examples.
13)Differentiate between(Any two):

a) Primary and secondary storage

b) High-level and low level Programming Language


c) Compilers and interpreters

GROUP – C (2 X 10 marks = 20 marks)

1. (i) Write a C program to implement a function that reverses a given 1D matrix of integers
in-place, using only pointers (no array indexing allowed).

(ii) Write a C program that demonstrates the behavior of all four storage classes (auto,
register, static, and extern) by printing their values across multiple function calls and files.

2. Compare and contrast dynamic memory allocation using malloc() and static memory
allocation for arrays in C. Discuss the advantages and limitations of each approach with
respect to flexibility, memory usage, and execution time.

3. What is function? Describe different function prototype. Write a program to calculate the
sum of squares of first n even numbers.

4. (i) How the multi dimensional array is useful? (2+3+5)

(ii) Consider a 20×5 two-dimensional array marks which has base address=1000 and
number of words per memory location of array =2. Now compute the address of the
element marks [18,4] assuming that the element are stored in a row major order.

(iii) Write a program to find the largest of n numbers using array

5. Discuss dynamic memory allocation functions with examples.


6. Compare malloc(), calloc(), realloc(), and free().
7. Explain function call by value and call by reference with programs.

You might also like