0% found this document useful (0 votes)
100 views24 pages

2021 CE143 Practical List

This document contains a practical list for the subject CE143 Computer Concepts and Programming. It outlines 13 practical exercises that students must complete. The practicals cover topics like introduction to C language, data types, operators, input/output, conditional statements, loops, arrays, strings, functions, structures, pointers, file management, and dynamic memory allocation. It also includes sample problems that demonstrate concepts like calculating population statistics, currency denominations for cash withdrawal, and computing employee net salary. Students are expected to write programs, draw flowcharts, provide algorithms and sample outputs for the given problems.

Uploaded by

Itachi Uchiha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
100 views24 pages

2021 CE143 Practical List

This document contains a practical list for the subject CE143 Computer Concepts and Programming. It outlines 13 practical exercises that students must complete. The practicals cover topics like introduction to C language, data types, operators, input/output, conditional statements, loops, arrays, strings, functions, structures, pointers, file management, and dynamic memory allocation. It also includes sample problems that demonstrate concepts like calculating population statistics, currency denominations for cash withdrawal, and computing employee net salary. Students are expected to write programs, draw flowcharts, provide algorithms and sample outputs for the given problems.

Uploaded by

Itachi Uchiha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

CE143 : Computer Concepts and Programming A.Y.

:2021-22

Charotar University of Science and Technology [CHARUSAT]


Devang Patel Institute of Advance Technology and Research
[DEPSTAR]
Practical List
Subject code : CE143 Semester : 1 Academic Year : 2021-2022
Subject name : Computer Concepts and Programming

CE:143 Computer Concepts and Programming Practical list


Practical Unit Aim of Practical
No.
1. Introduction to ‘C’ language Draw FlowChart and Write Algorithms.
2. Constants, Variables & Data Types in Write a program using Constants, Variables,
‘C’ arithmetic expressions, data types, type
modifiers and type conversions.
3. Operators and Expression in ‘C’ Write program providing understanding of
Relational, logical, ternary and bitwise
operators.
4. Managing Input & Output Operations Write a program for formatted and unformatted
output in C.
5. Conditional Statements & Branching Write programs using If, If-else, If-else-if, Nested
If, break, continue, goto and switch statements.
6. Looping Write programs using While loop, Do-while,
simple for loop, nested for loop, break and
continue.
7. Arrays Write programs on arrays (Sorting, Merging,
finding particular value, etc.)
8. Character Arrays and Strings Write programs for string function (strlen,
strcat, strcmp, strcpy, strrev, strstr, etc.) using
array.
9. User-Defined Function in ‘C’ Write a program having user defined function
having various scenarios of arguments and
return values
10. Structures and Union Write a program to define struct and union and
use their members.
11. Pointers Write a program explaining about how pointers
are useful with Arrays and Functions.
12. File Management in ‘C’ Write a program for file management functions
like: Create, Open, Read, Write and Close file
operations.
13. Dynamic Memory Allocation Create programs for dynamically allocating
memory in C programs using standard library
functions: malloc (), calloc(), free() and realloc().
CE143 : Computer Concepts and Programming A.Y. :2021-22

Set Program Program


No. No.

1 1.1 Write a C program that will output this passage by Michael Singer. Make sure your
output looks exactly as shown here (including spacing, line breaks, punctuation, and
the title and author). Use Required Escape Sequence and ASCII Value.
Outcome:

Note:
There are three shapes in the output: Smiling Face, Diamond & Heart.
The ASCII Value for Smiling face is 1.

The ASCII Value for Diamond is is 4.

The ASCII Value for Heart is is 3.


Also draw flowchart and write algorithm.
Try this example on Turbo C or Code blocks only.
Question:
1. Have you learnt about ASCII values for different symbols other than smile,
diamond and heart? If yes, then mention any 5 ASCII symbols and their values
in tabular format.
Sr. No. Symbol ASCII Value
1
2
3
4
5

1.2 Write your bio-data using Escape Sequences. And you have to take your Basic
Information as user input. It should contain the following content. It should contain
the following content.
Expected Outcome:
Draw flowchart, write algorithm and program for given scenario. Also attach screenshot
of output
CE143 : Computer Concepts and Programming A.Y. :2021-22

