Here is the second round of the 10 questions that will act as a preparation for the selection test Mission RnD 2018 Course. Please try to answer these questions in C. Here are some of the rules that will earn brownie points:
- Make sure your code covers all the different types of input in the code.
- Try to write the code as modular as possible. Divide your code into functions and try to avoid writing the entire function in the main function. Ideally, the main function should contain only reading the input and displaying the output.
- Name variables clearly to state their purpose.
- Avoid using in-built library function for strings, instead write your own logic for them.
- Avoid declaring arrays of arbitrary sizes, instead use malloc/calloc/realloc for the same.
- For any given problem try to find out all the solutions.
- Try to improve on your code by going back again and again to the same problem. It is but common that we will not arrive at the best solution in the first pass.
- Given a string find its length.
- Given a string reverse it.
- Given a string check if it is a palindrome or not.
- Given two strings s1 and s2 check if s2 is present as a substring in s1.
- Given three strings s1, s2 and s3 replace any occurrence of s2 with s3.
- Given a string s1 and an integer n, right shift it n times.
- Given a string s1 and an integer n, left shift it n times.
- Given a string s2 and an integer n, repeat the string s1, n times.
- Eg: s1= ‘mrnd’ n=3; output = ‘mrndmrndmrnd’
- Given a string, find the number of vowels and consonants in it.
- Given two strings s1 and s2, find the all the charecters common in them.
We will release a set of answers to these questions on 18th of February 2017 at 7 P.M. In case of doubts, try to debug the issue as much as you can and in case you are stuck somewhere please feel to post questions in college wise groups or on this post.