0% found this document useful (0 votes)
11 views19 pages

BPOPS103_CIE1(set2)_Scheme

The document outlines the CIE-1 examination details for the Principles of Programming course at Sri Krishna Institute of Technology, including questions on computer definitions, programming concepts, and C language functions. It includes two sets of questions, each with specific topics and marks distribution, covering computer generations, variable rules, algorithms, and advantages of functions. The document also contains certification by faculty and HOD, confirming syllabus completion and question alignment with course outcomes.
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)
11 views19 pages

BPOPS103_CIE1(set2)_Scheme

The document outlines the CIE-1 examination details for the Principles of Programming course at Sri Krishna Institute of Technology, including questions on computer definitions, programming concepts, and C language functions. It includes two sets of questions, each with specific topics and marks distribution, covering computer generations, variable rules, algorithms, and advantages of functions. The document also contains certification by faculty and HOD, confirming syllabus completion and question alignment with course outcomes.
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/ 19

SRI KRISHNA INSTITUTE OF TECHNOLOGY

(Accredited by NAAC, Approved by A.I.C.T.E. New Delhi, Recognised by Govt. of Karnataka & Affiliated to V.T U., Belagavi)
#57, Chimney Hills, Hesaraghatta Main Road, Chikkabanavara Post, Bengaluru- 560090

CIE –1 (Set-1)

Dept: BS Sem / Div: E, F, G Course: Principles of Prog Elective:


Date: 26/11/2024 Time: 9:30 To 11 AM C Code: BPOPS103 Max Marks: 50
Note: Answer two full questions. All questions carry 25 marks.
QNo Questions CO Level Marks Module
1 a Define computer. Discuss the characteristics of the computer in detail. CO1 L1 7m 1
b Differentiate between pseudocode and algorithm with example. CO1 L2 7m 1
c Explain the basic structure of the C program with an example. CO1 L1 6m 1
d Define Function. Explain types of functions. CO3 L2 5m 3
OR
2 a Explain the block diagram of the computer. CO1 L1 7m 1
b List out the input and output devices and explain any 2 CO1 L1 7m 1
c Explain various rules for forming identifier names. Give examples of valid CO1 L2 6m 1
and invalid identifiers.
d Give advantages and disadvantages of using functions CO3 L2 5m 3

3 a What is an operator? List different types of operators with examples. CO2 L1 7m 2


b Develop a simple calculator program in C language to do simple operations CO2 L1 7m 2
like addition, subtraction, multiplication, and division. Use the switch
statement in your program and write the necessary comments.
c Define iterative statements. Differentiate between the while loop and do- CO2 L3 6m 2
while loop,
d Write a C program to add two numbers using functions. CO3 L3 5m 3
OR
4 a Explain bitwise operators in C language with examples. CO2 L1 7m 2
b Develop a C program to find quadratic equations by accepting the co- CO2 L2 7m 2
efficient. Print them with appropriate messages.
c Explain for loop and while with syntax, and write a C program to print even CO2 L3 6m 2
numbers between 1 to 10 using for loop and while loop, (Note: write 2
programs one using while loop and another one using for loop)
d Write a C program to find whether the given number is odd or even using CO3 L3 5m 3
functions.

Certificate
I hereby certify that I have completed the specified syllabus for the CIE exam. I have referred to the
specified Text and reference books and additional books and notes. Questions are set to cover the Course
Outcomes and Bloom learning levels specified for the CIE.

Faculty HOD
Name: Sharath Babu & Mr. Vamsi Dr. Shankar
Signature:

Prepared by Checked by Approved


SRI KRISHNA INSTITUTE OF TECHNOLOGY
(Accredited by NAAC, Approved by A.I.C.T.E. New Delhi, Recognised by Govt. of Karnataka & Affiliated to V.T U., Belagavi)
#57, Chimney Hills, Hesaraghatta Main Road, Chikkabanavara Post, Bengaluru- 560090