Questions:
1. What is the purpose of using escape sequences? Answer in one or two statements.
Mention any 5 escape sequences used regularly along with their purpose.
Sr. No. Escape Sequence Purpose
1
2
3
4
5
CE143 : Computer Concepts and Programming A.Y. :2021-22

2. 2.1 In a town, the percentage of men is 52. The percentage of total literacy is 48. If total
percentage of literate men is 35 of the total population, write a program to find the total
number of illiterate men and women if the population of the town is 80,000.
Expected Outcome:
Draw flowchart, write algorithm and program for given scenario. Also attach screenshot
of output.
Fill below mentioned table as per your output.
Sr. No. Get Outcome Value
1 Total Population
2 Number of Literate (Men + Women)
3 Number of Men
4 Number of Literate Men
5 Number of illiterate Men
6. Number of Women
7. Number of Literate Women
8. Number of illiterate Women
Questions:
1. Has this scenario helped you learn about integer and float datatype? If yes, then
mention the requirements of using integer and float data types.
CE143 : Computer Concepts and Programming A.Y. :2021-22

2.2 A Bigbazaar cashier has currency notes of denominations 10,50 and 100. If the amount
to be withdrawn is input through the keyboard in hundreds, find the total number of
currency notes of each denomination the cashier will have to give to the withdrawer.
Expected Outcome:
Draw flowchart, write algorithm and program for given scenario. Also attach screenshot
of output
Fill up the required number of currency notes of denomination 10, 50 and 100 in below
given table as per the output received.
Sr. No. Note Requirements Counts
1 Requirement of 100 Rs. note
2 Requirement of 50 Rs. note
3 Requirement of 10 Rs. note
Questions:
1. Have you learned about how scanf function can be used to collect the user input?
Give the correct answer for the following table:

Sr. No. Data Type Format Specifier Example of data


1 Integer
2 Float
3 Char
CE143 : Computer Concepts and Programming A.Y. :2021-22

2.3 Write a program to calculate Net Salary. User has to input Basic Salary and Output
should be:
Enter Basic Salary: 5000 (e.g. 5000)
Allowances:
DA = 70% of Basic Salary
HRA = 7% of Basic Salary
MA = 2% of Basic Salary
TA = 4% of Basic Salary
Deduction:
PF = 12% of Basic Salary
IT = any value (e.g. 500)

Net Salary = Basic Salary + Allowances – Deduction


Expected Outcome:
Draw flowchart, write algorithm and program for given scenario. Also attach screenshot
of output.
Fill up the data mentioned in below given table as per the output received.
Sr. No. Input/Outputs Amount
1 Enter your Basic Salary
2 DA of Basic Salary
3 HRA of Basic Salary
4. MA of Basic Salary
5. TA of Basic Salary
6. PF of Basic Salary
7. Gross Salary
8. Net Salary
Questions:
1. Have you learned about various data types that can be suitably used for this
problem? Do mention which data types can be used and why? Also mention the
difference between the outputs.

3 3.1 Write a program that takes the length of the pendulum as input and then calculate the
time period of the pendulum. Provided that, T=2π√L/G. Define the value of π as 3.14
and take L as the length of the pendulum and G as the acceleration of gravity either in
m/s or as input from the keyboard. Display the time period rounded to 2 decimal
places.
Hint:
Use Math.h header file, use #define for specifying the value of π
Expected Outcome:
Draw flowchart, write algorithm and program for given scenario. Also attach screenshot
of output.
Fill up the output as per the inputs mentioned in below given table as per the output
received in console.
CE143 : Computer Concepts and Programming A.Y. :2021-22

Input Output
Sr. No.
Length Gravity Time Calculated(seconds)
1. 50 m 9.8 m/s2
2. 50 m 0 m/s2
3. 50 m 0.9993 g
4. 50 m -1 g
Questions:
1. Have you learned about, how math function is useful for calculating square root?
Which datatype is supported by all math functions? Also mention any 5 math
functions with their purpose.
Sr. No. Math function Description
1.
2.
3.
4.
5.

3.2 Let us understand the working of Pre-increment, Post-increment, Pre-decrement and


Post-decrement
a) Consider a scenario where, Boys are playing in the park and collecting and
removing the yellow balls in/from the bucket based on teacher’s instruction.
Let’s say there are already 10 Yellow balls present in a bucket. Following is the
sequence of the instructions given by the teacher for adding/removing the balls.
i. Rajiv: ++ Yellow
ii. Preet: --Yellow
iii. Raj: Yellow++
iv. Ritul: Yellow--

