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:

  1. Make sure your code covers all the different types of input in the code.
  2. 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.
  3. Name variables clearly to state their purpose.
  4. Avoid using in-built library function for strings, instead write your own logic for them.
  5. Avoid declaring arrays of arbitrary sizes, instead use malloc/calloc/realloc for the same.
  6. For any given problem try to find out all the solutions.
  7. 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.

 

Questions:

  1. Given a string find its length.
  2. Given a string reverse it.
  3. Given a string check if it is a palindrome or not.
  4. Given two strings s1 and s2 check if s2 is present as a substring in s1.
  5. Given three strings s1, s2 and s3 replace any occurrence of s2 with s3.
  6. Given a string s1 and an integer n, right shift it n times.
  7. Given a string s1 and an integer n, left shift it n times.
  8. Given a string s2 and an integer n, repeat the string s1, n times.
    1. Eg: s1= ‘mrnd’ n=3; output = ‘mrndmrndmrnd’
  9. Given a string, find the number of vowels and consonants in it.
  10. 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.