CIE –1 (Set=2)

Dept: BS Sem / Div: E, F, G Course: Principles of Prog Elective:


Date: 26/11/2024 Time: 9:30 To 11 AM C Code: BPOPS103 Max Marks: 50
Note: Answer two full questions. All questions carry 25 marks.
QNo Questions CO Level Marks Module
1 a What is a computer? and explain the generations of Computer CO1 1

OR A computer is an electronic device that mainly performs four functions:


reading, processing, displaying, and storing data. These functions of a
computer system can be carried out using three main units input unit,
system unit, and output unit.

Prepared by Checked by Approved


SRI KRISHNA INSTITUTE OF TECHNOLOGY
(Accredited by NAAC, Approved by A.I.C.T.E. New Delhi, Recognised by Govt. of Karnataka & Affiliated to V.T U., Belagavi)
#57, Chimney Hills, Hesaraghatta Main Road, Chikkabanavara Post, Bengaluru- 560090

First Generation (1940-1956): Vacuum Tubes


• Technology Used: Vacuum tubes for circuitry and magnetic drums
for memory.
• Characteristics:
• Large size and very expensive.
• Consumed a lot of electricity and generated immense
heat.
• Slow and limited to basic operations.
• Examples: ENIAC, UNIVAC, and EDVAC.

Second Generation (1956-1963): Transistors


• Technology Used: Transistors replaced vacuum tubes.
• Characteristics:
• Smaller, faster, more reliable, and energy-efficient compared
to first generation computers.
• Supported assembly language and some high-level
programming languages (e.g., FORTRAN, COBOL).
• Examples: IBM 1401, UNIVAC II.

Third Generation (1964-1971): Integrated Circuits (ICs)


• Technology Used: Integrated circuits, which combine multiple
transistors on a single chip.
• Characteristics:
• Further size reduction and improved speed and efficiency.
• Supported more advanced operating systems and
multiprogramming.
• Introduction of keyboards and monitors as I/O devices.
• Examples: IBM 360, PDP-8

Fourth Generation (1971-Present): Microprocessors


• Technology Used: Microprocessors, where the CPU is a single
integrated circuit.
• Characteristics:
• Compact and highly efficient.
• Enabled the development of personal computers (PCs).
• Supported graphical user interfaces (GUIs), networking,
and advanced programming languages.
• Examples: IBM PC, Apple Macintosh

Fifth Generation (Present and Beyond): Artificial Intelligence (AI)


• Technology Used: AI, machine learning, parallel processing, and
quantum computing.
• Characteristics:
• Focus on natural language processing, robotics, and
advanced problem-solving capabilities.
• Introduction of neural networks and expert systems.
• Emphasis on portability and interconnectivity.
• Examples: AI-powered devices, supercomputers like IBM Watson,
and emerging quantum computers

Prepared by Checked by Approved


SRI KRISHNA INSTITUTE OF TECHNOLOGY
(Accredited by NAAC, Approved by A.I.C.T.E. New Delhi, Recognised by Govt. of Karnataka & Affiliated to V.T U., Belagavi)
#57, Chimney Hills, Hesaraghatta Main Road, Chikkabanavara Post, Bengaluru- 560090

b What is a variable? What are the rules for constructing variables? Classify CO1 1
the following as valid/invalid Identifiers.
• num2
• $numl
• +add
• a2
• 199_space

Prepared by Checked by Approved


SRI KRISHNA INSTITUTE OF TECHNOLOGY
(Accredited by NAAC, Approved by A.I.C.T.E. New Delhi, Recognised by Govt. of Karnataka & Affiliated to V.T U., Belagavi)
#57, Chimney Hills, Hesaraghatta Main Road, Chikkabanavara Post, Bengaluru- 560090

• num2 - Valid
• $numl - Invalid
• +add - Invalid
• a2 - Valid
• 199_space - Invalid

c Write the flowchart and algorithm for the simple calculator. CO1 1

Algorithm:

