0% found this document useful (0 votes)
16 views7 pages

Internal Assessment Test Answer Key

The document consists of an internal assessment test covering various programming concepts, including algorithms, pseudo code, and the compilation process in C. It includes questions about problem analysis, identifiers, looping statements, and operators, along with C programming exercises for tasks such as checking voting eligibility, generating multiplication tables, and converting decimal numbers. Additionally, it provides example C programs for calculating sums, converting number systems, and identifying Armstrong numbers.
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)
16 views7 pages

Internal Assessment Test Answer Key

The document consists of an internal assessment test covering various programming concepts, including algorithms, pseudo code, and the compilation process in C. It includes questions about problem analysis, identifiers, looping statements, and operators, along with C programming exercises for tasks such as checking voting eligibility, generating multiplication tables, and converting decimal numbers. Additionally, it provides example C programs for calculating sums, converting number systems, and identifying Armstrong numbers.
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/ 7

INTERNAL ASSESSMENT TEST -I

A
1.Distinguish between an algorithm and a flowchart.

2. List the various keywords used to write pseudo code


 BEGIN / END → to mark the start and end of the pseudocode.
 INPUT / OUTPUT (or READ / PRINT / DISPLAY) → for input and output operations.
 IF … THEN … ELSE … ENDIF → for conditional branching.
 ELSEIF → for multiple conditions.
 CASE … OF … ENDCASE → for switch-case style selection.
3.Discuss the compilation process in C.
4.What is operator? And list out the types of operators.
An operator is a symbol that tells the computer to perform a specific
mathematical, logical, or relational operation on data (operands).

5. Write a program to determine whether a person is eligible to vote.


#include <stdio.h>
int main() {
int age;
// Input age
printf("Enter your age: ");
scanf("%d", &age);
// Check eligibility
if (age >= 18) {
printf("You are eligible to vote.\n");
} else {
printf("You are NOT eligible to vote.\n");
}
return 0;
}

6. b) Develop algorithm, Flowchart and pseudo code to check whether a number


is odd or even.
ALGORITHM
Step 1: Start
Step 2: Input a number (N)
Step 3: Find remainder when N is divided by 2 → N % 2
Step 4: If remainder = 0, then number is Even
Step 5: Otherwise, number is Odd
Step 6: Display result
Step 7: Stop
FLOWCHART

PSEUDOCODE
BEGIN
INPUT number
IF number % 2 = 0 THEN
PRINT "Number is Even"
ELSE
PRINT "Number is Odd"
ENDIF
END
9.Write a C program using nested loops to display a multiplication table
#include <stdio.h>
int main() {
int i, j;
// Outer loop for rows
for (i = 1; i <= 10; i++) {
// Inner loop for columns
for (j = 1; j <= 10; j++) {
printf("%4d", i * j); // Print product in table format
}
printf("\n"); // Move to next line after each row
}

return 0;
}
INTERNAL ASSESSMENT TEST -I
B
1.What you mean by Problem Analysis Chart
A Problem Analysis Chart is a systematic diagram or table used in the
problem-solving process to understand a problem clearly before writing an
algorithm or program.
It helps in analyzing:
 What input is required (data given to the problem)
 What processing is needed (steps/calculations to solve it)
 What output is expected (the result to be produced)

2.Define: Problem Solving


Problem Solving is the systematic process of understanding a problem, analyzing
it, and finding an effective solution using logical steps, reasoning, and decision-
making.
In computing/programming, problem solving means:
 Identifying the problem or requirement
 Breaking it into smaller, manageable parts
 Designing a step-by-step algorithm or method
 Implementing the solution using a programming language
 Testing and verifying the correctness of the solution
3. List out Rules for identifiers.
 Identifier can contain following characters:
o Uppercase (A-Z) and lowercase (a-z) alphabets.
o Numeric digits (0-9).
o Underscore (_).
 The first character of an identifier must be a letter or an underscore.
 Identifiers are case-sensitive.
 Identifiers cannot be keywords in C (such as int, return, if, while etc.).
4.Differentiate while and do…while looping statements.

5. Invent the difference between ++a and a++.

Operator Type Action Example Result

++a Pre-increment Increment before using the value b = ++a; a=6, b=6

a++ Post-increment Use the value first, then increment b = a++; a=6, b=5

6.b) Illustrate about the various data types in ‘C’ and write a C program to find
the sum of 10 non-negative numbers entered by the user.
#include <stdio.h>
int main() {
int i, num;
int sum = 0;
printf("enter 10 non-negative numbers:\n");
for(i = 1; i <= 10; i++) {
scanf("%d", &num);
if(num < 0) {
printf("invalid input! please enter a non-negative number.\n");
i--; // repeat the iteration
continue;
}
sum += num;
}
printf("the sum of the 10 non-negative numbers is: %d\n", sum);
return 0;
}

OUTPUT
Enter 10 non-negative numbers:
5 10 15 20 25 30 35 40 45 50
The sum of the 10 non-negative numbers is: 275

7 b) Design a C program to convert the given decimal number into binary,


octal and hexadecimal numbers.

#include <stdio.h>
int main() {
int decimal, num, remainder;
int binary[32], i = 0;
// Input decimal number
printf("Enter a decimal number: ");
scanf("%d", &decimal);
// ------- Binary Conversion -------
num = decimal;
if (num == 0) {
printf("Binary: 0\n");
} else {
while (num > 0) {
binary[i] = num % 2; // Store remainder
num = num / 2;
i++;
}
printf("Binary: ");
for (int j = i - 1; j >= 0; j--) {
printf("%d", binary[j]);
}
printf("\n");
}
// ------- Octal Conversion -------
printf("Octal: %o\n", decimal); // %o format specifier
// ------- Hexadecimal Conversion -------
printf("Hexadecimal: %X\n", decimal); // %X format specifier
return 0;
}

OUTPUT
Enter a decimal number: 25
Binary: 11001
Octal: 31
Hexadecimal: 19
8. Write a C program to generate Armstrong number between 100 and 999.
#include <stdio.h>
#include <math.h>
int main() {
int num, digit1, digit2, digit3;
int sum;
printf("Armstrong numbers between 100 and 999 are:\n");
for (num = 100; num <= 999; num++) {
digit1 = num / 100; // hundreds place
digit2 = (num / 10) % 10; // tens place
digit3 = num % 10; // units place
sum = pow(digit1, 3) + pow(digit2, 3) + pow(digit3, 3);
if (sum == num) {
printf("%d\n", num);
}
}
return 0;
}

OUTPUT
Armstrong numbers between 100 and 999 are:
153
370
371
407

You might also like