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

C UNIT I QB

The document outlines an introductory course on C programming, detailing objectives, outcomes, and various programming concepts. It includes questions and answers on programming paradigms, computer operations, algorithms, data types, constants, and number systems. Additionally, it provides exercises and examples related to flowcharts, algorithms, and C program structure.

Uploaded by

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

C UNIT I QB

The document outlines an introductory course on C programming, detailing objectives, outcomes, and various programming concepts. It includes questions and answers on programming paradigms, computer operations, algorithms, data types, constants, and number systems. Additionally, it provides exercises and examples related to flowcharts, algorithms, and C program structure.

Uploaded by

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

Page|1

UNIT I

INTRODUCTION

Course Objective – C Ob 1: To understand the concepts of C Language.

Course Outcome – CO1: Develop efficient algorithms for solving a problem.

Bloom’s Taxonomy Level - K1, K2, K3.


PART A

S.No. Question BTL


1. Define programming paradigm. How is it classified? K1
Programming paradigm is a style or way of programming. Programming
paradigm is an approach to solve problem using some programming
language or also we can say it is a method to solve a problem using tools
and techniques that are available to us following some approach.
Classification of programming paradigms:

2. Differentiate imperative and declarative programming paradigms. K2


S.No. Imperative Declarative Programming
Programming
1. In this, programs specify In this, programs specify what
how it is to be done. is to be done.
2. It simply describes the It simply expresses the logic of
control flow of computation.
computation.
3. Its main goal is to Its main goal is to describe the
describe how to get it or desired result without direct
accomplish it. dictation on how to get it.
4. It is classified into It is classified into logic
procedural programming, programming and functional
object-oriented programming and database
programming and processing approach.
Page|2

parallel processing
approach.

5. It gives full control to It may automate repetitive flow


developers that are very along with simplifying code
important in low-level structure.
programming.
3. Define computer and list out the basic operations of a computer. K2
A computer is an electronic
device that can perform
various functions by taking
input from the user,
performing various
processes on it with a set of
defined instructions that
produce an output.
The computer consists of
the following basic units:
 Input unit
 Central Processing
Unit (CPU)
 Output unit
 Memory unit
4. Distinguish between Hardware and Software. K2
S.No. Hardware Software
1. Hardware is the physical aspect o A set of instructions that
computer, telecommunications enables physical
and other devices. components of a computer to
work in a synchronized way.
2. Types: Types:
1.Internal hardware 1.System Software
2.Input Hardware 2.Programming Software
3.Output Hardware 3.Application Software
4.Connecting Hardware 4.Utility Software
5.Storage Hardware
3. Examples: Processor, Memory Examples: Ms Word, Excel,
Devices, Monitor, Printer, PowerPoint, Google
Keyboard, Mouse, and the Chrome, Photoshop,
Central Processing Unit. MySQL, etc.
5. Differentiate the characteristics of primary and secondary storage of a K2
computer system.
● Primary storage is storage that a computer CPU has direct access to,
suchas RAM, ROM, or cache memory. It is very fast, to minimize the
amount of time the CPU has to wait to retrieve information.
● Secondary storage is generally larger, slower, less expensive per
gigabyte,and not directly accessible by the CPU. A hard drive or SSD
fits into this category, as do things like magnetic tape, USB sticks,
DVD or CDs, etc.
Page|3

6. What is an algorithm? List the characteristics of algorithms. K1


An algorithm is a step-by-step procedure used for solving a problem or
performing a computation. Algorithms act as an exact list of instructions
that conduct specified actions step by step in either hardware- or software-
based routines.
Characteristics of algorithms:
 Well-defined inputs and outputs
 Finiteness
 Definiteness
 Effectiveness
 Unambiguity
 Language independence
7. Write an algorithm to find the factorial of a number. K3
Step 1: Start the program.
Step 2: Read an integer ‘n’ to find the factorial.
Step 3: Initialize f as 1 and j as 1.
Step 4: If j <= n, go to Step 5; otherwise go to Step 6.
Step 5: Calculate f = f x j. Increase j by 1. Go to Step 4.
Step 6: Display the value of ‘f’.
Step 7: Stop the program.
8. What is a flowchart? Give few flowchart symbols and their purpose. K2
 A Flowchart is a diagrammatic representation of sequence of logical
