Question:8
(Asked in Accenture OnCampus 12 Aug 2021, Slot 2)
N-base notation is a system for writing numbers that uses only n different symbols, This symbols are the first n symbols from the given notation list(Including the symbol for o) Decimal to n base notation are (0:0, 1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7, 8:8, 9:9, 10:A,11:B and so on upto 35:Z)
Char* DectoNBase(int n, int num):
The function accept positive integer n and num Implement the function to calculate the n-base equivalent of num and return the same as a string
Steps:
Assumption:
1 < n < = 36
Example
Input
n: 12
num: 718
Output
Explanation
Sample Input
n: 21
num: 5678
Sample Output
Rules for Accenture Coding Questions Section
Question:11
(Asked in Accenture Offcampus 1 Aug 2021, Slot 3)
Problem Statement
Void *ReplaceCharacter(Char str[], int n, char ch1, char ch2);
The function accepts a string ‘ str’ of length n and two characters ‘ch1’ and ‘ch2’ as its arguments . Implement the function to modify and return the string ‘ str’ in such a way that all occurrences of ‘ch1’ in original string are replaced by ‘ch2’ and all occurrences of ‘ch2’ in original string are replaced by ‘ch1’.
Assumption: String Contains only lower-case alphabetical letters.
Note:
Example:
Explanation:
‘A’ in original string is replaced with ‘p’ and ‘p’ in original string is replaced with ‘a’, thus output is paales.
Question:9
(Asked in Accenture Offcampus 1 Aug 2021, Slot 1)
Implement the following functions.a
The function accepts a string “str” of length ‘n’, that contains alphabets and hyphens (-). Implement the function to move all hyphens(-) in the string to the front of the given string.
NOTE:- Return null if str is null.
Example :-
Explanation:-
The string “Move-Hyphens -to-front” has 3 hyphens (-), which are moved to the front of the string, this output is “— MoveHyphen”
Sample Input
Sample Output-
Question:13
(Asked in Accenture Offcampus 2 Aug 2021, Slot 2)
Problem Statement
Int MaxExponents (int a , int b);
You have to find and return the number between ‘a’ and ‘b’ ( range inclusive on both ends) which has the maximum exponent of 2.
The algorithm to find the number with maximum exponent of 2 between the given range is
Assumption: a
Note: If two or more numbers in the range have the same exponents of 2 , return the small number.
Example
Explanation:
Exponents of 2 in:
Hence maximum exponent if two is of 8.
Accenture Coding Questions
In Accenture there will be 2 coding questions that you have to solve in 45 minutes. In the Accenture Coding Round ,you can write coding using in these preferred language:-
The difficulty level of the questions are high. You have to practice alot to get good score in the accenture coding Questions.
There will be total of 2 Questions asked in the Accenture Coding Round. For successfully clearing the Coding Round, Students need to have 1 Complete Output and 1 Partial Output.
Accenture Coding Round | No of Questions | Min. Selection Criteria |
---|---|---|
Coding Questions | 2 | One Complete Output One Partial Output |
Total number of Questions | 2 Question |
Total Time Duration | 45 minutes |
Type of Test | Non- Adaptive |
Negative Marking | No |