0% found this document useful (0 votes)
9 views5 pages

Class XI Computer Science Holiday Homework

The document provides instructions and 10 questions for a Computer Science homework assignment involving programming in Java. Students are asked to write algorithms, source code with comments, and output for programs that: 1) analyze exam results data, 2) print patterns, 3) check for happy and Smith numbers, 4) perform math operations on arrays, 5) reverse a sentence, 6) format a name, 7) find the longest word in a string, and 8) convert a number to abbreviated name format. Students are to complete the work on A4 sheets with their details, algorithms, source code, and outputs for each question.

Uploaded by

Azal Azami
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)
9 views5 pages

Class XI Computer Science Holiday Homework

The document provides instructions and 10 questions for a Computer Science homework assignment involving programming in Java. Students are asked to write algorithms, source code with comments, and output for programs that: 1) analyze exam results data, 2) print patterns, 3) check for happy and Smith numbers, 4) perform math operations on arrays, 5) reverse a sentence, 6) format a name, 7) find the longest word in a string, and 8) convert a number to abbreviated name format. Students are to complete the work on A4 sheets with their details, algorithms, source code, and outputs for each question.

Uploaded by

Azal Azami
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

St.

Paul’s Church College


Class XI : Computer Science
Holiday Homework – Practical Work
Session 2023-24

Instructions:

 Cover your file white paper with all your details in a box.
Students need to write sequentially the algorithm of each program,
then printout of the source code(put comments in your
program)and followed by the printout of output screen.

NOTE: Algorithm, printout of source code and printout of output


screen should be done on A4 sheet only
Q1. The annual exam result of 5 students of class XI-B of Christ College I
tabulated as follows:

Roll No. Maths English Sanskrit

WAP in Java to read the data and determine:

i) Total marks obtained by each student.


ii) Highest marks in each subject and the roll number of the student
who obtained it.
iii) Highest total marks and the roll no. of the student who obtains it.

Q2. WAP in Java to print the following pattern:

***********
*********
*******
*****
***
*
Q3. WAP to print the following format:

1010101
010101
10101
0101
101
01
1

Q4. WAP to check and print first 10 Happy Numbers.

Happy number: Starting with any positive integer, replace the number by the
sum of the squares of its digits, and repeat the process until the number equals
1.

Q5. Accept numbers into an integer array A of size 4, create another string
array B of size 3. Accept any three mathematical symbols like (+, -, *, /) in
array B. Then according to mathematical symbol calculate the answer.
For e.g. if A = [8, 6, 4, 2] & B = [+, -, *], then answer will be (((8 + 6) - 4) *
2) = 20.
Q6. WAP in java to enter a number and check whether the number is
Kaprekar number or not.
A Karprekar number for a given base is a non-negative integer, the
representation of whose square in that base can be split into two parts that
add up to the original number again. For e.g. 45 is a Karprekar number,
because 45 * 45= 2025 and 20 + 25 =
45.
Q7. Write a program for converting a sentence in reverse.
For e.g.: Input: JAVA IS PROGRAMMING Output: PROGRAMMING IS JAVA

Q8. Write a program in java to accept a name containing First name,


Middle Name and Surname. Now display the Name in abbreviated form in
the order Surname, First initial of Middle name, and First initial of the First
name.
For e.g. Input : Mike Carron Elingnton
Output : Elingnton C. M.

Q9. Write a program to accept a string/sentence in upper


case and Display the longest word and the length of the
longest word present in the string.
For e.g. Input : “Australia is one of the most sports
playing nation in the world”
Output : Longest word = “Australia”
Length : 9
Q10. A natural number is said to be SMITH NUMBER, if sum
of all the digits of N and sum of all the digits of prime
factors of N are same.

Example : Input : N = 666


Sum of all the digits = 18
Prime factors of 666 = 2,3,3,37
Sum of digits of prime factors
(2+3+3+(3+7)) = 18
So 666 is a SMITH NUMBER.
WAP to input a positive natural number N and print
whether it is a SMITH NUMBER or not.

Common questions

Powered by AI

Translating numeric operations into programmatic logic is paramount in computer science education as it bridges theoretical knowledge and practical application. It requires an understanding of mathematical principles alongside computational constructs to develop efficient, reliable software solutions. Mastering this skill enables students to construct algorithms that replicate complex calculations, automate reasoning processes, and solve real-world problems efficiently using code .

The concept of a 'Smith Number' enhances understanding of number theory by illustrating the relationship between numbers and their prime factorization and how properties of numbers can be checked algorithmically. By implementing logic to check if the sum of digits of a number equals the sum of the digits of its prime factors, programmers gain hands-on experience in decomposing numbers, applying divisibility rules, and manipulating digit sums, thereby deepening their comprehension of both theoretical and practical aspects of number theory .

The benefits of using array manipulations for arithmetic operations include simplifying the management of data collections, providing efficient means for batch operations, and allowing for flexible input handling. However, limitations arise in terms of potential complexity when dealing with operations that require interactions between multiple arrays, as well as the overhead in terms of memory usage and processing when arrays grow large or operations require intricate logic patterns .

Using a sequential algorithm to process exam results is crucial because it ensures that each step is executed in a linear order, maintaining data integrity and accuracy in calculations such as obtaining total marks, highest marks in subjects, and identifying students with top scores. Sequential algorithms help avoid data mishandling and provide a clear, logical flow of operations, essential for producing accurate outputs such as student rankings and awards .

Displaying names in an abbreviated format can be beneficial for maintaining uniformity in data presentations, reducing the space and complexity of datasets, and ensuring ease of reference. This is particularly useful in large databases where space-saving and quick retrieval of essential information, such as initials or surnames, is required. Such formatting supports efficient data management and prevents clutter in user interfaces .

Effective computational strategies for finding the longest word in a string include iterating through the text while tracking the maximum length encountered, storing current words dynamically, and comparing them against stored values. This is significant in text processing as it underpins functionalities like keyword extraction, summarization, and basic natural language processing tasks. Efficient text handling and the ability to process strings accurately and swiftly are crucial in developing applications related to language processing and data analytics .

A 'Happy Number' is defined as a number where repeatedly summing the squares of its digits eventually results in the number 1. This concept is used in programming exercises to help students understand iterative and conditional logic, recursion, and the use of loops. By programming the process to identify such numbers, students can apply and reinforce their understanding of core programming constructs .

Reversing a sentence programmatically demonstrates the principles of string manipulation by requiring manipulation of character positions, concatenation operations, and indexing. It illustrates Java's capabilities with string methods such as splitting arrays, iterating in reverse, and constructing new strings. This task highlights the importance of understanding how data loops and transformations work to achieve desired operations on dynamic data types .

Pattern programming challenges students to devise algorithms that generate specific outputs, which bolsters their problem-solving and logical reasoning skills. It requires understanding loops, conditionals, and sometimes recursion, which are foundational to programming. The process of decomposing a desired pattern into elementary operations promotes analytical thinking and the ability to visualize algorithms in action, a key component of developing efficient code .

Determining whether a number is a Kaprekar number involves several computational challenges, such as accurately partitioning the square of the number to verify if its parts sum to the original number. This requires precise numerical operations, careful handling of digits and their positions, and ensuring that calculations respect numerical limits, which can introduce complexity in coding logic and performance, especially for large numbers .

You might also like