Cpps Qb@Azdocuments - in
Cpps Qb@Azdocuments - in
TUTORIAL QUESTIONS
SUBCODE: 18CPS13
SEMESTER: I SUBJECT: C PROGRAMMING FOR PROBLEM SOLVING
MODULE 1
1 With a neat block diagram of computer, explain its components.
8 Differentiate between Primary memory and Secondary memory, SRAM and DRAM.
10 Define data type. Explain primitive data types supported by C languages with example.
11 Write the basic structure of C program. Explain each section briefly with suitable example.
13 What is a token? What are different types of tokens available in C language? Explain.
14 Write a C program to compute simple interest. Draw the flowchart for the same.
Define:
i. Variable and give the rules for declaring it.
15
ii. Constant
iii. Declaration.
Evaluate each of the following expression independent of each other.
MODULE 2
1 List the difference between While and do while loop. Explain with syntax and example.
8 Show how break and continue statements are used in a C-program, with example.
10 State the drawback of ladder if-else. Explain how do you resolve with suitable example.
11 1
1 2
1 2 3
1 2 3 4
12 Write a C program to implement commercial calculator using switch statement.
State the drawback of ladder if-else. Explain how do you resolve with suitable with suitable
14
example.
Marks Grades
0 to 39 F
17 40 to 49 E
50 to 59 D
60 to 69 C
70 to 79 B
80 to 89 A
90 to 100 O
Evaluate:
i=1
l : if(i>2)
{
18 printf(“saturday”);
i = i-1;
goto l;
}
printf(“sunday”);
Explain your result briefly.
19 WACP to check whether a given number is even or odd using if-else statement.
20
21 WACP to find all possible roots of quadratic equation and print them with appropriate messages.
MODULE 3
1 Define array. Write the syntax for and with declaring and initializing 1D and 2D array with
suitable example.
2
Define String. List out all string manipulation function and explain them.
CBIT, KOLAR Page 4 of 5
3
WACP: Linear Search, Binary Search, Selection Sort, Bubble Sort.
4
WACP to copy a string (combination of digits and alphabets) to another string (only alphabets).
5
WACP to find transpose of a given matrix.
6
WACP to concatenate two strings without using built in function.
7
How string is declared and initialized? Explain string input/output functions with an example.
8
Write a program to multiply 2 matrices, by ensuring their multiplication compatibility.
9
Write a C program to find the transpose of a given matrix.
10 Write a C program to copy a string (combination of digits and alphabets) to another string (only
alphabets).
11
WACP to find biggest of n numbers using arrays.
12
List the difference between Linear Search and Binary Search.
MODULE 4
1
What are C-functions? What are the advantages of user defined functions ?
2
Explain the different elements of user defined functions in detail.
3
List and explain the categories of user defined functions.
4
Define Recursion. Give any two limitations of recursion.
5
WACP to compute the factorial of a given number ‘n’ using recursion.
6
WACP to compute the Fibonacci series using recursion.
7
Differentiate between pass by value and pass by reference with examples.
8
Write a program to find GCD and LCM of two numbers using concept of functions.
Give the scope and lifetime of following:
11) External variable
9
ii) Static variable
iii) Automatic variable
iv) Register variable.
10
WACP using recursive function for Binary to Decimal Conversion.
11 Write a C recursive function for multiplying two integers where a function call is passed with
two integers m and n.
Differentiate:
12
i. User defined and built-in function
ii. Recursion and iteration
13 Write a C-program for evaluating the binomial coefficient using a function factorial(n).
CBIT, KOLAR Page 5 of 5
WAP in C using functions to swap two numbers using global variables concept and call by
14
reference concept.
MODULE 5
1 Define structures. Explain how do you declare, initialize and represent the memory for structure
variable.
2
Define pointer. Explain how to declare and initialize pointers with syntax and example.
3
Define pre-processor directives. List its types and explain them.
4
WACP that finds the addition of two squared numbers, by defining macro for square(x).
5
WACP that accepts a structure variable as a parameters to a function from a function call.
6 Write a note on: i) Arrays within structures ii) Array of structures iii) Structure within structure
iv) Array of pointers
7
Write a C program to add two numbers using pointers.
8 Write a C program that finds the addition of two squared numbers, by defining macro for
Square(x).
9 Write a C program that accepts a structure variable as a parameters to a function from a function
call.
10 Explain why do you need nested structures?
WACP to maintain record of n students using structures with 4 fields (Rollno, marks, name
12
and grade). Print the names of students within marks >= 70.