Expected Outcome:
Fill up the data mentioned in below given table as per the output received.
Sr. No. Instructions Yellow
1. Count before execution
2. Count after execution

b) Consider another scenario where boys and girls both are asked to add/remove
Yellow and Pink balls from the bucket respectively. Currently there are 10
Yellow balls in the bucket and 20 Pink balls.
Teacher has given the sequence of instructions as below for adding/removing
the balls.
Calculate = ++Yellow + Yellow++ + --Yellow + ++Pink - --Pink - --Pink
Get the count of Yellow and Pink balls after evaluating above given scenario.
CE143 : Computer Concepts and Programming A.Y. :2021-22

Expected Outcome:
Fill up the data mentioned in below given table as per the output received.
Sr. No. Instructions Yellow Pink
1. Count before execution
2. Count after execution

Also get the count of calculate and explain how it is calculated in stepwise manner.
(hint: left to right, as per memory)

Questions:
Have you understood the working of Pre-increment, Post-increment, Pre-decrement and
Post-decrement?
Rubrics: Output should be as mentioned in the expected outcome, if it is imperfect then
submission marks are proportional.

3.3 Write a C program to swap two numbers (use two variables for collecting value from
user) without using third variable. (Hint: Use arithmetic operators)
Expected Outcome:
Draw flowchart, write algorithm and program for given scenario. Also attach screenshot
of output.
Fill up the output as per the output received in console.
Sr. No. Instruction Number1 Number2
1. Before Swapping
2. After Swapping
Questions:
1. Have you learned about, how we can use arithmetic operators for swapping the
numbers?
CE143 : Computer Concepts and Programming A.Y. :2021-22

4 4.1 a. Write something about your characteristics not more than 50 words using gets
function and print out the same using puts function.
Expected Outcome:
Draw flowchart, write algorithm and write program for given scenario. Also attach the
screenshot of output.
Questions:
1. What is the significance of using gets and puts? Are they acting as replacement
of any function? How?
b. Write a program to convert the decimal number into octal and hexadecimal
format. Print hexadecimal and octal values for given inputs in expected
outcomes.
Hint: Use %o and %x
Expected Outcome:
Draw flowchart, write algorithm and program for given scenario. Also attach screenshot
of output.
Fill up the output as per the inputs mentioned in below given table as per the output
received in console.
Sr. No. Inputs Octal Hexadecimal
1. Your Roll No
2. 143
3. 0
4. 1
5. -1

