
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An assignment for a c programming course, covering topics such as printing the squares of numbers, do-while and while loops, break and continue statements, functions, return statements, pre-processor directives, and arrays. Students are expected to write programs to complete the tasks and understand the concepts.
Typology: Exercises
1 / 1
This page cannot be seen from the preview
Don't miss anything!

(Units: 5–8) Total Marks: 100 Pass Marks: 50
Q. 1 (a) Write a program that prints the squares of all the numbers from 1 to 20. (b) What is the difference in execution sequence of the body of a do-while loop and a while loop? Explain with examples.
Q. 2 (a) What is the difference between break and continue statements? Explain with the help of suitable example. (b) For what purpose functions are used? Explain the structure of functions with the help of an example.
Q. 3 (a) What is a return statement? What are its limitations? (b) What are pre-processor directives? Explain the concept of header files. (c) What are the main differences between functions and macros? Explain.
Q. 4 (a) How single dimensional, two-dimensional, and three-dimensional arrays are initialized? How these arrays can be passed as arguments? Explain by using an example. (b) How sorting operation can be performed on arrays? Explain the sorting operation by using bubble sort.
Q. 5 (a) What is a pointer? Why are pointers used? What is an indirection operator? (b) How pointer variables are defined? How values are supplied to pointer variables? (c) Write a program using pointer notation to access individual elements of an array and print the sum and average of the elements of the array.