0% found this document useful (0 votes)
24 views

7.C Programming Lab

Uploaded by

Dhanuz Pc
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

7.C Programming Lab

Uploaded by

Dhanuz Pc
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Government of Karnataka

Department of Technical Education


Board of Technical Examinations, Bengaluru
Course Title : C- Programming Lab Course Code : 15EC37P
Semester : Third Credits : 3 Credits
Teaching Scheme in Hrs (L:T:P) : 0:2:4 Course Group : Core
Type of course : Tutorial + Practical Total Contact Hours : 78
CIE : 25 Marks SEE : 50 Marks
.
Prerequisite
Basics of digital electronics and number systems, and logical thinking
Course Objectives
1. Understand the need for high-level languages, particularly C, and programming paradigms.
2. Familiarize with program-development environment and development of simple programs in C
3. Understand the need and role of data-structures such as arrays, strings and pointers, and
functions in C-program development.
Course Outcomes
At the end of the course, the students will be able to attain the following COs
Experiments Linked Teaching
Course Outcome CL linked PO Hrs
Appreciate the necessity and evolution
Unit-1
CO1 of the computer language and R/U/A 1,2,4,10 5
Chapter 1
selection of programming paradigms.
Perform algorithm development, its Unit 1
representation using flow-charts and Chapter1,
CO2 R/U/A 1,2,3,4,10 31
analysis of solution for simple 2,3,4,5,6 and
problems. practice programs
Employ C-programming language for
Unit 2 1,2,3,4,5,
CO3 simple real-world problem-solving R/U/A 18
Programs 1 to 6 10
using computer.
Develop and analyze simple
Unit 2 1,2,3,4,5,
CO4 programs/functions and their R/U/A 18
Programs 7 to 11 10
integration in larger problem solving.
Two CIE/IA Tests 06
Total 78
Legend: E- Experiment, R-Remember, U-Understand, A-Application, CL-Cognitive Level, PO-Program Outcome
Note: Total sessions include two tests

Directorate of Technical Education Karnataka State 15EC37P Page 1


Course-PO Attainment Matrix

Programme Outcomes
Course
1 2 3 4 5 6 7 8 9 10

C- Programming Lab 3 3 3 3 3 -- -- -- -- 3

Level 3- Highly Addressed, Level 2-Moderately Addressed, Level 1-Low Addressed.


Method is to relate the level of PO with the number of hours devoted to the COs which address the given PO.
If >40% of classroom sessions addressing a particular PO, it is considered that PO is addressed at Level 3
If 25 to 40% of classroom sessions addressing a particular PO, it is considered that PO is addressed at Level 2
If 5 to 25% of classroom sessions addressing a particular PO, it is considered that PO is addressed at Level 1
If < 5% of classroom sessions addressing a particular PO, it is considered that PO is considered not-addressed.

Course Contents

Unit-1: Tutorials and Practice Exercises 36 Hours


Tutorial
Sl. Duration
Topic/Exercises
No. (Hr.)
1 Introduction
Definition, need, and types of programming languages and their selection
criterion.
∑ Need for programming language
∑ Computer programming languages: Machine language, assembly/low-
level language, middle-level language and high-level languages.
Features and advantages and disadvantages.
∑ Algorithm and methods of writing algorithms: pseudo-code and flow-
charts
∑ Features of pseudo-code or flow-charts
∑ Programming paradigms: Features of procedure oriented programming
(POP) and object oriented programming (OOP) paradigms 10
∑ Program development process (writing, editing, compilation, linking,
execution and debugging and file extensions) and tools
∑ Programming errors: Syntax, semantic, linker, and run-time (logical
and data) errors
∑ C-program format
∑ Introduction to standard input and output statements
∑ Variables and constants: Definition, naming (identifiers or labels for
different entities), initialization and accessing of variables. Constants
and their representation
∑ Data types: classification, memory requirement, range of values, usage
and type specifiers

