Showing posts with label aptitude. Show all posts
Showing posts with label aptitude. Show all posts

Friday, 27 September 2013

Reversing string in c using pointers

#include <stdio.h>
#include <string.h>

void print_reverse_string(const char *str)
{
    const char *src = str + strlen(str);
    while (src > str)
        putchar(*--src);
}

void reverse_string_and_print(char *str)
{
    char *src = str;
    char *end = src + strlen(src) - 1;
    while (end > src)
    {
        char t = *end;
        *end-- = *src;
        *src++ = t;
    }
    //return str;
   printf("%s", str);
}

char* reverse_string(char *str)
{
    char *src = str;
    char *end = src + strlen(src) - 1;
    while (end > src)
    {
        char t = *end;
        *end-- = *src;
        *src++ = t;
    }

   return str;
   //printf("%s", str);
}

int  main(void){

    char data[50]= "";

    printf("Enter any string:\n");

    gets(data);

    printf("%s\n", data);
    printf("%s \n", reverse_string(data));
    printf("%s\n", data);

    return(0);
}

I have written the abbove code to reverse an string using pointers. I assume that the above code is self explanatory but still if you want any clarification use the comment section below post.

Peace.

Tuesday, 3 September 2013

Finding a job in Bangalore: First Challenge

Hi

I know that there are lakhs of Berozgaar Engineers like me all over India. I  also know that most of us (Berozgaar Engineers ) have either already made a pilgrimage to Mecca of IT industry in India, Bangalore, or planning to do it pretty soon. If you are like me I have got some really valuable info for you. I am not at all kanjoos I am gonna share what ever I have learned in my past couple of months of stay in Bangalore.

Now to begin with, the reason which brought me to Bangalore was that I got a whooping 95 percentile in eLitmus test and withing a week got an interview call from Webyog. You can read about eLitmus pH test and webyog interview in my previous posts. So packed up and decide to leave for IT Mecca immediately.

The first challenge.

Getting a railway ticket to or from Bangalore is never easy, specially if you have to travel in shirt notice. And finding one is almost impossible when you have to travel the next day. Now first advice while you read the first challenge.  If you are still planning to come to Bangalore get your ticket in advance, at least one month before you are actually traveling. Continuing with my story. There were no tickets available not even waiting list. Now tatkal was the only option left.

I tried consulting with who ever I could, got some very useful information. As you might know as per the current rules Tatkal Tickets are only available one day in advance and that too after 10:00. But the interesting part is that the queue starts from 5 in the morning. Since I had to get my ticket anyhow I woke up at 4 and sped off on my ambition with lots of ambition to reservation counter almost in the middle of the night. For some of us Btechs the exact time we go to sleep. Reached there at around five and no I was not the first person in the queue, there were around 18 people before me already. Now we had to wait until ten when the counters open.

Just before ten, after some dhakka mukki and gaali galaoj queue was formed and reservation forms distributed. Exactly at ten the counters opened and number of available tickets began to drop like leave in autumn. There were total around 200 tickets. At 10:01 around 130 left, at 10:05 70 left. My heart pounding, if a doctor had taken my pulse at that time he would have definitely started my diagnosis for exterem blood pressure. I reached the counter at 10:10 and guess what? there were still 30 berths vacant, finally I got my reservation confirmed and happily returned home.

Now it was time to do packing.

Second advice: Don't count on tatkal reservation any more. Some one has written some bots for making reservation through IRCTC and a lot of agents are using it so now within a minute all tickets get sold out. And if you get to lay your hands on that bot please do share it with me too.

I think that's all I can write right now.  More to come very soon.

Peace

And there are links right at the bottom of this post to share this and all other post on all social networks , have a look. Please share it.

Bye..

Tuesday, 6 August 2013

Reversing String in java

Hi

Continuing with by earlier post on Webyog interview questions. In this post Ill give the code for one of the question asked in Webyog recruitment drive.

If you have read the earlier post on Webyog recruitment drive you should be aware that they asked us to write a code for reversing the string. This question is not unique to webyog but its asked in a lot of recruitment drives.

I have written a class StringRev, it has a method reverseString(String s). This method can be called from any instance of StringRev.




I have also written a main method which instantiates StringRev and calls the reverseString() to demonstrate how its implemented.

I have used Scanner to read string from the console.  If you write your code interactive its guaranteed that you'll be marked higher than your peers.

Here is the code.

package commoninterviewcodes;

import java.util.Scanner;