steps of a program.
 It shows steps in sequential order and is widely used in presenting the
flow of algorithms, workflow or processes
Symbol Symbol Purpose
Name

Used at the beginning and end of the


Start/Stop algorithm to show start and end of the
program.

Indicates processes like mathematical


Process operations.

Input/ Used for denoting program inputs and


Output outputs.

Stands for decision statements in a


Decision program, where answer is usually Yes
or No.

Shows relationships between different


Arrow shapes.
Page|4

Connects two or more parts of a


On-page
flowchart, which are on the same
Connector
page.

Off-page Connects two parts of a flowchart


Connector which are spread over different pages.

9. Draw a flowchart to find the greater of 2 numbers. K3

10. Write the structure of C program. K1

11. How is #define pre-processor useful? K2


The #define preprocessor directive is used to define a Global constant and
macros.
Eg. #define PI 3.14
#define big(a,b) a>b?a:b
When it reads the constant label, it replaces the label by its value. When a
compiler reads the macro name, it replaces the macro name by its
expansion.
12. List down few applications of C Language. K2
C programming can be used to do a variety of tasks such as:
 Network device
 Operating systems
Page|5

 Language compilers and interpreters


 Designing GUI applications
 Text editors
 Modern programming languages
 Design databases
 Utility software
13. What is a data type? What are variables? K1
A data type is the type of data a variable can hold. For example, a Boolean
variable can have boolean data, and an integer variable can hold integer
data. It is an attribute that tells a computer how to interpret the value.
Variables are just storage locations reserved for storing values.
14. List different datatypes available in C. K1
Data types are used to specify the type of a variable. In c, the data types
are classified into 3 category. They are,
Primary or Built-in : int , char, float, double, void
Derived : function, array, pointer
User defined : structure, union, enum, typedef
15. What is a constant? How are constants declared in C language? K2
A constant is a value or variable that can't be changed or altered in the
program. Examples: 10, 20000, 'a', ’5’ 3.4, "c programming”.
In C language, a constant can be declared and initialised as below:
const int age = 5; const char initial = ‘S’;
16. What is enum in C? K2
An enumeration type or enum is a user defined data type. It is a special
data type that enables for a variable to be a set of predefined constants.
The constants are initialised by default as 0, 1, 2, …If needed, they can
also be initialised by the user.
Eg. 1 enum weekdays {Mon, Tue, Wed, Thu, Fri};
Eg. 2 enum suit { club = 0, diamonds = 10, hearts = 20, spades = 3 };
17. What are keywords? Give few examples. K1
 Keywords are reserved words, they have standard and predefined
meaning.
 Keywords cannot be used as normal identifiers.
 Examples: auto, break, char, continue, else, if, switch, struct, union.
18. What is number system? What are the types of number system? K1
It is a systematic way to represent numbers in different ways. Each number
system has its own base, which represents the number of symbols or digits
used in that number system. The different number systems available are:
 Decimal number system (Base - 10)
 Binary number system (Base - 2)
 Octal number system (Base -8)
 Hexadecimal number system (Base - 16)
19. Give the steps to convert a decimal number into a binary number. K1
1. Divide the decimal number by 2 and store remainders in array.
Page|6

2. Divide the quotient by 2.


3. Repeat step 2 until we get the quotient equal to zero.
4. Equivalent binary number would be reverse of all remainders of step 1.
20. Convert (16512)8 into a decimal number. K3

(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.
K3
b) Write a C Programming using Simple I/O Statements, operators and
expressions

a) Summarize on the concepts of flowchart. (8 Marks) K2


4.
b) Draw a flowchart to find the Maximum and Minimum (8 Marks) K3
Numbers.
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 an algorithm to find sum of 10 numbers. (8 Marks) K3

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

You might also like