Directorate of Technical Education Karnataka State 15EC37P Page 2


∑ Operators and Operands: Unary, binary and ternary operators.
Arithmetic, logical, relational, combinational-assignment and special
operators. Precedence and associativity. Unary and binary operands
∑ Statements- tokens and expressions
∑ Type casting-automatic and forced
∑ Escape characters
∑ I/O statements in detail
2 Control structure
∑ Branching: Conditional (if, if-else, nested and ladder if-else, switch
constructs) and unconditional (brake, continue and goto statements) 06
∑ Looping: Entry-controlled (for and while) and exit-controlled (do
while) loops
3 Arrays/Matrices, strings and pointers
∑ Definition, declaration, initialization (static and run-time or dynamic)
of arrays, strings and pointers 06
∑ Accessing of strings, arrays (one and two dimensional), and pointers

4 Functions
∑ Concept, pros and cons, classification, creation and application of
functions
∑ Parameter passing: Pass by value and address methods 05
∑ Library and user-defined functions
∑ Recursive and non-recursive functions
∑ Data visibility and longevity
5 User-defined data-type
∑ Definition, declaration, initialization of members and variables of
structures and unions 06
∑ Distinction between structures and unions
∑ Accessing of members of structures and unions
6 Macros
Definition, classification and application of macros in program
03
development

Total Duration (Hr.) 36

Practice Exercises
1. Write algorithm, flow-chart and program for the following problems (Assume
relevant data if necessary and right units. Search and use library functions wherever
possible).
1. Display your country name and beep at the end.
2. Display the following text:
C was developed by “Dennis M Ritchie” in 1972
3. Compute the area and circumference of a circle given the radius
4. Compute simple interest given the interest rate, principal and duration

Directorate of Technical Education Karnataka State 15EC37P Page 3


5. Compute compound interest given the interest rate, principal, compounding-nature
and duration
6. Swap contents of two variables without using intermediate variables
7. Display expenditure incurred against each item, such as fee receipt
8. Factorial of a single digit number
9. Absolute value of a number
10. Verify if the given number is prime or not
11.Largest of three numbers using if-else and ternary operators
12.Logarithm of a number.
13.sin(θ1+ θ2)+cos(θ1- θ2) given θ1 and θ2 in degrees
14.Average of N numbers read through keyboard (i.e., at run-time)
15.Average of the numbers in an N x M matrix
16.Search a number in an array of N integers
17.Verify Pythagoras theorem.
18.Compute the area and circumference of a circle given the radius using macro for pi.
19.Find smallest of three numbers using macro
20.Use function to swap contents of two variables using (a) by pass-by-value and (b)
pass-by-address methods
2 Analysis of the program
Given the program or block of program code, analyze the same and record the output or
error, as the case may be. Justify your answer. Examples,
1. #include<stdio.h>
main()
{
int k=5, l=24; printf(“%f”, k/l);
}
2. #include<stdio.h>
main()
{
printf(“Saying by Mahatma\tGhandiji: \nWhat can\’’t be tolerated must be endured’’);
}
3. int i;
for (i=1; i<10; i--);

Unit – 2: Graded Exercises 42 Hours

Write the algorithm/flow-chart and code for the following problems


Note: Assume appropriate data and units wherever necessary. Library functions, unless specified,
can be used wherever necessary.

Sl. Duration
No.
Graded Exercises (Hr.)
Given the resistance and standard tolerance, generate the color bands of
1 3
the resistor
2 Given the total marks, generate the result-class of a student 3

Directorate of Technical Education Karnataka State 15EC37P Page 4


