Page 1
FOR KARNATAKA CLASS 10 PREPARATION
Karnataka SSLC Model
Question Paper 2027 for
Programming In ANSI C
(Paper 2) Key Answers
EXAM YEAR TYPE
Karnataka Class 10 2027 Answer Key
Notes · Sample Papers · Previous Year Papers · Mock Tests
Page 2
m
m c. o
em l a s
s a g
ಕನಾ೯ಟಕ ಶಾಲಾ ಪರೀಕ್ಷ ೀ ಮತ್ತು ಮೌಲ್ಯ ನಿಣ೯ಯ ಮಂಡಲಿ
6ನೀ ಅಡಡ ರಸ್ತು , ಮಲ್ಲ ೀಶ್ವ ರಂ, ಬಂಗಳೂರು – 560 003
KARNATAKA SCHOOL EXAMINATION AND ASSESSMENT BOARD
6th Cross, Malleshwaram, Bengaluru – 560 003
2026 – 27 ರ ಪರ ಶ್ನೆ ಪತ್ರರ ಕ್ – 2 ರ ಮಾದರ ಉತ್ು ರಗಳು
m
co
m
2026 – 27 MODEL ANSWER FOR PAPER - 2
m.co
m . s e
s e l a
l a ag
ವಿಷಯ :ಪ್ರ ೀಗ್ರರ ಮಂಗ್ಇನ್ಎ ಎನ್ಎಸ್ಐ “ಸಿ”
ag Subject : PROGRAMMING IN ANSI C
ವಿಷಯ ಸಂಕ್ೀತ್ : 54 ಗರೀಷಠ ಅಂಕಗಳು : 80
SUBJECT CODE NO. : 54 MAXIMUM MARKS Marks: 80
Qn. Value Points Total
m
Nos.
. co
em
I Four alternatives are given for each of the following questions
s
/ incomplete statements. Select the most appropriate
l a
alternative and write it in the answer book along with its
g
a
alphabet.
1 Which of the following is used to represent a single character in 1
C?
(A) String (B) Character
(C) Integer (D) Float
m
Ans: (B) Character
m
c. o m
2 Which symbol is used to begin a single-line comment in C? 1
s e
em l a
(A) /* (B) //
las (C) ## (D) –
ag
ag
Ans: (B) //
3 Which of the following is a valid identifier in C? 1
(A) 2number (B) total-mark
(C) total_marks (D) float
m .
co
Ans: (C) total_marks
. e m
e m l a s
l a s a g
ag For more Question Papers, Sample Papers, Notes & Syllabus visit Page 1 of 7
Page 3
4 Which format specifier is used to read an integer value? 1
(A) %c (B) %f
(C) %d (D) %s
Ans: (C) %d
5 Which operator is used to find the remainder after division? 1
(A) / (B) %
(C) // (D) :
Ans: (B) %
6 Which function is used to display output on the screen? 1
(A) scanf() (B) getchar()
(C) printf() (D) putchar()
Ans: (C) printf()
7 Which statement is used to terminate a loop immediately? 1
(A) continue (B) break
(C) exit (D) stop
Ans: (B) break
8 Which escape sequence is used to move the cursor to the next 1
line?
(A) \t (B) \b
(C) \n (D) \r
Ans: (C) \n
9 Which of the following is a relational operator? 1
(A) + (B) &&
(C) >= (D) =
Ans: (C) >=
10 Which operator represents logical OR in C? 1
(A) | (B) ||
(C) && (D) !
Ans: (B) ||
For more Question Papers, Sample Papers, Notes & Syllabus visit Page 2 of 7
Page 4
m
m c. o
em l a s
s ag
II Answer all the questions.
11
A) Mention any two features of C language. 2
m
.co
1. Simple and efficient: C has a simple syntax and provides efficient
m
co
execution.
.
2. Portable: C programs can be transferred and compiled on different
e m
m
e
computer systems with little modification.
3 l a s
B)
l a s
Explain the different types of C variables.
ag
g
a 1. Local variable – Declared inside a function or block and accessible
only within that block.
2. Global variable – Declared outside all functions and can be
accessed by multiple functions.
3. Static variable – Retains its value throughout the execution of the
program.
om
C) Explain the basic structure of a C program with a suitable example 5
. c
em
a s
The basic structure consists of documentation/comments,
l
g
preprocessor directives, global declarations, the main() function,
a
variable declarations, executable statements, and user-defined
functions if required.
Example:
{
int a, b, sum;
a = 10;
m
b = 20;
m
sum = a + b;
s
printf("Sum = %d", sum);
s em l a
la ag
}
ag
m .
.co s e m
e m l a
l a s a g
ag For more Question Papers, Sample Papers, Notes & Syllabus visit Page 3 of 7
Page 5
12
A) Define a variable. 2
Ans: A variable is a named memory location used to store a value
that can be changed during the execution of a program.
B) Explain the rules for naming identifiers in C. 3
1. An identifier can contain letters, digits and underscore (_).
2. It must not begin with a digit.
3. Keywords cannot be used as identifiers.
4. Spaces and special symbols are not allowed.
5. C identifiers are case-sensitive.
C) Explain the different types of constants used in C language with 5
examples
1. Integer constants – Whole numbers, e.g. 10, 25, -50.
2. Floating-point constants – Decimal values, e.g. 3.14, 25.5.
3. Character constants – A single character in single quotes, e.g. 'A',
'5'.
4. String constants – A sequence of characters in double quotes, e.g.
"Hello".
5. Symbolic constants – Defined using #define, e.g. #define PI 3.14.
13
A) Define C tokens. 2
C tokens are the smallest individual units of a C program that are
meaningful to the compiler.
Examples include keywords, identifiers, constants, strings, operators
and special symbols.
B) Explain any three types of operators in C. 3
1. Arithmetic operators – Used for mathematical calculations:
+, -, *, /,
%.
2. Relational operators – Used to compare values:
<, >, <=, >=, ==, !=
3. Logical operators – Used to combine conditions: &&, ||, !.
For more Question Papers, Sample Papers, Notes & Syllabus visit Page 4 of 7
Page 6
m
m c. o
em l a s
s ag
C) Explain the basic data types in C language with their uses. 5
char – Stores a character; example: char grade = 'A';
int – Stores integer values; example: int age = 20;
float – Stores decimal values; example: float price = 25.5;
double – Stores double-precision decimal values; example: double d
m
.co
= 123.456;
m
co
void – Represents no value; example: void display();
. m
m se
14
e 2 la
A)
l a s
Explain the if-else statement.
ag
g
a The if-else statement is a decision-making statement used to
execute one block when a condition is true and another block when
the condition is false.
Syntax:
if(condition)
{
m
co
statements;
}
.
s em
else
{
g l a
a
statements;
}
B) Write a C program to find the largest of two numbers. 8
{
m
int a, b;
m c. o
c. o e m
printf("Enter two numbers: ");
em
scanf("%d%d", &a, &b);
l a s
las ag
g
if(a > b)
a printf("%d is the largest", a);
else if(b > a)
printf("%d is the largest", b);
else
printf("Both numbers are equal");
}
m .
.co s e m
e m l a
l a s ag
ag For more Question Papers, Sample Papers, Notes & Syllabus visit Page 5 of 7
Page 7
15
A) Explain the use of scanf() function. 2
The scanf() function is used to read input from the keyboard and store
the entered value in variables.
Example:
int age;
scanf("%d", &age);
B) Write a C program to calculate the area and perimeter of a rectangle. 8
{
float length, breadth, area, perimeter;
printf("Enter length and breadth: ");
scanf("%f%f", &length, &breadth);
area = length * breadth;
perimeter = 2 * (length + breadth);
printf("Area = %.2f\n", area);
printf("Perimeter = %.2f", perimeter);
}
Formula:
Area = Length × Breadth
Perimeter = 2 × (Length + Breadth)
16
A) Explain the while loop. 2
The while loop repeatedly executes a block of statements as long as
the given condition is true.
Syntax:
while(condition)
{
statements;
}
For more Question Papers, Sample Papers, Notes & Syllabus visit Page 6 of 7
Page 8
m
m c. o
em l a s
s ag
B) Write a C program to check whether the given number is positive, 8
negative or zero.
{
m
.co
int n;
m
.co
printf("Enter a number: ");
s e m
e m
scanf("%d", &n);
l a
l a sif(n > 0)
ag
ag
printf("The number is positive");
else if(n < 0)
printf("The number is negative");
else
printf("The number is zero");
}
17
c om
A) What are arithmetic operators? Mention any two arithmetic operators 2
.
s em
l a
Arithmetic operators are used to perform mathematical operations on
values.
a g
Examples: + (addition), - (subtraction), * (multiplication), / (division),
% (modulus).
B) Write a C program to convert temperature in degree Fahrenheit to 8
degree Celsius.
m
m
{
em
float fahrenheit, celsius;
l a s
las printf("Enter temperature in Fahrenheit: ");
ag
ag
scanf("%f", &fahrenheit);
celsius = (fahrenheit - 32) * 5 / 9;
printf("Temperature in Celsius = %.2f", celsius);
}
m .
.co s e m
e m l a
l a s a g
ag For more Question Papers, Sample Papers, Notes & Syllabus visit Page 7 of 7