Step 1: Start
Step 2: [Enter an operator]
Read operator
Step 3: [enter any two operands]
Read num1 and num2
Step 4: [compute the results as per user choice]
case '+':
result = num1 + num2;
goto step 6

case '-':
result = num1 - num2;
goto step 6

case ‘*':
result = num1 * num2;
goto step 6

case ‘/':
result = num1 / num2;
goto step 6

Step 5: [display a message for invalid operator]

Prepared by Checked by Approved


SRI KRISHNA INSTITUTE OF TECHNOLOGY
(Accredited by NAAC, Approved by A.I.C.T.E. New Delhi, Recognised by Govt. of Karnataka & Affiliated to V.T U., Belagavi)
#57, Chimney Hills, Hesaraghatta Main Road, Chikkabanavara Post, Bengaluru- 560090

Print: You have entered an Invalid Operator

Step 6: [display result]


Print result

Step 7: Stop

FLOW CHART

d Define Function. Differentiate between user-defined functions and library CO3 3


functions

C enables programmers to break large programs into smaller segments. These


smaller segments are known as functions. Functions more or less are independent
of each other. Every function in a ‘C’ program performs a well-defined task.

In short, functions are


• Smaller segments
• Independent of each other
• Performs well-defined task
• There are two types – library functions and user-defined functions

Prepared by Checked by Approved


SRI KRISHNA INSTITUTE OF TECHNOLOGY
(Accredited by NAAC, Approved by A.I.C.T.E. New Delhi, Recognised by Govt. of Karnataka & Affiliated to V.T U., Belagavi)
#57, Chimney Hills, Hesaraghatta Main Road, Chikkabanavara Post, Bengaluru- 560090

Difference between user-defined functions and library functions