3 Given an alphabet, display whether it is VOWEL or CONSONANT 3
4 Multiply two matrices using array-subscript method 3
5 Add two matrices using pointers 3
Given a string, reverse it using your own code and a library function;
6 3
compare the time consumed in both approaches
Given x in radians, compute sin(x) using series method and the
7 3
corresponding library function; compare both methods for execution time.
Create a structure to represent a book and declare an array of N variables
8 of the type book and sum and display the cost members of all the book 3
variables
9 Simulate the arithmetic calculator 3
10 Sort a list of N numbers using user defined function 3
11 Two open-ended experiments of similar nature and magnitude of the above
are to be assigned by the teacher (Student is expected to solve and
execute/simulate independently. Open-ended programs covered here shall not 6
be included in the exam)
Two Internal Assessment Tests 6
Total 42

Unit – 3: Student Activity for CIE

Sl. No. Activity


1 Prepare/Collect notes pertaining to Unit-1 and solve practice programs specified in
Unit-1
2 Collect or write any 10 programs (open-ended) not specified in Unit-1 or Unit-2
3 Prepare a list of high-level programming languages, collect features of any five such
high-level programming languages and collect/prepare material on C-program
development tools and their usage.

Institutional Activity (No marks)


The following are suggested institutional activities, to be carried out at least one during the
semester. The course teacher/coordinator is expected to maintain the relevant record (Containing,
Activity name, Resource persons and their details, duration, venue, student feedback, etc)
pertaining to Institutional activities

Sl. No. Activity


1 Organize hands-on practice on installation of Compilers and use of IDE for program
development.
2 Organize seminar on free-open source software
3 Conduct quiz on C programming

Directorate of Technical Education Karnataka State 15EC37P Page 5


References
1. C Programming By Balaguruswamy, TMH Publishers, ISBN-10: 8131716813, 2009.
2. C Programming By Kernighan and Dennis Ritchie
Course Delivery
The idea behind this course delivery is to provide relevant tutorial and hands-on practice
concurrently. The course will be normally delivered through two-hour tutorials and four-hour
hands-on practice per week; hands-on practice shall include practice exercises and graded
exercises. Normally, one-hour tutorial followed by two-hour hands-on practice is recommended in
each class. In Unit-1, tutorials and practice may be carried out concurrently. However, graded
exercise (Unit-II) can also be covered at appropriate point of tutorials of Unit-1. Activities are
carried-out off class.
Course Assessment and Evaluation Scheme
Master Scheme
Assessment
Assessment To mode Max. Evidence Course
What
Method Whom /Frequency Marks Collected Outcomes
/timing
Two tests+ 10 Blue Books 1 to 4
@
CIE IA Record 10 Record Book 1 to 4
*
Activity 05 Report/Sheets 1 to 4
End of the Answer Scripts
End 50 1 to 4
SEE course at BTE
exam
Total 75
Student 1 to 4 &
Middle of Feedback
feedback on Nil Delivery of
the Course Forms
course course
1 to 4,
Effectiveness of
End of
End of the delivery
course Nil Questionnaires
Course instructions &
survey
assessment
methods
Legends: CIE-Continuous Internal Evaluation, SEE- Semester End-exam Evaluation

1. I.A. test shall be conducted as per SEE scheme of valuation. However obtained marks shall be reduced to 10
marks. Average marks of two tests shall be rounded off to the next higher digit.
2. Rubrics to be devised appropriately by the concerned faculty to assess Student activities.
*Students should do activity as per the list of suggested activities/ similar activities with prior approval of the teacher.
Activity process must be initiated well in advance so that it can be completed well before the end of the term.
@
Record Writing: Average of marks allotted for each experiment; fractional part of average shall be rounded-off to
next higher integer.

Directorate of Technical Education Karnataka State 15EC37P Page 6


Composition of CLs
Sl. No. Cognitive Levels (CL) Weightage (%)
1 Remembering 20
2 Understanding 30
3 Applying 50
Total 100

Continuous Internal Evaluation (CIE) pattern


(i) Student Activity (5 marks): The student activities in Unit-3 or similar activities can be assigned
by the teacher
Execution Notes:
1. Each batch of 2 students is assigned at least one activity listed in Unit-3 based on interest of the students.
Student can also choose any other similar /relevant activity with prior approval from the concerned teacher.
2. Teacher is expected to observe and record the progress of students’ activities
3. Assessment is made based on quality of work as prescribed by the following rubrics table

