19AI304-Fundamentals of C-QR - NOV 2023
19AI304-Fundamentals of C-QR - NOV 2023
(PART A – 2 Marks)
UNIT - I
Q. No Questions
#include <stdio.h>
void main ()
{
int m=40, n=30;
if (m == n)
{
printf("m and n are equal");
}
printf("m and n are not equal");
}
Write a program to read only positive integer value from the user and display the value
6
on the monitor.
Write a program to find maximum between two integer numbers using conditional
8 operator.
Write a C program to read the age of a person and determine whether the person is
9
eligible for casting the vote using ternary operator
#include <stdio.h>
int main()
{
int num;
scanf("%d", &num);
if(num%6==0)
{
printf("Divisible by 6");
}
else
{
printf("Not Divisible by 6");
}
return 0;
}
UNIT - II
Q. No Questions
3 Develop code to sum all the prime numbers from 1 to 10 using do while loop.
7
Write a C Program to print 1 to N numbers using While loop
Construct a C Program to print the sum of even numbers from 1 to N using for loop
8
Write a C program to print the following triangular Star pattern using loop
***
9 **
*
Construct a C program to input two numbers from user and find maximum between two
10
numbers using switch case.
UNIT - III
Q. No Questions
Write a program to read n elements as input and print the second element of the array
6
(integer).
Construct a program to prepare EMI calculation for the sum of 25000, at 8% rate of
7
interest,5 years using function with return type with arguments.
8 Construct a program to count total number of positive elements in an array.
UNIT - IV
Q. No Questions
# include <stdio.h>
void fun(int *ptr)
{
*ptr = 30;
}
3 int main()
{
int y = 20;
fun(&y);
printf("%d", y);
return 0;
}
Show the output of the following program
#include <stdio.h>
void main()
{
4
char *s= "HELLO";
char *p = s;
}
5 Define Call by Reference.
How do you free the block of used memory in dynamic memory allocation? Write the
8
syntax and give example.
arr=(int*)malloc(50).
9
Write the code snippet to reallocate the memory as 100 using realloc().
6 Explain Enum in C.
7 Explain the need of structure.
8 Create a structure to hold the information of a Laptop(Brand name, Size in inches, price).
UNIT - I
Q. No Questions
3 Explain various types of Arithmetic, Relational & Logical Operators with Examples.
Construct a program to check whether the given year is leap year or not using
8
conditional operator.
Develop a program to find maximum between -700, -850, -650 using conditional
9
operator
10 Develop a program to convert 10 years into days & weeks.
UNIT - II
Q. No Questions
Construct a program to check the input entered by the user is palindrome or not
Sample Input : 11
4
Output: Palindrome Number
8 Construct a program to input month number and print the month name using switch
case.
Write a C program to find the eligibility of admission for a professional course based
on the following criteria:
Total in all three subject >=180
9
Marks in Maths >=60
Marks in Phy >=60
Marks in Chem>=60
10 Develop a C program to check whether the given number is perfect square or not.
UNIT - III
Q. No Questions
Construct a program to find the factorial of the given number using recursive
4
function.
5 Construct a program to combine the two strings without using built-in functions.
6 Construct a program to compare the two strings without using built-in functions.
Write a C program for a function that accepts x = 89878, y = 73638. Calculate the
7 sum and return the total number of carries.
Construct a C Program to find largest and second largest elements in the given array
8
using sorting.
Write a program to display the value using auto storage class without using looping
9
statements
Build a program to perform search operation to find whether the given element is
1
found or not .
Build a program to arrange the following values 56, 34, 23, 64, 12 in ascending
2
order using Selection sorting technique.
Construct a program to count total number of even elements in the following array
7
3,5,32,21,20 using malloc().
write a c program to find sum and average in the range from 14 to 17 using pointer.
9 Construct a program to print the reverse of the string using pointers.
UNIT - V
Q. No Questions
Construct a program to read (reg-no ,3 subject marks) and store the details of 5
4 students and calculate the Total and Average using union.
Construct a program to read and print a 10 Employee’s Details using array of
5
Structure.
Summarize Union with Examples. Write a Program to print integer, float, character
6
data using union.
Construct a program to read the Details of the 3 courses offered by the college
(course name, department, credits). Suggest a course with the highest credit using
8
Structure.
Example: course suggestion: Data Science, AI&DS, 6
Construct a C program to find the given date lies in the leap year or not using
9 structure. Create a structure Date (day, month, year).
UNIT - I
Q. No Questions
(i) Develop a C program to input a number from the user and check whether the
number is positive, negative or zero using a switch case. (6)
(ii) Read M & N as inputs from the user to specify the range. Construct a C Program
to
4
print the sum of numbers within the given range. (7)
Constraints:
1<=M<=100
1<=N<=100
and N>M.
UNIT - II
Q. No Questions
1 Develop a C program to print the pascal’s triangle pattern
1
11
121
1331
14641
1 5 10 10 5 1
1 6 15 20 15 6 1
UNIT - III
Knowledge
Difficulty
Q. No Questions CO Level
Level (1-5)
(Blooms)
Build a program to find the number of vowels, consonants, Special Characters and
1 CO3 K6 3
white spaces in a given text.
Build a Menu-driven program to count the numbers which are divisible by 3, 5 and
2 CO3 K6 3
by both.(passing an array to a function)
3 Construct a program to find sum of digits using recursion. CO3 K3 3
(i) Construct a C program to calculate the power for 8,4 using recursion.
4 (ii) Write a program to print odd/even numbers in given range based on lower limit CO3 K3 3
value/starting value using recursion.
UNIT - IV
Knowledge
Difficulty
Q. No Questions CO Level
Level (1-5)
(Blooms)
Construct a program to count the total number of even elements in an array using
2 Dynamic Memory Allocation. CO4 K3 4
(i) Develop a C program to add value 12 to list which already have 10 in that using
Construct a program to add two distances in inch –feet system using structure.
1 CO5 K3 4
(12 inches= 1 feet)
Build a structure for Electricity Bill (use service no, name, previous reading, current
reading, unit consumption & amount as data members)
2 CO5 K6 4
(units<=100 per unit Rs.2.00, units>100 and unit<=300 Rs=3.00 per unit, above 300
units Rs.5.00 per unit)
Build a structure program to read (empno, dept & basic pay) and store the data of 3
3 employees and calculate their Gross Salary (da =10% and HRA=30% from BP) CO5 K6 4
using nested structures.
(i) Construct a C program to store the data of different type & retrieve them using
union. (8)
4 CO5 K3 4
(ii) Write a program to display the class timings using enumeration.
(like first hour=8 am. fifth hour=12 pm)(7)