4.2 Write a C Program to Print multiplication table from 1 to 7 to achieve the following
output. (Use #define directives and do while loop)
Expected Outcome:
Draw flowchart, write algorithm and write program for given scenario.
CE143 : Computer Concepts and Programming A.Y. :2021-22

5 5.1 Write a C program for the given scenario from the flowchart. Note that you have to
enter your own height in centimeters.

Expected Outcome:
Write algorithm and write program for given scenario. Also attach screenshot of output.
Tick marks your achieved result in the appropriate column:
Sr. No. Inputs (cm) Dwarf Average Tall Abnormal
1. Your Height
2. Your Mother’s height
3. Your Father’s height
4. Your Sibling’s height
CE143 : Computer Concepts and Programming A.Y. :2021-22

5.2 Write a C program to find all roots of a Quadratic equation using nested switch case.
Take three user inputs from keyboard for finding the discriminant (b2 – 4ac). Use the
concept of nested switch case for finding the roots of equation. Get the outputs for roots
till 2 decimal points only.
Hint:
Discriminant > 0
root1 = (-b + sqrt(discriminant)) / (2*a)
root2 = (-b - sqrt(discriminant)) / (2*a)
Discriminant < 0
root1 = root2 = -b / (2*a)
imaginary = sqrt (-discriminant) / (2*a) (eg. Print it as: i20.3, i.e. i followed by value)
Discriminant = 0
root1 = root2 = -b / (2*a)
Expected Output:
Draw flowchart, write algorithm and program for given scenario. Also attach screenshot
of output.
Input values in the console as per the table given below and write the results in the table,
based on received output.
Sr. No. Inputs Root1 Root2 Imaginary
a b c
1. 1 2 3
2. 3 -7 -5
3. 9 12 4
Questions:
1. Have you learned about how to use normal switch case and nested switch case?
2. Is default case necessary for every switch case?
3. What if break statement is not mentioned between two consecutive cases?

5.3 If the ages of Ram, Shyam and Ajay are input through the keyboard, write a program
to determine the youngest of the three. If all of them are of same age then print that “All
are of same age”. (Hint: Use Nested if else statement)
Expected Output:
Draw flowchart, write algorithm and program for given scenario. Also attach screenshot
of output.
Take different input values as per your wish and given scenario get output.
Sr. No. Inputs Expected
Ram Shyam Ajay Output
1. Same Same Same All are of equal age
2. Different Different Different Ram/Shyam/Ajay is
youngest
3. Same Same Different Ram and Shyam are
equal
CE143 : Computer Concepts and Programming A.Y. :2021-22

4. Different Same Same Shyam and Ajay are


equal
5. Same Different Same Ram and Ajay are
equal
Questions:
1. Have you tried merging the concepts of Nested if else and else if ladder in this
scenario?
2. Differentiate the concept of Nested if else and else if ladder.
5.4 The policy followed by a company to process customer orders is given by the
following rules: Suppose stock=100
a) If a customer order is less than or equal to that in stock and ‘has credit’ is OK,
supply ‘has requirements.
b) If ‘has credit’ is not OK do not supply. Send him intimation.
c) If ‘has credit’ is OK but the item in stock is less than ‘has ordered’, inform ‘out
of stock’ and intimate him that the balance will be refunded.
Write a C program to implement the company policy.
Expected Outcome:
Draw flowchart, write algorithm and program for given scenario. Also attach screenshot
of output.
Give the inputs in the console as per the below given table, and provide the output
accordingly.
Sr. No. Inputs
Output
Credit Order Stock
1. Y or y 20 100
2. N or n 50 80
3. Y or y 50 80
4. Y or y 70 30
5. Y or y 30 30
Questions:
1. Which kind of logic have you used for building this program? If else if ladder
or nested if else statements?
CE143 : Computer Concepts and Programming A.Y. :2021-22

6 6.1 There is a person, who is asked to enter the alphanumeric password for registering into
an ecommerce website for purchasing products from website. But he is not aware about,
what does Alphanumeric mean. So, he tries entering various combinations 5 times, but
he fails to create such password. So let us help him by writing a C program to validate
his password. Constraints for writing password are it should have combination of
lowercase, uppercase and digit.
Note: Use Do while loop, and give print appropriate outputs on incorrect validations.
Expected Outcome:
Draw flowchart and write algorithm and write program for given scenario.
Mention all the inputs that you have experimented and outputs received. Also mention
the correct alphanumeric password created by you.
Sr. No. Inputs Output
1. Mention here the passwords used for Password does not satisfy
wrong experiments constraints!!! Please try
again
2. Mention the passwords that gave you Good Password, you may
correct validation proceed
Questions:
1. Have you understood working of do…while loop? Do mention the syntax of
this loop.
2. Have you used for loop in this program?
3. What is goto statement? How is it useful?

6 6.2 Two numbers are entered through the keyboard. Write a program to find the value of
one number raised to the power of another. (Use While loop)
Expected Outcome:
Draw flowchart, write algorithm and program for given scenario. Also attach screenshot
of output.
Mention at least 3 different inputs that you have experimented and outputs received.
Sr. No. Base No. Power Output
1.
2.
3.
Questions:
1. Have you understood the concept of while loop? if yes write its syntax here.
CE143 : Computer Concepts and Programming A.Y. :2021-22

6.3 Write a C program for Big bazaar cashier to count the amount to be collected from the
customer. Cashier will enter the numbers one after another for each item and to get the
summation of entered numbers, he has to enter 0.
(Use for loop) (Hint: Break statement can be used)
Expected Outcome:
Draw flowchart, write algorithm and program for given scenario. Also attach screenshot
of output.
Mention at least 3 different inputs that you have experimented and outputs received.
Sr. No. Entered Number Summation after entering 0
1.
2.


N.
Questions:
1. Have you learned the concept of for loop using above given scenario? Explain
what does ‘i’ stands for in the for() loop, consider the given example below.
E.g. for(i=0;i<10;i++)

