Posts

Showing posts with the label practice problem

PRACTICE PROBLEM 8

Image
PRACTICE PROBLEM 8 Verification of 'L' shaped arrangement of Coins on Game Board (Id-2435) Consider a nxn board game with four types of coins red, green, blue and yellow. Given the state of the board with coins in all cells, develop an algorithm and write a C program to check if the same coins are placed in ‘L’ shape on the board. The number of cells in the vertical and horizontal line of ‘L’ shape should be same and should be greater than 1. Red coins are represented by ‘r’, blue coins are represented by ‘b’, green coins are represented by ‘g’ and yellow coins are represented by ‘y’.  For example, given the configuration of a 4 X 4 board with coins as shown below, b r y r r r y b y r b b b r r r the program must print 'Yes'. As there is a 'L' shape as shown in the figure below. Input Format Number of rows, r Number of columns, c Next ‘r x c’ lines contains the elements in the matrix Elements in the matrix given row by row ...

PRACTICE PROBLEM 7

PRACTICE PROBLEM 7 Student Data (Id-3146) Given a file named student.txt which has  the information  of the students in a class such as Name, Roll number, Age, CGPA. Write a pseudocode and the subsequent Python program to do the following operations. a) Read the file and  print the contents of the file b) Read the file and sort the contents (records) of the file  in an  increasing order of CGPA and print the content of the sorted file. c) Read the file and print the record of the student with maximum age and minimum age. d) Read the file and print the average CGPA of the class. e) Read the file and print the name of the students whose CGPA is greater than the average CGPA of the class and whose age lies between average age of the class and the minimum age of the students in the class Input Format Read the name of the input file Details of the students with the fields : Name, Rollnumber, Age, CGPA separated by a comma. Inp...