Posts

Class 8 Algorithms and Flowcharts

Image
A Fill in the blanks with the correct words. 1. The start and stop symbols are oval in shape. 2. The parallelogram symbol is used for input/output in flowchart. 3. The decision symbol has two outputs for true and false conditions. 4. It is a good practice to write algorithm first and then write the code of a program. 5. A flowchart should flow from top to bottom and from left to right. B Write T for the true statement and F for the false one. Correct the false statement(s). 1. There can be more than one start symbol in a flowchart. ( F - because there can only be one start symbol in a flowchart ) 2. You cannot draw a flowchart in more than one page. ( F - because we can draw a flowchart in more than one page by using the off-page connectors ) 3. The arrow lines show the flow of steps. ( T ) 4. The order of instructions in an algorithm is not important. ( F - the order of instructions in an algorithm is important ) 5. You can use the parallelogram symbol for calculations in a flowc...

Singly Linked List Program in Java

What is a Linked List? A Linked List is a linear data structure. It is a collection of nodes such that each node points to the next node. The size of a linked list isn't fixed as the nodes can be added or removed as and when required. The nodes are created by allocating space from the heap memory, using the new keyword. A singly linked list is one in which each node is only capable to point to the next node. A doubly linked list is one in which each node is capable of pointing to the previous as well as the next node. Basic Operations in a Linked List (a) Insertion : We can insert a node in a linked list. A node can be inserted at the beginning, or at the end, or anywhere in-between the list. (b) Deletion : We can delete a node in a linked list. Firstly, we search for the node to be deleted. If found, the deletion takes place and the linked list is readjusted. If not found, then the deletion operation is cancelled. (c) Traversal : We can traverse a linked list, meaning that we can ...

Data Structures - Stacks and Queues in Python

Implementing Stack in Python using a List def push(stack, element):     stack.append(element)     top = len(stack) - 1 def pop(stack):     if stack == []:         return 'UNDERFLOW'     element = stack.pop()     if len(stack) == 0:         top = None     else:         top = len(stack) - 1     return element def peek(stack):     if stack == []:         return 'UNDERFLOW'     top = len(stack) - 1     return stack[top] def display(stack):     if stack == []:         print('STACK EMPTY')     else:         top = len(stack) - 1         print(str(stack[top]) + "<--top")         for i in range(top - 1, -1, -1):             print(stack[i]) stack = [] top = None while True:     p...

Sort Matrix ISC Computer Science 2021 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 both 'M' and 'N' must be greater than 2 and less than 8. Allow the user to input integers into the matrix. Perform the following tasks on the matrix: (a) Sort the matrix elements in descending order using any standard sorting technique. (b) Calculate the sum of the boundary elements of the matrix before sorting and after sorting. (c) Display the original matrix and the sorted matrix along with the sum of their boundary elements respectively. Test your program for the following data and some random data: Example 1 INPUT: M = 3 N = 4 ENTER ELEMENTS OF MATRIX 11 2 -3 5 1 7 13 6 0 4 9 8 OUTPUT: ORIGINAL MATRIX 11 2 -3 5 1 7 13 6 0 4 9 8 SUM OF THE BOUNDARY ELEMENTS (UNSORTED) = 43 SORTED MATRIX 13 11 9 8 7 6 5 4 2 1 0 -3 SUM OF THE BOUNDARY ELEMENTS (SORTED) = 52 Example 2 INPUT: M = 3 N = 3 ENTER ELEMENTS OF MATRIX 6 2 5 14 1...

Common Words ISC Computer Science 2021 Practical

Write a program to accept a paragraph containing two sentences only. The sentences may be terminated by either '.', '?' or '!' only. Any other character may be ignored. The words are to be separated by a single blank space and must be in uppercase. Perform the following tasks: (a) Check for the validity of the accepted paragraph for the number of sentences and for the terminating character. (b) Separate the two sentences from the paragraph and find the common words in the two sentences with their frequency of occurrence in the paragraph. (c) Display both the sentences separately along with the common words and their frequency, in the format given below. Test your program for the following data and some random data: Example 1 : INPUT: IS IT RAINING? YOU MAY GET WET IF IT IS RAINING. OUTPUT: IS IT RAINING? YOU MAY GET WET IF IT IS RAINING. COMMON WORDS FREQUENCY IS 2 IT 2 RAINING 2 Example 2 : INPUT: INDIA IS MY MOTHERLAND AND I AM PROUD OF MY MOTH...

Fascinating Number ISC Computer Science 2021 Practical

A Fascinating number is one which when multiplied by 2 and 3 and then, after the results are concatenated with the original number, the new number contains all the digits from 1 to 9 exactly once. There can be any number of zeroes and are to be ignored. Example : 273 273 × 1 = 273 273  × 2 = 546 273  × 3 = 819 Concatenating the result we get, 273546819 which contains all digits from 1 to 9 exactly once. Thus, 273 is a Fascinating number. Accept two positive integers m and n, where m must be less than n and the values of both 'm' and 'n' must be greater than 99 and less than 10000 as user input. Display all fascinating numbers that are in the range between m and n (both inclusive) and output them along with the frequency, in the format given below: Example 1 : INPUT: m = 100 n = 500 OUTPUT: THE FASCINATING NUMBERS ARE: 192 219 273 327 FREQUENCY OF FASCINATING NUMBERS IS: 4 Example 2 : INPUT: m = 900 n = 5000 OUTPUT: THE FASCINATING NUMBERS ARE: 1902 1920 2019 2190 2703 ...

Banner Program ISC Computer Science 2018 Practical

The names of the teams participating in a competition should be displayed on a banner vertically, to accommodate as many teams as possible in a single banner. Design a program to accept the names of N teams, where 2 < N < 9 and display them in vertical order, side by side with a horizontal tab (i.e. eight spaces). Test your program for the following data and some random data: Example 1: INPUT: N = 3 Team 1: Emus Team 2: Road Rols Team 3: Coyote OUTPUT: E R C m o o u a y s d o t R e o l s Example 2: INPUT: N = 4 Team 1: Royal Team 2: Mars Team 3: De Rose Team 4: Kings OUTPUT: R M D K o a e i y r n a r R g l s o s s e Example 3: INPUT: N = 10 OUTPUT: INVALID INPUT import java.util.Scanner; class Banner{     public static void main(String[] arg...