6.4 Write a program for a match-stick game between the computer and a user.
Your Program should ensure that the computer always wins. Rules for the games are as
follows:
● There are 21 match-sticks.
● The computer asks the player to pick 1, 2, 3, or 4 match-sticks.
● After the person picks, the computer does its picking.
● Whoever is forced to pick up the last match-stick loses the game.
Use while loop, break and Continue Statements.
To understand the above game in a better way, visit the following link:
http://atozmath.com/Games/21MatchStick.aspx
Expected Outcome:
Draw flowchart, write algorithm and program for given scenario. Also attach screenshot
of output.
Write the sequence of sticks inputted by you and computer one after another.
Sr. No. Entered Number Entered Number Sticks left
by User by Computer
1.
2.


N.
Questions:
1. What is the significance of using break and continue statement?
CE143 : Computer Concepts and Programming A.Y. :2021-22

7 7.1 Twenty-five numbers are entered from the keyboard into an array. Write a C program
to find out how many numbers of them are positive, negative, and how many are even
and odd?
Expected Outcome:
Draw flowchart, write algorithm and program for given scenario. Also attach screenshot
of output.
Enter the counts of positive, negative, even and odd numbers in the below given table
as per the output received.
Sr. No. Parameter Counts
1. Positive Numbers:
2. Negative Numbers:
3. Even Numbers:
4. Odd Numbers:
Questions:
1. Is it necessary to initialize a variable with zero everytime? If yes, then why? If
No, then when is it necessary to initialize the number with zero and why?

7.2 Write a program for creating two arrays of different size and merge both arrays into one
by sorting those arrays in ascending order. [Merge by sorting]
Expected Outcome:
Draw flowchart, write algorithm and program for given scenario. Also attach screenshot
of output.
Following screenshot showcases the expected outcome, you can enter the input values
of your choice

7.3 Write a Program to multiply any two 3*3 Matrices.


Test Data:
Input the rows and columns of first matrix: 3 3
Input the rows and columns of second matrix: 3 3
Expected Input and Output:
Draw flowchart, write algorithm and program for given scenario. Also attach screenshot
of output.
Input for first matrix:
CE143 : Computer Concepts and Programming A.Y. :2021-22

j[0] j[1] j[2]


i[0] 2 5 8
i[1] 3 6 9
i[2] 4 7 10
Input for Second Matrix:
j[0] j[1] j[2]
i[0] 2 3 4
i[1] 9 7 6
i[2] 1 5 2
Fill up the matrix multiplication data in the below given table as per the output received:
j[0] j[1] j[2]
i[0]
i[1]
i[2]
Questions:
1. State the advantages of using Array Indexes. When is it suitable to take array
index?

8 8.1 Help user to identify how strong is his password based on the number of lowercase
alphabets, uppercase alphabets, digits and special characters given by the user from the
keyboard. Length of entered password(string) should be of 8.
Constraints for identifying strength of password:
1. Strong: Mixture of lowercase alphabets, uppercase alphabets, digits and special
characters
2. Average: Mixture of lowercase alphabets, digits and special characters
3. Poor: Either only has alphabets/digits/special characters
Expected Outcome:
Draw flowchart, write algorithm and program for given scenario. Also attach screenshot
of output.
Look at the example given in table and try various test cases such a way to get the varied
strength of password (Strong/Average/Poor).
Sr. No. Input Lowercase Uppercase Digits Symbol Output
Example Abc@1234 ✓ ✓ ✓ ✓ Strong
1.
2.
3.
Questions:
1. Explain the difference between string and character. Also write the syntax for
printing character and string.
CE143 : Computer Concepts and Programming A.Y. :2021-22

8.2 Let us assume, teacher is supposed to allot seats based on the student’s names. You are
requested to help teacher by creating a C program, for collecting the names of 5 students
and sort them in alphabetical order.
Hint: Use string functions, use fgets function to collect the names of students.
Expected Outcome:
Draw flowchart, write algorithm and program for given scenario. Also attach screenshot
of output.
Enter the inputs entered by you for 5 names, and give the output how they are sorted.
Sr. No. Input of names Sorted Output as per output
1.
2.
3.
4.
5.
Questions:
1. Which string functions have you learned from this program? Explain any 5
string functions in below given table.
Sr. No. String Functions Syntax Purpose
1.
2.
3.
4.
5.