public class StringRev {
    public String reverseString(String s){
        String revStr = "";
        for(int i=s.length()-1; i >=0;--i){
            revStr += s.charAt(i);
        }
        return revStr;
    }

    public static void main(String[] args) {
        String s ;

        System.out.println("Type something in.");

        Scanner sc = new Scanner(System.in);
        s = sc.next();

        StringRev strRev = new StringRev();
        System.out.println(strRev.reverseString(s));
    }

}
If you don't understand any part of this code feel free to ask.

Peace.




Sunday, 21 July 2013

Webyog Interview

Hi!

This post is about the interview process of the company which hires through elitmus and pays huge salary, Webyog. The guys working in Webyog pronounce it like web-yog, yog like yolk. They have a feeling that they are some US type companies and the want to imitate US guys in every action.

Back to the topic.

Who do they call? 

What ever I have been able to gather they seem to call anyone who has got more than 90 percentile overall in elitmus ph test. However I did find some people who had slightly less than that too. They don't seem to bother about the sectional marks. Even if they do they are not looking for high percentile in problem solving section I can assure you of that.

How many people do they call?

They conduct the recruitment drive at some college. They call a lot of people, they have no other option. Be prepared to see more than 100 competitors if you have been called. 

How many rounds?

I am not 100% sure exactly how many round they take but its definitely three or more. First is a written test to check your programming abilities and then there are at least two interviews.

Whats there in written test?

Its mostly programming. They give 8 question out of which you have to solve any four. two questions are from Java, two from C/C++, two from JavaScript, and two from dot net . you don't have to answer question from all sections, you have to answer only four question overall. Questions seems to be repeated and Ill be sharing with you the paper I faced and another one. Hushhhhh.... don't tell anybody. Its a secret between just me and you. You can download Webyog interview question here. Now you have two sets of question papers go for the test well prepared. I can assure you you'll get at least four question from these two papers. Don't repeat the mistake I made by assuming its all bull shit. They say wise is the person who learns from his mistakes and wiser is the one who learns from others mistake. 

What comes next?

Waiting... and some more waiting. If you get selected you might get a call/ email for the next round of interview. If you don't you have to wait for around 15 days before they'll finally let you know that you haven't been selected. All these days your heart will keep pounding.

For ease of access I am embedding the file I created for preparation here. Yes you can have it too. Go on download, share as many times as you like.

Answer to one question asked in webyog drive has been posted in Reversing a String in Java Post

 Webyog Interview 2014 have now also been added to the blog. 


Webyog Interview

Hi!

This post is about the interview process of the company which hires through elitmus and pays huge salary, Webyog. The guys working in Webyog pronounce it like web-yog, yog like yolk. They have a feeling that they are some US type companies and the want to imitate US guys in every action.

Back to the topic.

Who do they call? 

What ever I have been able to gather they seem to call anyone who has got more than 90 percentile overall in elitmus ph test. However I did find some people who had slightly less than that too. They don't seem to bother about the sectional marks. Even if they do they are not looking for high percentile in problem solving section I can assure you of that.

How many people do they call?

They conduct the recruitment drive at some college. They call a lot of people, they have no other option. Be prepared to see more than 100 competitors if you have been called. 

How many rounds?

I am not 100% sure exactly how many round they take but its definitely three or more. First is a written test to check your programming abilities and then there are at least two interviews.

Whats there in written test?

Its mostly programming. They give 8 question out of which you have to solve any four. two questions are from Java, two from C/C++, two from JavaScript, and two from dot net . you don't have to answer question from all sections, you have to answer only four question overall. Questions seems to be repeated and Ill be sharing with you the paper I faced and another one. Hushhhhh.... don't tell anybody. Its a secret between just me and you. You can download Webyog interview question here. Now you have two sets of question papers go for the test well prepared. I can assure you you'll get at least four question from these two papers. Don't repeat the mistake I made by assuming its all bull shit. They say wise is the person who learns from his mistakes and wiser is the one who learns from others mistake. 

What comes next?

Waiting... and some more waiting. If you get selected you might get a call/ email for the next round of interview. If you don't you have to wait for around 15 days before they'll finally let you know that you haven't been selected. All these days your heart will keep pounding.

For ease of access I am embedding the file I created for preparation here. Yes you can have it too. Go on download, share as many times as you like.

Answer to one question asked in webyog drive has been posted in Reversing a String in Java Post

 Webyog Interview 2014 have now also been added to the blog.