0% found this document useful (0 votes)
5 views2 pages

Introduction To Computer Science Lab - CSE 112

The document outlines the final exam for the Introduction to Computer Science lab (CSE 112), consisting of five problems to be solved in 75 minutes for a total of 24 marks. Each problem requires students to perform tasks such as categorizing numbers, identifying vowels or consonants, checking for palindromes, finding the largest of two numbers, and calculating factorials. Example inputs and outputs are provided for clarity on expected results for each problem.
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)
5 views2 pages

Introduction To Computer Science Lab - CSE 112

The document outlines the final exam for the Introduction to Computer Science lab (CSE 112), consisting of five problems to be solved in 75 minutes for a total of 24 marks. Each problem requires students to perform tasks such as categorizing numbers, identifying vowels or consonants, checking for palindromes, finding the largest of two numbers, and calculating factorials. Example inputs and outputs are provided for clarity on expected results for each problem.
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/ 2

Introduction to Computer Science lab - CSE 112

Final Exam - 75 minutes


Marks - 24

Problem 1: (PT - 5) Categorize a Number as Positive, Negative, or Zero and Determine Its
Parity
Input: A single integer.
Output:

If the number is positive, print "The number is positive and even" or "The number is positive
and odd" based on its parity.
If the number is negative, print "The number is negative and even" or "The number is
negative and odd" based on its parity.
If the number is zero, print "The number is zero and even".
Example:
Input: -5
Output: The number is negative and odd

Input: 4
Output: The number is positive and even

Problem 2: (Pt - 6.5) Vowel or Consonant


Input: A single lowercase letter.
Output:

"Vowel" if the input is 'a', 'e', 'i', 'o', or 'u'.


"Consonant" for any other letter.
Example:
Input: a
Output: Vowel

Problem 3: (Pt - 6) Determine if a Number is a Palindrome


Input: A single integer.
Output:
"The number is a palindrome" if the reverse of the number is the same as the original
number.
"The number is not a palindrome" otherwise.
Example:
Input: 121
Output: The number is a palindrome

Problem 4: (Pt - 6) Find the Largest of Two Numbers Using a Function


Input: Two integers.
Output:

The larger of the two numbers, determined using a function.


If both numbers are equal, print "Both numbers are equal".
Instructions:

Create a function called find_largest that takes two integers as parameters and returns the
larger of the two.
Use the function in the main program to determine and print the result.
Example:
Input:
7 15

Output:
The largest number is 15

Problem 5 : (PT - 6.5) Calculate the Factorial of a Number


Input: A single non-negative integer, n.
Output:

The factorial of the number (n!), calculated as n × (n-1) × (n-2) × ... × 1.


Example:
Input: 5
Output: The factorial is 120

You might also like