8.3 Write a C program to check if the user inputted string is palindrome or not using
recursion.
Expected Outcome:
Draw flowchart, write algorithm and program for given scenario. Also attach screenshot
of output.
Enter the following test inputs and give the output as per the output gained.
Sr. No. Input Sorted Output as per output
1. Alpha
2. Madam
3. saippuakivikauppias
4. Hannah
Questions:
1. Explain the concept of recursion. Explain the difference between recursion and
iteration?
CE143 : Computer Concepts and Programming A.Y. :2021-22

9 9.1 Write a C program to check if the entered number is prime or not by using types of user
defined functions
(i) No arguments passed and no return value
(ii) No arguments passed but a return value
(iii) Argument passed but no return value
(iv) Argument passed and a return value
Expected Outcome:
Draw flowchart, write algorithm and program for given scenario. Also attach screenshot
of output.
Enter the details into the table based on the inputs entered by you and tick mark the
column, whether the inputted value is prime or non-prime:
Sr. No. User Defined Functions Input Prime Non-Prime
1. No arguments passed and
no return value
2. No arguments passed but a
return value
3. Argument passed but no
return value
4. Argument passed and a
return value

Questions:
1. You might be clear now, how user defined functions are created in different
ways. Explain them.

9.2 Verify the triangle, if the length of the sides of a triangle are denoted by a, b and c, then
the area of triangle is given by:

Use nested function.


Collect the values for a, b and c from user for identifying whether it forms Triangle or
not.
Expected Outcome:
Draw flowchart, write algorithm and program for given scenario. Also attach screenshot
of output.
Enter the inputs for verifying triangle and mention the results in the below mentioned
table format. Tick mark whether based on input, triangle is formed or not.
Sr. No. Input Forming Triangle Not a Triangle
CE143 : Computer Concepts and Programming A.Y. :2021-22

a b c
1.
2.
3.
Questions:
1. Explain the concept of nested functions in C.

9.3 A positive integer is entered through the keyboard, write a function to find the binary
equivalent of this number using recursion.
Expected Outcome:
Draw flowchart, write algorithm and program for given scenario. Also attach screenshot
of output.
Enter the inputs for converting the number into binary form, try it for three different
inputs and fill the below given table:
Sr. No. Input Binary
1.
2.
3.
Questions:
1. Mention the advantages of using recursion in a program.

10 10.1 Write a C program to create a structure of Book Detail and display the details of the
book in appropriate format by passing structure as a function argument.
Book Detail must contain following information:
Book Title, Author name and Amount of book in float.
Expected Outcome:
Draw flowchart, write algorithm and program for given scenario. Also attach screenshot
of output.
Enter the inputs for converting the number into binary form, try it for three different
inputs and fill the below given table:
Sr. No. Book Title Author Name Amount of book
1.
2.
3.
Questions:
1. Can we declare function inside structure of C Programming? Explain Why?

10.2 Create a Union called library to hold accession number, title of the book, author name,
price of the book and flag indicating whether the book is issued or not. (flag = 1 if the
book is issued, flag = 0 otherwise). Write a program to enter data of one book and
display the data.
Expected Outcome:
CE143 : Computer Concepts and Programming A.Y. :2021-22

Draw flowchart, write algorithm and program for given scenario. Also attach screenshot
of output.
Enter the inputs for collecting the details for library books. Here, if user inputs flag=1,
then book is issued else book is not issued.
Accession
Sr. No. Title of Book Author Price Flag Output
Number
1. Book
Issued
2. Book Not
Issued

Questions:
1. Explain the major difference between structure and union in detail.

10.3 Write a C program for collecting and displaying employee details such as, Age, Name,
Address and Salary by using nested structure.
Expected Outcome:
Draw flowchart, write algorithm and program for given scenario. Also attach screenshot
of output.
Get the output as mentioned below:

Questions:
1. Explain how nested structure works in C programming.

11 11.1 Write a program to read the marks of 10 students for the subject CE143 Computer
concepts and Programming and computes the number of students in categories FAIL,
PASS, FIRST
CLASS and DISTINCTION using Pointers and Arrays.
Marks Categories

70 or above DISTINCTION
CE143 : Computer Concepts and Programming A.Y. :2021-22

69 to 60 FIRST CLASS

59 to 40 PASS

