Posts

Showing posts from May, 2022

Octal Matrix ISC Computer Science 2020 Practical

Write a program to declare a matrix A[][] of order (M ✕ N) where 'M' is the number of rows and 'N' is the number of columns such that the value of 'M' must be greater than 0 and less than 10 and the value of 'N' must be greater than 2 and less than 6. Allow the user to input digits (0 - 7) only at each location, such that each row represents an octal number. Example: 2 3 1 (decimal equivalent of 1 st row = 153 i.e. 2  ✕ 8 2 + 3  ✕ 8 1 + 1  ✕ 8 0 ) 4 0 5 (decimal equivalent of 2 nd row = 261 i.e. 4  ✕ 8 2 + 0  ✕ 8 1 + 5  ✕ 8 0 ) 1 5 6 (decimal equivalent of 3 rd row = 110 i.e. 1  ✕ 8 2 + 5  ✕ 8 1 + 6  ✕ 8 0 ) Perform the following tasks on the matrix: (a) Display the original matrix (b) Calculate the decimal equivalent for each row and display as per the format given below. Test your program for the following data and some random data: Example 1 : INPUT: M = 1 N = 3 ENTER ELEMENTS FOR ROW 1: 1 4 4 OUTPUT: FILLED MATRIX 1 4 4 DECIMAL E...

Mix Words ISC Computer Science 2020 Theory

A class Mix has been defined to mix two words, character by character, in the following manner: The first character of the first word is followed by the first character of the second word and so on. If the words are of different length, the remaining characters of the longer word are put at the end. Example : If the first word in "JUMP" and the second word is "STROLL", then the required word will be "JSUTMRPOLL". Some of the members of the class are given below: Class name : Mix Data members/instance variables : wrd: to store a word len: to store the length of the word Member functions/methods : Mix(): default constructor to initialize the data members with legal initial values void feedWord(): to accept the word in uppercase void mixWord(Mix p, Mix q): mixes the words of objects p and q as stated above and stores the resultant word in the current object void display(): displays the word Specify the class Mix giving details of the constructor, void feedWo...

Binary Search ISC Computer Science 2020 Theory