(ii) Model of rubrics for assessing student activity (for every student)
Scale
Marks
Dimension 1 2 3 4 5
(Example)
Unsatisfactory Developing Satisfactory Good Exemplary
Collects Collects Collects a
1. Research Does not Collects more
very limited basic great deals of
and collect information,
information, information, information, 3
gathering information most refer to
some relate most refer to all refer to the
information relate to topic the topic
to topic the topic topic
Does not
Performs all
2. Full-fills perform any Performs Performs Performs
duties of
team roles duties assigned very little nearly all almost all 2
assigned team
and duties to the team duties duties duties
roles
role
Usually
Rarely does Always does Always does
does the
3. Shares Always relies the assigned the assigned the assigned
assigned
work on others to do work, often work, rarely work, without 5
work, rarely
equality the work needs needs needing
needs
reminding reminding. reminding
reminding
Usually does
Is always most of the Listens, but Listens and
4. Listen to Listens and
talking, never talking, sometimes talks a little
other team talks a fare 3
allows anyone rarely allows talk too more than
mates amount
to else to speak others to much, needed.
speak
Total marks ceil(13/4)= 4
(iii) CIE/IA Tests (10 Marks)
Two tests shall be conducted in accordance with SEE pattern and the marks shall be scaled down to 10.
Average of two tests, rounding-off any fractional part thereof to next higher integer, shall be
considered for CIE/IA.

Directorate of Technical Education Karnataka State 15EC37P Page 7


(iv) Record Evaluation (10 Marks)
Every experiment shall be given marks, in the scale of 10, after its conduction based on student’s
performance and quality of write-up. Average of them, by rounding-off any fractional part thereof to
next higher integer, shall be considered for CIE/IA.
Semester End-exam Evaluation (SEE) Scheme

Sl. No. Scheme Max. Marks


1 Short questions on Unit-1 (only write-up) 05
2 Writing steps /Algorithm/Procedure (20% weightage) and
program (80% weightage) for two questions from the graded 20
exercises
3 Execution/Implementation of either one of the programs written
15
given in 2
4 Open-ended problem: Writing program and its
05
execution/implementation.
5 Viva-voce 05
TOTAL 50
Note:
1. Candidate is expected to submit record for the examination.
2. Student shall be allowed to execute the program even if she/he is unable to write the
procedure/steps/algorithm.
3. Open-ended problem is of the nature and magnitude similar to graded exercises in
Unit-2, and it can be assigned by the examiner. Further, open-end programs executed
in 11 of Unit-2 shall be excluded. Idea behind open-end program is to assess the
ability of a student to write any program.

Model Questions for Practice and Semester End Examination


Graded Exercises

1. Write a C program that computes resistance of any resistor given its colour codes Red-
Yellow-Blue and tolerance code Gold.
2. Write a C program to generate result-class of a set of students given their individual total
marks
Sl No Reg. No. Name of the student Marks obtained out of 600 Result
1 ABC 456 ?
2 ABD 232 ?
3 XYZ 345 ?
4 MNO 577 ?
5 PXY 365 ?

3. Write a C program to count number of vowels in any given word


4. Write a C program to multiply two matrices
5. Write a C program to add two 3x4 matrices
6. Write a C program to reverse a given word

Directorate of Technical Education Karnataka State 15EC37P Page 8


7. Write a C program to compute sin(x) given x in radians using series method; relevant
library functions can be used
8. Write a C program containing a structure to represent book; create five such books and
compute the sum of the costs of all the books
9. Write a C program to simulate an arithmetic calculator that can perform addition, subtraction,
multiplication and division
10. Write a C program to sort an array of N numbers using a user-defined function

End

Directorate of Technical Education Karnataka State 15EC37P Page 9

You might also like