Library Functions
1. Predefined functions provided by the programming language or its
libraries.
2. No need to write their logic; they are ready to use.
3. Require including the relevant library (e.g., #include <math.h> for sqrt()).
4. Examples include printf(), scanf(), strlen(), and sqrt().
5. Optimized for performance, reliability, and efficiency.
6. Limited to the functionality provided; cannot be customized.

User-Defined Functions
1. Created by the programmer to handle specific tasks.
2. Require the user to define their logic and structure.
3. No need for external libraries unless specified by the user.
4. Examples include custom functions like int add(int a, int b).
5. Flexibility to implement tailored solutions for program requirements.
6. Efficiency depends on the user's programming skills.

OR
2 a Explain primitive datatypes with a simple C program. CO1 1

Primitive data types are the basic building blocks of any program. They represent
simple types of data and can store values such as numbers, characters, and more.
In C, the primary primitive data types include:
1. Integer (int): Stores whole numbers.
2. Floating Point (float): Stores decimal numbers.
3. Double (double): Stores large floating-point numbers with double
precision.
4. Character (char): Stores single characters.
5. Void (void): Represents no value (used in functions)

#include <stdio.h>
int main()
{
// Primitive Data Types
int age = 20; // Integer
float height = 5.9; // Floating point
double pi = 3.141592653589; // Double
char grade = 'A'; // Character

// Displaying values
printf("Age: %d\n", age); // %d for int
printf("Height: %.1f feet\n", height); // %.1f for float
printf("Value of Pi: %.lf\n", pi); // %.lf for double
printf("Grade: %c\n", grade); // %c for char

return 0;
}

Prepared by Checked by Approved


SRI KRISHNA INSTITUTE OF TECHNOLOGY
(Accredited by NAAC, Approved by A.I.C.T.E. New Delhi, Recognised by Govt. of Karnataka & Affiliated to V.T U., Belagavi)
#57, Chimney Hills, Hesaraghatta Main Road, Chikkabanavara Post, Bengaluru- 560090

b Briefly explain files used in C language. CO1 1

Prepared by Checked by Approved


SRI KRISHNA INSTITUTE OF TECHNOLOGY
(Accredited by NAAC, Approved by A.I.C.T.E. New Delhi, Recognised by Govt. of Karnataka & Affiliated to V.T U., Belagavi)
#57, Chimney Hills, Hesaraghatta Main Road, Chikkabanavara Post, Bengaluru- 560090

c Design an algorithm and program to find the area of a circle CO1 1

Program to find area of the circle


#include<stdio.h>
int main()
{
float r, area;
printf("Enter the radius of the circle: ");
scanf("%f", &r);
area=3.14*r*r;
printf("Area of the circle is %.f", area);
return(0);
}

d Give advantages and disadvantages of using functions CO3 3

Advantages of Using Functions


1. Code Reusability: Functions allow you to reuse the same code in multiple
parts of a program, reducing redundancy.

Prepared by Checked by Approved


SRI KRISHNA INSTITUTE OF TECHNOLOGY
(Accredited by NAAC, Approved by A.I.C.T.E. New Delhi, Recognised by Govt. of Karnataka & Affiliated to V.T U., Belagavi)
#57, Chimney Hills, Hesaraghatta Main Road, Chikkabanavara Post, Bengaluru- 560090

2. Modularity: Programs can be divided into smaller, manageable pieces,


making them easier to develop and understand.

3. Ease of Debugging: Errors can be isolated and fixed in individual functions


without affecting the entire program.

4. Improved Readability: Functions provide a clear structure to the program,


making it easier to read and maintain.

5. Reduced Code Size: By using functions, repetitive code can be avoided,


resulting in a smaller overall codebase.

6. Encapsulation: Functions can hide the implementation details and provide


a clean interface for other parts of the program.

7. Facilitates Collaboration: Different team members can work on different


functions simultaneously in large projects.

Disadvantages of Using Functions

• Overhead: Function calls can introduce a slight overhead due to additional


memory usage and stack operations.

• Complexity in Small Programs: For very simple or small programs, using


functions might complicate the structure unnecessarily.

• Dependency Management: Changes in one function can affect other parts


of the program if dependencies are not handled carefully.

• Memory Usage: Local variables in functions consume stack memory, which


might be an issue in resource-constrained environments.

• Debugging Across Function Calls: Tracing errors that span across multiple
function calls can be challenging.
OR

Advantages Disadvantages
Code Reusability Complexity for smaller programs
Better memory utilization More memory usage
Takes less time to execute Takes more time to execute
Code length is minimized in case Increased size in code length
of calling the same functions
multiple times
Debugging is easy Debugging is bit difficult

Prepared by Checked by Approved


SRI KRISHNA INSTITUTE OF TECHNOLOGY
(Accredited by NAAC, Approved by A.I.C.T.E. New Delhi, Recognised by Govt. of Karnataka & Affiliated to V.T U., Belagavi)
#57, Chimney Hills, Hesaraghatta Main Road, Chikkabanavara Post, Bengaluru- 560090

3 a What are iterative statements? Explain three types of statements and their CO2 2
syntax.

Prepared by Checked by Approved


SRI KRISHNA INSTITUTE OF TECHNOLOGY
(Accredited by NAAC, Approved by A.I.C.T.E. New Delhi, Recognised by Govt. of Karnataka & Affiliated to V.T U., Belagavi)
#57, Chimney Hills, Hesaraghatta Main Road, Chikkabanavara Post, Bengaluru- 560090

Example:

Prepared by Checked by Approved


SRI KRISHNA INSTITUTE OF TECHNOLOGY
(Accredited by NAAC, Approved by A.I.C.T.E. New Delhi, Recognised by Govt. of Karnataka & Affiliated to V.T U., Belagavi)
#57, Chimney Hills, Hesaraghatta Main Road, Chikkabanavara Post, Bengaluru- 560090

Print increasing numbers


for (int j=1; j <= i; j++)
{
printf("%d ", j);
}

b Briefly explain type conversion and type casting with a simple example. CO2 2

Prepared by Checked by Approved


SRI KRISHNA INSTITUTE OF TECHNOLOGY
(Accredited by NAAC, Approved by A.I.C.T.E. New Delhi, Recognised by Govt. of Karnataka & Affiliated to V.T U., Belagavi)
#57, Chimney Hills, Hesaraghatta Main Road, Chikkabanavara Post, Bengaluru- 560090

c Write a program to find the largest of 3 numbers using ternary operators CO2 2

Prepared by Checked by Approved


SRI KRISHNA INSTITUTE OF TECHNOLOGY
(Accredited by NAAC, Approved by A.I.C.T.E. New Delhi, Recognised by Govt. of Karnataka & Affiliated to V.T U., Belagavi)
#57, Chimney Hills, Hesaraghatta Main Road, Chikkabanavara Post, Bengaluru- 560090

CO3 3
d Write a C program to add two numbers using functions.
// Function to add two numbers
int add()
{
int x, y;
printf("Enter two numbers: ");
scanf("%d %d", &x, &y);
return x + y;
}
int main()
{
// Call the add function and store the result
int result = add();
// Print the result
printf("The sum is %d\n", result);
return 0;
}

OR

#include <stdio.h>
// Function to add two numbers
int add(int x, int y)
{
return x + y;
}

Prepared by Checked by Approved


SRI KRISHNA INSTITUTE OF TECHNOLOGY
(Accredited by NAAC, Approved by A.I.C.T.E. New Delhi, Recognised by Govt. of Karnataka & Affiliated to V.T U., Belagavi)
#57, Chimney Hills, Hesaraghatta Main Road, Chikkabanavara Post, Bengaluru- 560090

int main()
{
int a = 5, b = 3;

// Call the add function and store the result


int result = add(a, b);

// Print the result


printf("The sum of %d and %d is %d\n", a, b, result);

return 0;
}

OR
4 a Describe any 4 types of operators with examples. CO2 2

b Explain with syntax, if, and if-else statements in the C program. CO2 2

Prepared by Checked by Approved


SRI KRISHNA INSTITUTE OF TECHNOLOGY
(Accredited by NAAC, Approved by A.I.C.T.E. New Delhi, Recognised by Govt. of Karnataka & Affiliated to V.T U., Belagavi)
#57, Chimney Hills, Hesaraghatta Main Road, Chikkabanavara Post, Bengaluru- 560090

Prepared by Checked by Approved


SRI KRISHNA INSTITUTE OF TECHNOLOGY
(Accredited by NAAC, Approved by A.I.C.T.E. New Delhi, Recognised by Govt. of Karnataka & Affiliated to V.T U., Belagavi)
#57, Chimney Hills, Hesaraghatta Main Road, Chikkabanavara Post, Bengaluru- 560090

c Evaluate the following expression CO2 2


a) 6 * 2 / (2 + 1 * 2 / 3 + 6 ) + 8 * ( 8 / 4)
b) a + b * a / b – a % b ----a=10, b=2
c) 2*((a % 5)*(4 +(b – 3)/(c + 2)))

A:

B:

C:

Prepared by Checked by Approved


SRI KRISHNA INSTITUTE OF TECHNOLOGY
(Accredited by NAAC, Approved by A.I.C.T.E. New Delhi, Recognised by Govt. of Karnataka & Affiliated to V.T U., Belagavi)
#57, Chimney Hills, Hesaraghatta Main Road, Chikkabanavara Post, Bengaluru- 560090

d Write a C program to find whether the given number is odd or even using CO3 3
functions.
#include <stdio.h>
// Function to check whether the number is odd or even
void OddEven()
{
int num;
printf("Enter a number: ");
scanf("%d", &num);
if (num % 2 == 0)
{
printf("%d is Even\n", num);
}
else
{
printf("%d is Odd\n", num);
}
}

int main()
{
// Call the OddEven function
OddEven();
return 0;
}

Prepared by Checked by Approved

You might also like