Below 40 FAIL
For example, if following marks of 10 students are entered:
34 56 78 98 12 31 67 75 91 23
Then the output should be
DISTINCTION 4 FIRST CLASS 1 PASS 1 FAIL 4
Expected Outcome:
Draw flowchart, write algorithm and program for given scenario. Also attach screenshot
of output.
You are requested to gain all categories of results, so input the values accordingly, also
write the counts of all the categories.

Sr. No. Input Distinction First Class Pass Fail


1.
2.
...
10.
Counts
Questions:
1. Explain the importance of using pointers?
11.2 Write output for the following programs:
1. (Pointers to Functions)

#include<stdio.h>
void display();
int main()
{
void (*func_ptr)();
func_ptr=display;
printf("Address of functions display is
%u\n",func_ptr);
(*func_ptr)();
return 0;
}
void display()
{
puts("By helping others, we help overselves!!");
}
CE143 : Computer Concepts and Programming A.Y. :2021-22

2. (Functions Returning Pointers)


char *copy (char*,char *);
int main()
{
char *str;
char source[] = "Kindness";
char target[10];
str=copy(target,source);
printf("%s\n",str);
return 0;
}
char *copy(char *t,char *s)
{
char * r;
r = t;
while(*s!='\0')
{
*t=*s;
t++;
s++;
}
*t='\0';
return(r);
}

12 12.1 Write a program to read a text file ‘Demo.txt’ and print each word of that file in reverse
order.
Expected Output:
Draw flowchart, write algorithm and program for given scenario. Also attach screenshot
of output.
Example:
Input: HELLO
Output: OLLEH
Questions:
1. Explain, why do we need to use files in C?

12.2 Write a C program that illustrates how to write into a file using putw() function and
how to read the same file using getw() function.
Use fopen(), fclose(), getw() and putw() functions.
Expected Outcome:
CE143 : Computer Concepts and Programming A.Y. :2021-22

Draw flowchart, write algorithm and program for given scenario. Also attach screenshot
of output.
Enter the data in a file from console and retrieve that data on the console.
Also attach the screenshot of file where the data is written.
Questions:
1. Explain any 3 functions of file other then mentioned in the problem.
Sr. No. Function Purpose

12.3 Two files Data1.txt and Data2.txt contains list of integers. Write a program to produce
file Data3.txt which holds as merged list of these two lists. Use command line
argument to specify the file name.
Expected Outcome:
Draw flowchart, write algorithm and program for given scenario. Also attach screenshot
of output.
Enter the data in a file from console and attach the screenshots of Data1.txt, Data2.txt
and Data3.txt files. Also add the screenshot of console.
Questions:
1. Explain the difference between argc and argv along with their significance.

13 13.1 Write a program to read and print the student details using structure and Dynamic
Memory Allocation.
Following student details needs to be included:
Roll No., Name, Age, Class, Branch.
Expected Outcome:
Draw flowchart, write algorithm and program for given scenario. Also attach screenshot
of output.
Enter this student details for N number of students, collect the no. of details to be
entered from the user and ask for that many student’s details. Enter all details in below
mentioned table and print the values collected from user.
Roll
Sr. No. No. Name Age Class Branch
1.
2.
...
N.
Questions:
1. Explain the benefits of using dynamic memory allocation. Give one scenario
where it is most useful.

13.2 Write a program using a character string in a block of memory space created by calloc
CE143 : Computer Concepts and Programming A.Y. :2021-22

() and then modify the same to store a larger string using realloc () function. (Dynamic
Array).
Expected Outcome:
Draw flowchart, write algorithm and program for given scenario. Also attach screenshot
of output.
Enter the details in below given table as per the requirement:
Sr. No. Instruction Output
1. String to be entered
2. String received after reallocation of memory
Questions:
1. Mention advantage of using realloc() function.

13.3 Write a program to enter N numbers into array and find average. Enter the size of the
array through keyboard. (Dynamic Array). Use malloc () to allocate memory and
use free() to free the memory after the use.
Expected Outcome:
Draw flowchart, write algorithm and program for given scenario. Also attach screenshot
of output.
Enter the details in below given table as per the requirement:
Sr. No. Instruction Output
Enter the size of Array N (To be entered by user)
1. To be entered by user
2. To be entered by user
… To be entered by user
N. To be entered by user
Average of entered values

You might also like