Design a class BinSearch to search for a particular value in an array. Some of the members of the class are given below: Class name : BinSearch Data members/instance variables : arr[]: to store integer elements n: integer to store the size of the array Member functions/methods : BinSearch(int num): parameterized constructor to initialize n = num void fillArray(): to enter elements in the array void sort(): sorts the array elements in ascending order using any standard sorting technique int binSearch(int l, int u, int v): searches for the value 'v' using binary search and recursive technique and returns its location if found otherwise returns -1. Define the class BinSearch giving details of the constructor, void fillArray(), void sort(), and binSearch(int, int, int). Define the main() function to create an object and call the functions accordingly to enable the task. import java.util.Scanner; class BinSearch{     int arr[];     int n;     public BinSearc...

Date Program ISC Computer Science 2020 Theory

Design a class Convert to find the date and the month from a given day number for a particular year. Example: If day number is 64 and the year is 2020, then the corresponding date would be: March 4, 2020 i.e. (31 + 29 + 4 = 64) Some of the members of the class are given below: Class name : Convert Data members/instance variables : n: integer to store the day number d: integer to store the day of the month (date) m: integer to store the month y: integer to store the year Methods/Member functions : Convert(): constructor to initialize the data members with legal initial values void accept(): to accept the day number and the year void dayToDate(): converts the day number to its corresponding date for a particular year and stores the date in 'd' and the month in 'm' void display(): displays the month name, date and year Specify the class Convert giving details of the constructor, void accept(), void dayToDate() and void display(). Define a main() function to create an ob...

Strontio Number in Java

Strontio numbers are the four-digit numbers which when multiplied by 2 gives the same digit at the hundreds and tens place. Example : 1386 is a strontio number because 1386 × 2 = 2772. We observe that we have the same digit at tens and hundreds place. 1111, 2222, 3333, 4444, 5555, 6666, 7777, 8888, 9999, 1001, 2002, 3003, etc. are some more examples of strontio numbers. Write a program in Java to input a four-digit integer and check whether it is a strontio number or not. import java.util.Scanner; class Strontio{     public static void main(String[] args) {         Scanner in = new Scanner(System.in);         System.out.print("Enter the number: ");         int n = Integer.parseInt(in.nextLine());         if(n < 1000 || n > 9999){             System.out.println("Not a strontio number.");             return;       ...

Bouncy Number in Java

A number is said to be a Bouncy number if the digits of the number are unsorted. For example: 1728 is a bouncy number because the digits are unsorted. 2289 is not a bouncy number because the digits are sorted in ascending order. 74410 is not a bouncy number because the digits are sorted in descending order. All numbers below 100 are not bouncy numbers. Write a program in Java to accept a number and check whether it is a bouncy number or not. import java.util.Scanner; class Bouncy{     public static void main(String[] args) {         Scanner in = new Scanner(System.in);         System.out.print("N = ");         int n = Integer.parseInt(in.nextLine());         int len = String.valueOf(n).length();         int a[] = new int[len];         int j = 0;         for(int i = n; i != 0; i /= 10)             a[j++] = i ...

Class 5 Types of Software

 A Fill in the blanks with the correct words. 1. Windows 10 operating system falls under the category of system software. 2. Language translator program converts the computer language to machine language. 3. OSS is a program used by the communication service provider. 4. A program that detects and remove the malicious programs from the computer is called the antivirus software. 5. WinZip is an example of a compression program. B Write T for the true statement and F for the false one. 1. When you buy a printer, you will get a software called system software. T 2. Word 2013 is application software. T 3. Backup of files is required in case original file is lost. T 4. You should run a program of Scanning and Defragmentation in order to increase the speed of a computer. T 5. In school, printing of your marksheet is a general purpose application software. F C Choose the correct option. 1. Which utility program is used in case an original file is lost or destroyed? a. Defragmentation...

Class 8 Spreadsheet - Formulas and Functions

A Fill in the blanks with the correct words: 1. The formula in Excel starts by typing = sign. 2. The $ symbol is used for absolute referencing. 3. On selection, the formula entered into a cell is displayed in the Formula bar. 4. The : symbol is used in specifying a range of cells. 5. SUM is the name of a Function in Excel 2013. B Write T for the true statement and F for the false one. Correct the false statement(s). 1. The default cell referencing is absolute type. F (The default cell referencing is relative type) 2. The AVG function is used to find the average value of list of values. F (The AVERAGE function is used to find the average value of list of values) 3. The range A2:F5 covers 14 cells. F (The range A2:F5 covers 24 cells) 4. A function can be used inside another function. T 5. $A5 is not a valid cell reference in Excel 2013. F ($A5 is a valid cell reference in Excel 2013) C Choose the correct option. 1. Which one is not a type of cell referencing in Excel 2013? a. Relati...

ICSE Computer Applications 2022 Semester 2 Examination

SEMESTER 2 EXAMINATION COMPUTER APPLICATIONS Maximum Marks: 50 Time Allowed: One and a half hours Answers to this paper must be written on the paper provided separately. You will not be allowed to write during the first 10 minutes. This time is to be spent in reading the question paper. The time given at the head of this paper is the time allowed for writing the answers. Attempt all questions from Section A and any four questions from Section B. The marks intended for questions are given in brackets [ ]. SECTION A (Attempt all questions) Question 1 [10] Choose the correct answers to the questions from the given options. (Do not copy the question. Write the correct answer only) (i) Return data type of isLetter(char) is ________. (a) Boolean (b) boolean (c) bool (d) char (ii) Method that converts a character to uppercase is ________. (a) toUpper() (b) ToUpperCase() (c) toUppercase() (d) toUpperCase(char) (iii) Give the output of the following String methods: "SUCESS".indexOf(...

File Handling in Python

Data Files There are two types of data files: 1. Text file: Stores data in ASCII or Unicode encoding. Each line ends with a special EOL (End Of Line) character. 2. Binary file: Stores data in the same format without encoding. The lines of data are not delimited with any EOL character. Opening Files The open() function is used to open a file. By default, the file is opened in "read" mode. myfile = open("details.txt") However, you can also mention the "read" mode while opening a file. myfile = open("details.txt", "r") In the above code, "myfile" is the file object or file handle. To open a file from a specific location: myfile = open("c:\\Users\\details.txt", "r") Double backslashes are provided because it is an escape sequence for representing a single backslash. If you want to use single backslash, then use a raw string. myfile = open(r"c:\users\details.txt", "r") When the path of the fi...

Class 8 Operating Systems

A. Fill in the blanks with the correct words : 1. The  GUI  operating system is user-friendly. 2. The  Title  bar is the horizontal bar located at the top of the window. 3. The  Maximize  button enlarges the window to fill the entire desktop. 4. The  Minimize  button reduces a window to a button on the taskbar. 5. The  Status  bar is generally present at the bottom of the window. B. Write T for the true statement and F for the false one. Correct the false statement(s) . 1. A CUI is more user-friendly operating system interface than a GUI. ( F - GUI is more user-friendly ) 2. A mouse is the preferred input device in a CUI OS. ( F - Keyboard is the preferred input device in CUI ) 3. The minimize button changes to Restore Down button. ( F - Maximize button changes to Restore Down button ) 4. You cannot resize a window in Windows 10. ( F - We can resize ) 5. A multi-user operating system runs only on multi-processor computers. ( T ) C. Choos...

Class 5 Computers - Then and Now

A. Fill in the blanks with the correct words. 1. On Napier's Bones, numbers are carved on bones or strips of  wood . 2. First mechanical computer was invented by  Charles Babbage . 3.  ENIAC  did not have stored programs. 4.  EDVAC  was the first computer that used stored programs. 5. COBOL and FORTRAN came into use in  second  generation computers. B. Write T for the true statement and F for the false one. 1. The abacus has only three rods. ( F as it has more than 3 rods ) 2. First-generation computers were very slow. ( T ) 3. Third-generation computers were smaller than second-generation computers. ( T ) 4. IBM 1401 is an example of third-generation computers. ( F as it is from second-generation ) 5. Japan was one of the first countries that tried developing artificial intelligence. ( T ) C. Choose the correct option. 1. Which of the following can be performed using abacus? a. Addition b. Subtraction c. Both a and b d. None of these 2. ________ ...

Prime Adam Number ISC Computer Science 2020 Practical

A  Prime-Adam  integer is a positive integer (without leading zeroes) which is a prime as well as an Adam number. Prime number : A number which has only two factors, i.e. 1 and the number itself. Example: 2, 3, 5, 7 ... etc. Adam number : The square of a number and the square of its reverse are reverse to each other. Example: If n = 13 and reverse of 'n' = 31, then, (13) 2  = 169 (31) 2  = 961 which is reverse of 169. Thus, 13 is an Adam number. Accept two positive integers m and n, where m is less than n as user input. Display all Prime-Adam integers that are in the range between m and n (both inclusive) and output them along with the frequency, in the format given below: Test your program with the following data and some random data: Example 1 : INPUT: m = 5 n = 100 OUTPUT: THE PRIME-ADAM INTEGERS ARE: 11 13 31 FREQUENCY OF PRIME-ADAM INTEGERS IS: 3 Example 2 : INPUT: m = 100 n = 200 OUTPUT: THE PRIME-ADAM INTEGERS ARE: 101 103 113 FREQUENCY OF PRIME-ADAM INTEGERS ...

Special Number ISC Computer Science 2008 Theory

A   special number   is a number in which the sum of the factorial of each digit is equal to the number itself. For example, 145 = 1! + 4! + 5! = 1 + 24 + 120 = 145. Design a class Special to check if a given number is a special number. Some of the members of the class are given below: Class name : Special Data members/instance variables : n: to store the integer Member functions : Special(): constructor to assign 0 to n. Special(int): parameterized constructor to assign a value to n. void isSpecial(): to check and display if the number 'n' is a special number. import java.util.Scanner; class Special{     int n;     public Special(){         n = 0;     }     public Special(int num){         n = num;     }     public void isSpecial(){         int sum = 0;         int f = 1;         for(int i = n; i != 0; i /= 10){  ...

Rearrange Word ISC Computer Science 2010 Theory

Input a word in uppercase and check for the position of the first occurring vowel and perform the following operations: Words that begin with a vowel are concatenated with "Y". For example, EUROPE becomes EUROPEY. Words that contain a vowel in-between should have the first part from the position of the vowel till the end, followed by the part of the string from beginning till the position before the vowel and is concatenated by "C". For example, PROJECT becomes OJECTPRC. Words that do not contain a vowel are concatenated with "N". For example, SKY becomes SKYN. Design a class Rearrange using the description of the data members and member functions given below: Class name : Rearrange Data members/instance variables : txt: to store a word. cxt: to store the rearranged word. len: to store the length of the word. Member functions : Rearrange(): constructor to initialize the instance variables. void readWord(): to accept the word input in uppercase. void conver...

Decimal to Octal ISC Computer Science 2011 Theory

A class DeciOct has been defined to convert a decimal number into its equivalent octal number. Some of the members of the class are given below: Class name : DeciOct Data members/instance variables : n: stores the decimal number. oct: stores the octal equivalent number. Member functions : DeciOct(): constructor to initialize the data members n = 0, oct = 0. void getNum(int num): assign num to n. void deciOct(): calculates the octal equivalent of 'n' and stores it in 'oct' using the recursive technique. void show(): displays the decimal number 'n', calls the function deciOct() and displays its octal equivalent. (a) Specify the class, giving details of all the functions, including main() to create an object and call the functions accordingly to enable the task. (b) State any two disadvantages of using recursion. import java.util.Scanner; class DeciOct{     int n;     int oct;     public DeciOct(){         n = 0;        ...

Emirp Number ISC Computer Science 2013 Theory

An  emirp number  is a number which is prime backwards and forwards. Example: 13 and 31 are both prime numbers. Thus, 13 is an emirp number. Design a class Emirp to check if a given number is emirp number or not. Some of the members of the class are given below: Class name : Emirp Data members/instance variables : n: stores the number. rev: stores the reverse of the number. f: stores the divisor. Member functions : Emirp(int num): to assign n = num, rev = 0, and f = 2. int isPrime(int x): check if the number is prime using the recursive technique and return 1 if prime otherwise return 0. void isEmirp(): reverse the given number and check if both the original number and the reverse number are prime, by invoking the function isPrime(int) and display the result with an appropriate message. Specify the class Emirp, giving details of the functions. Define main() function to create an object and call the methods to check for Emirp number. import java.util.Scanner; class Emirp{ ...

Kaprekar Number - ISC Computer Science 2010 Practical

A positive whole number 'n' that has 'd' number of digits is squared and split into two pieces, a right-hand piece that has 'd' digits and a left-hand piece that has remaining 'd' or 'd - 1' digits. If the sum of the two pieces is equal to the number, then 'n' is a  Kaprekar number . The first few Kaprekar numbers are: 1, 9, 45, 297, ... Example 1 : 9 9 2  = 81 Right-hand piece of 81 = 1 Left-hand piece of 81 = 8 Sum = 1 + 8 = 9 Example 2 : 45 45 2  = 2025 Right-hand piece of 2025 = 25 Left-hand piece of 2025 = 20 Sum = 25 + 20 = 45 Example 3 : 297 297 2  = 88209 Right-hand piece of 88209 = 209 Left-hand piece of 88209 = 88 Sum = 209 + 88 = 297 Given the two positive integers p and q, where p < q, write a program to determine how many Kaprekar numbers are there in the range between p and q (both inclusive) and output them. The input contains two positive integers p and q. Assume p < 5000 and q < 5000. You are to output the number...

Goldbach Number ISC Computer Science 2018 Practical

A   Goldbach number   is a positive even integer that can be expressed as the sum of two odd primes. Note : All even integer numbers greater than 4 are Goldbach numbers. Example : 6 = 3 + 3 10 = 3 + 7 10 = 5 + 5 Hence, 6 has one odd prime pair 3 and 3. Similarly, 10 has two odd prime pairs, i.e. 3 and 7, 5 and 5. Write a program to accept an even integer 'N' where N > 9 and N < 50. Find all the odd prime pairs whose sum is equal to the number 'N'. Test your program with the following data and some random data: Example 1 : INPUT: N = 14 OUTPUT: PRIME PAIRS ARE: 3, 11 7, 7 Example 2 : INPUT: N = 30 OUTPUT: PRIME PAIRS ARE: 7, 23 11, 19 13, 17 Example 3 : INPUT: N = 17 OUTPUT: INVALID INPUT. NUMBER IS ODD. Example 4 : INPUT: N = 126 OUTPUT: INVALID INPUT. NUMBER OUT OF RANGE. import java.util.Scanner; class Goldbach{     public static void main(String args[]){         Scanner in = new Scanner(System.in);         System.out.p...

Caesar Cipher ISC Computer Science 2017 Practical

Caesar Cipher  is an encryption technique which is implemented as ROT13 ('rotate by 13 places'). It is a simple letter substitution cipher that replaces a letter with the letter 13 places after it in the alphabets, with the other characters remaining unchanged. ROT13 A/a B/b C/c D/d E/e F/f G/g H/h I/i J/j K/k L/l M/m ↕ ↕ ↕ ↕ ↕ ↕ ↕ ↕ ↕ ↕ ↕ ↕ ↕ N/n O/o P/p Q/q R/r S/s T/t U/u V/v W/w X/x Y/y Z/z Write a program to accept a plain text of length L, where L must be greater than 3 and less than 100. Encrypt the text if valid as per the Caesar Cipher. Test your program with the sample data and some random data: Example 1 : INPUT: Hello! How are you? OUTPUT: The cipher text is: Uryyb? Ubj ner lbh? Example 2 : INPUT: Encryption helps to secure data. OUTPUT: The cipher text is: Rapelcgvba urycf gb frpher qngn. Example 3 : INPUT: You OUTPUT: INVALID LENGTH import java.util.Scanner; class CaesarCipher{     public static void main(String args[]){         Scanner i...

Perfect Number ISC Computer Science 2018 Theory

Design a class  Perfect  to check if a given number is a  perfect number  or not. A number is said to be perfect if sum of the factors of the number excluding itself is equal to the original number. Example : 6 = 1 + 2 + 3 (where 1, 2 and 3 are factors of 6, excluding itself) Some of the members of the class are given below: Class name : Perfect Data members/instance variables : num: to store the number Methods/Member functions : Perfect(int n): parameterized constructor to initialize the data member num = n int sumOfFactors(int i): returns the sum of the factors of the number num, excluding itself, using recursive technique void check(): checks whether the given number is perfect by invoking the function sumOfFactors() and displays the result with an appropriate message Specify the class Perfect giving details of the constructor, int sumOfFactors(int) and void check(). Define a main() function to create an object and call the functions accordingly to enable the task...

Palindrome Number ISC Computer Science 2017 Theory

A class  Palin  has been defined to check whether a positive number is a  Palindrome number  or not. The number 'N' is palindrome if the original number and its reverse are same. Some of the members of the class are given below: Class name : Palin Data members/instance variables : num: integer to store the number revNum: integer to store the reverse of the number Methods/Member functions : Palin(): constructor to initialize data members with legal initial values void accept(): to accept the number int reverse(int y): reverses the parameterized argument 'y' and stores it in 'revNum' using recursive technique void check(): checks whether the number is a palindrome by invoking the function reverse() and display the result with an appropriate message. Specify the class Palin giving the details of the constructor, void accept(), int reverse(int) and void check(). Define the main() function to create an object and call the functions accordingly to enable the task. imp...