Unit 1 - Unit 3 QB
Unit 1 - Unit 3 QB
UNIT I
INTRODUCTION
parallel processing
approach.
(16512)8 = (7498)10
PART B
S. No Question BTL
What are programming paradigms? Briefly explain about the
1. (16 Marks) K2
different categories of programming paradigms.
Draw a suitable block diagram of basic organization of a
2. (16 Marks) K2
computer system and describe the operations performed by it.
a) Explain in detail about algorithm and its advantages and (8 Marks) K2
disadvantages.
3.
b) Write an algorithm to generate the first n numbers in a (8 Marks) K3
Fibonacci series.
a) Summarize on the concepts of flowchart. (8 Marks) K2
4.
b) Draw a flowchart to find the factorial of a number. (8 Marks) K3
5. Describe the structure of a C program with a suitable example. (16 Marks) K1
a) Illustrate about the various data types in C language. (8 Marks) K2
6. b) Write a C program to find the sum of 10 non-negative (8 Marks) K3
numbers, entered by the user.
Explain the following in detail with examples:
7. a) Constants c) Keywords (16 Marks) K2
b) Enumeration d) Number system
Perform the following conversions in number system:
a) (55)10 = ( )8
b) (385.28)10 = ( )2
c) (0.515625)10 = ( )16
8. d) (1101)2 = ( )10 (16 Marks) K3
e) (1007)8 = ( )10
f) (1101)16 = ( )10
g) (100)8 = ( )16
h) (6E0.A15)16 = ( )2
Page|7
Unit II
OPERATOR AND EXPRESSIONS
Course Objective – COb 2: To implement programs using basic constructs of C
S.No BTL
Question
. *
1. What is Standard I/O library functions and list 3 processing functions? K1
In C Language input and output function are available as C compiler
functions or C libraries provided with each C compiler implementation.
These all functions are collectively known as Standard I/O Library
function.
Here I/O stands for Input and Output used for different inputting and
outputting statements. These I/O functions are categorized into three
processing functions.
i. Console input/output function
ii. Disk input/output function
iii. Port input/output function
2. What is Console input/output function? K1
All the input/output statements deals with the console, so these are
also Console Input/Output functions. Console Input/Output function
access the three major files before the execution of a C program. They are,
i. Standard input (stdin)
ii. Standard Output (stdout)
iii. Standard Error (stderr)
3. Write about getchar() and putchar() functions. K1
getchar(): It is used for reading a single character from the keyboard. It is a
buffered function. Buffered functions get the input from the keyboard and
store it in the memory buffer temporally until you press the Enter key.
putchar():This function is an output function. It is used to display a single
character on the screen.
Eg. char initial; initial = getchar(); putchar(initial);
4. Define getch(). K1
It is a function is present in conio.h header file. It is used to read a single
character from the keyboard similar to getchar() function. The entered
character is immediately returned without waiting for the enter key. The
entered character does not show up on the console. So it can be used to accept
hidden passwords.
Eg. char pwd; pwd = getchar();
Page|8
Syntax:
if (test expression)
{
Statements;
}
P a g e | 10
14. K3
Write a C program for printing the numbers from 1 to 10 using for loop.
#include <stdio.h>
int main()
{
int i;
for (i = 1; i < 11; ++i)
{
printf("%d ", i);
}
return 0;
}
17. K2
Describe the syntax of for loop.
Syntax:
for (initialize expression; test expression; update expression)
{
body of for loop;
}
while (i <= 5) {
sum = sum + i;
++i;
}
printf("Sum of 1 to 5 = %d", sum);
return 0;
}
19. Differentiate between formatted and unformatted you input and output
functions?
Formatted I/P functions:
These functions allow us to supply the input in a fixed format and let us
obtain the output in the specified form. Formatted output converts the internal
binary representation of the data to ASCII characters which are written to the K2
output file.
Ex: printf, scanf functions
Unformatted I/O functions:
There are several standard library functions available under this category-
those that can deal with a string of characters. Unformatted Input/Output is
the most basic form of input/output. Unformatted input/output transfers the
internal binary representation of the data directly between memory and the
file.
Ex: gets,puts, getchar,putchar functions
20. What is the basic difference between for loop and while loop? K2
For loop is used when the number of iterations is known
already. Initialization of iteration variable, test condition and update of the
iteration variable are built-in in the for loop statement.
While loop is used when the number of iterations is not known already. The
iteration variable is initialized before the loop starts, and it is updated in every
iteration of the loop.
21. What are the differences between while loop and do-while loop? K2
WHILE LOOP DO-WHILE LOOP
Entry controlled loop Exit controlled loop
In while-loop, the given condition In do-while-loop, the given body of
is evaluated first and then the body the loop is executed first and then
of the loop is executed. the given condition is checked.
The body of the loop would be The body of the loop would be
executed only if the condition is executed at least once even if the
true. condition is false.
Syntax: Syntax:
while(condition) do
{ {
Body of the loop; Body of the loop;
} } while(condition);
P a g e | 13
Part B
S.No. Question BTL *
1. Explain the various input and output statements in C. K1
What are the different types of operators in C? Discuss each one of them
2. K2
with suitable illustrations.
a) Explain in detail about expressions in C. (8
marks) K2
3. b) What is precedence and order of evaluation? Explain in detail. (8 K2
marks)
4. Explain about decision making statements with suitable examples. K1
Explain switch statement with relevant example. (8
marks) K1
5.
Write a C program to design a simple calculator. (8 K3
marks)
Write in detail about the various looping statements available in C with
6. K2
illustrative programs.
a) Write a C program to reverse the digits of a number. (8
marks) K3
7. b) Write a C program to display the Fibonacci series. (8 K3
marks)
a) Write a C program to solve a quadratic equation. (8 marks)
Unit III
ARRAYS AND STRINGS
Course Objective – COb 3: To develop C programs using Arrays and Strings
Course Outcome - CO3 : Design and Implement Applications using Array and
Strings
Output:
String before strrev( ): computer
String after strrev( ): retupmoc
16. Mention the various string manipulation Functions in C. K1
strcpy(s1, s2); Copies string s2 into string s1.
strcat(s1, s2); Concatenates string s2 onto the end of string s1.
strlen(s1);Returns the length of string s1.
strcmp(s1, s2); Returns 0 if s1 and s2 are the same; less than 0 if
s1<s2;greater than 0 if s1>s2.
strchr(s1, ch); Returns a pointer to the first occurrence of character ch in
string s1.
strstr(s1, s2); Returns a pointer to the first occurrence of string s2 in string
s1.
17. What is sorting algorithm? K2
A sorting algorithm is used to rearrange a given array or list of elements in
ascending or descending order according to a comparisons on the elements.
The comparison operator is used to decide the new order of elements in the
respective data structure.
18. List some types of sorting. K2
Merge sort
Quick sort
Bubble sort
Insertion sort
19. What is searching? What are the two different types of searching? K1
Searching is a process used to check for an element whether it is found or
not in any data structure where it is stored. If it is found, it can be accessed.
The two different types of searching are;
1. Linear search (or) Sequential search
2. Binary search
20. Write a C program to create a matrix. K3
C program to create a 2 x 3 matrix:
#include <stdio.h>
#include <conio.h>
P a g e | 19
void main()
{
int a[2][3], i, j;
clrscr();
printf("\nENTER VALUES FOR THE MATRIX:\n");
for(i = 0; i < 2; i++)
for(j = 0; j < 3; j++)
scanf("%d", &a[i][j]);
printf("\nTHE MATRIX:\n");
for(i = 0;i < 2; i++)
{
for(j = 0; j < 3; j++)
printf("%5d",a[i][j]);
printf("\n");
}
getch();
}
Part B
S.No. Question BTL *
1. What is an array? Explain the declaration and initialization of one K2
dimensional with an example.
2. Explain the declaration and initialization of two dimensional array with an K2
example.
3. a) Write a program in c to find the first and second biggest element from K3
the given array of the integers. (8
marks) K3
b) Write a C program to reverse a string without changing the position of
special characters. (8
marks)
4. Explain in detail about string and the various string operations with relevant K2
examples.
5. Write a C program for to sort 10 names. K3
6. What is sorting? Explain any two types of sorting with programs and K3
examples.
7. Explain linear search and binary in detail with C programs. K3
8. a) Write a C program for matrix addition and subtraction. (8 K3
marks) K3
b) Write a C program to find the product of 2 matrices. (8
marks)