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

Programming using C Language Jan-May 2025....

The document outlines a lecture on C programming, focusing on key objectives such as data types, control structures, functions, arrays, and strings. It includes sample questions and hands-on practice exercises aimed at reinforcing understanding of these concepts. Additionally, it emphasizes the importance of conditional statements and provides motivational quotes related to overcoming challenges.

Uploaded by

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

Programming using C Language Jan-May 2025....

The document outlines a lecture on C programming, focusing on key objectives such as data types, control structures, functions, arrays, and strings. It includes sample questions and hands-on practice exercises aimed at reinforcing understanding of these concepts. Additionally, it emphasizes the importance of conditional statements and provides motivational quotes related to overcoming challenges.

Uploaded by

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

LECTURE FOUR

PROGRAMMING
IN
C LANGUAGE
03/05/2025 By Watson
Topic Objectives
1. To write programs using
data types, variables and
operators
2. To develop solutions
with control structures and
functions
3. To apply arrays and
strings to solutions in C
programming language.
Mar 5, 2025 By Watson 2
C Programming Basic Essentials
Lecture Sample Questions (30TH JAN 2025)
1. Define the following terms with applicable examples;
a variable, a data type, statement, constant, an
identifier, program keywords, comment and a
header file
2. Mention the rules followed when naming variables?
3.Briefly explain the 2 types of variable and variable
declarations in C programming
4. Why is the main () function special?
5.How do different data types affect memory allocation
in C?
6.Briefly explain any FIVE (5) primary data types and any
FOUR (4) secondary data types
7.Various programming languages C included support a
number of operators. Describe these operators; give
examples, and how they are applied.
8.Explain the 3 types of programming errors and
C Programming Basic Essentials
(Ctnd)
Hands-on and Practice Questions (30TH JAN
2025)
1. Learn how to define and declare variables.
A. declare a variable for storing your initials
B. declare a variable for storing your registration
number
C. Declare and initialize the constant for PI
2. What are the different types of operators in C,
and show how do they interact with data types
3. Write simple programs that help you learn how
to use variables, assign values to variables, use
operators and output results.
4.Describe THREE ways of defining constants.
Using C, write a program to illustrate how constants
are declared with the use of the THREE (3)
methods.
Control Structures
Lecture Sample Questions (6TH FEB 2025)
1.Show the general form for; (a) if statement, (b)
if/else statement (c) switch statement (d)
while statement (e) do/while statement (f) a
for statement
2. What are the key differences between the while
loop, do-while loop and for loop in C?
3. When is the condition tested in each of the
loops? Which of the loops is always executed
once?
4. What are different parts of a for construct and
what is the behavior of a for loop where these
parts are not provided
5. What happens if you create a loop that never
ends?
6.Write a program in C that captures the first 100
Functions
Lecture Sample Questions (13TH FEB 2025)
1. Write the syntax of a function in C?
2.What is the significance of main() function in C
programming
3. Explain the basic components of a C function?
4. Give a clear description between a function
definition and function prototype applicable
examples?
5. Briefly explain the following with relevant
examples
i) Local & Global variables (ii) Parameters (iii)
Private variables (iv) Function call (vi)
Function Overloading
6. What are recursive functions, and how are they
used in C?
7. State any 4 advantages and 4 disadvantages of
C-Functions
Hands-on and Practice Questions (13TH FEB
2025)
1. How do I initialize more than one variable in a
for loop
2. Write a loop logic of your own using both
do…while and while loop constructs.
3. Write a C program that captures the multiples
of 42 between 0 and 1000
4. What is the function prototype of main () in a
program
Hands-on and Practice Questions
(Functions)
1. What is a function definition? What is its
significance in a program?
2. What are the merits & demerits of using
“The powers of ‘IF’
Command-The if clause is
known as a CONDITIONAL
SENTENCE.
This means the event in the
main clause only takes
place when the condition in
the clause containing ‘if’ is
fulfilled”
Mar 5, 2025 By Watson 8
clauses-
1. I will start a business
(main clause) if I get
money (conditional
clause)
. 2. If I finish school, I will
live a better life.
3. If I get money,
everything will be fine.
4. I will marry you
officially, if the bride price
03/05/2025 By Watson
“New Approach of rephrasing
the if statements”-
1. I have to begin a business
with or without money by
October 2024.
. 2. I don’t need to finish
school to live a better life; I
am going to live a better life
now.
3. What things can I do to get
the money I need to sort out
my needs?
4. I am going to marry you no
03/05/2025 By Watson
“Stay away from
NEGATIVE
PEOPLE, They
have a problem
for every solution”
Mar 5, 2025 By Watson 11
C-ARRAYS
Strings and Arrays
Lecture Sample Questions (20TH FEBURARY
2025)
1. Define a string with example? Why do we need
strings in C programming?
2. Name the two ways using or declaring strings?
3. Describe the purpose of the following library
functions for string handling. (i) strcat (ii) strcpy
(iii) strlen (iv) strcomp
4. Explain what is meant by an array? Write the
syntax declaration of a an array?
5. Discuss the Three ways of declaring arrays with
applicable examples?
6. How do we determine the size of an array? What
are the principles of accessing array indices
7. What are
7. Briefly explain the THREE (3) types of arrays by
By Watson-KIU-Faculty of Science & Technology
03/05/2025 14
By Watson-KIU-Faculty of Science & Technology
03/05/2025 15
By Watson-KIU-Faculty of Science & Technology
03/05/2025 16
By Watson-KIU-Faculty of Science & Technology
03/05/2025 17
By Watson-KIU-Faculty of Science & Technology
03/05/2025 18
By Watson-KIU-Faculty of Science & Technology
03/05/2025 19
Strings and Arrays
Take home Sample Questions (20TH FEBURARY
2025)
1. What effect do tabs, spaces and new
lines have on the program
2. What is the action performed by
strcpy()?
3. What happens if you write to element
44 in a 43 member array?
4. Describe the different types of errors in
arrays with relevant examples?
5. What are limitations of using a pointer?
“Difficulties in life
don’t come to
DESTROY
you but to help you
realize your hidden
POTENTIAL and
power”
03/05/2025 By Watson
“When a leader does not
address the PROBLEM.
The problem becomes
the leader and the
LEADER becomes the
PROBLEM”

03/05/2025 By Watson
ASANTE

You might also like