...

Write a program to get the best pattern for getting maximum marks in multiple choice questions exam. Assume that the choices for every question are A, B, C and D. Also note that the number of questions in each exam will be exact multiples of four.
There are three types of patterns to choose from.
1. Single means use the same choice for all the questions.
2. Block means dividing the questions into four blocks and use one choice for each block. If there are 16 questions in the exam, first four could be D and second four could be B and so on.
3. Round Robin means using the a pattern repeatedly. For eg. if the chosen pattern is DACB, then the answers will be D, A, C, B, D, A, C, B and so on.

If two patterns give the same number of marks, order of pattern type preference is Single, Block and RoundRobin and order for the patterns is alphabetical.

Input (String) Output (PatternDetails)
`AAAAADDDDDCCCCBCBBBB` `Block - ADCB - 18Input   = AAAAADDDDDCCCCBCBBBBPattern = AAAAADDDDDCCCCCBBBBBMatches = AAAAADDDDDCCCC**BBBB `
`CDBBCADBADBC` `Round_Robin - ADBC - 6Input   = CDBBCADBADBCPattern = ADBCADBCADBCMatches = *DB*****ADBC`
`CCCCCBCBBCAA` `Single - C - 7Input    = CCCCCBCBBCAAPattern  = CCCCCCCCCCCCMatches  = CCCCC*C**C**`
`BACABCACADDBCDBBAAAC` `Block - BCDA - 9`
`ABDCDACBABDCDACB` `Round_Robin - ABDC - 8`

``` class UnpreparedStudentBestPattern {    public static void main(String s[])    {        String answers = "AAAAADDDDDCCCCBCBBBB";        System.out.println("The best pattern to get maximum marks is : " + getBestPattern(answers));    } private static PatternDetails getBestPattern(String answers) { //Write code here to get the best pattern for getting maximum marks and return it. } //If required, write any additional methods here } class PatternDetails { PatternType patternType; String pattern; int marks; public PatternDetails(PatternType patternType, String pattern, int marks) { this.patternType = patternType; this.pattern = pattern; this.marks = marks; } @Override public String toString() { return patternType + " - " + pattern + " - " + marks; } } enum PatternType { Single(1), Block(2), Round_Robin(3); int preference; private PatternType(int preference) { this.preference = preference; } } ```
0
Wrong
Score more than 2 points