close nav

close nav

Thread: 3 year experience question SIMENS Company (Round - I)

Forum : Job discussions   9 Dec, 2017
User Image
Basant

Newbie

Joined: 21 Apr, 2017

Points: 405

Threads: 6

Posts: 21

3 year experience question SIMENS Company (Round - I)

| Quote Date : 9 Dec, 2017    Views:1531    

Experience Question for Java/J2ee , Really all questions are mind blowing team not a single question they asked regarding definition all are awesome i love it

SIMENS INTERVIEW QUESTIONS

FIRST ROUND:

Written Test (with pen and paper) 5 questions 30 min duration

1. Given a List of N number a1, a2, a3........an, you have to find smallest number from the List that is repeated in the List exactly K number of times.

Input Format

First Line of Input Contain Single Value N, Size of List

Second Line of Input Contain N Space Separated Integers

Third Line of Input Contain Single Value K

 Output Format

Smallest Integer Value That is Repeated Exactly K Number of Time

Constraints

0 < N < 100001

0 <= K < 100001

0 <= ai < 100001

NOTE

There Will Be At least One Variable Which Is Repeated K Times

 2. Class A has to keep generating random numbers and it has to notify class B when it generates a composite number. Class B has to print the number whenever it receives a notification. (Provide code for same)

 3. The program has to search for a word in a data structure of multimillion entries what libraries/mechanism within java you recommend to minimize the time of search

 4. Given a List of Distinct N number a1, a2, a3........an.

Find The Position Of Number K In The Given List.

 Input Format

 First Line Take Input Value of N

 Second Line Take Input N Space Separated Integer Value

Third Line Take Input Value of K

Output Format

Position of K in the Given List

 Constraints

0 < N < 100001

0 < ai < 1010

0 < K < 1010

NOTE:

Array Indexing Starts From 0

SAMPLE INPUT

5

1 2 3 4 5

4

SAMPLE OUTPUT

3

Time Limit:      1.0 sec(s) for each input file.

5. Complete the merge String function .It has 2 parameters:

1. A String a.

2. A String b.

Your function must merge string a and b and then return a single merged string. A merge operation between 2 string describe below

      Append alternating character from a and b , respectively, to some new String, merged string

      Once all of the characters in one of the strings have been merged, append the remaining characters in the other string to merged string

      Use only one single iteration to merge string

        Sample input: s1=ab s2=zsd  output: azbsd

Comments

User Image
Amritk

Newbie

Joined : 8 May, 2017

Points : 230

Threads: 57

Posts: 216

Re: 3 year experience question SIMENS Company (Round - I)

Reply Date : 11 Dec, 2017

Solution of Question 4:
<code>

import java.util.*;

public class Test
{
  public static void main(String ar[])
  {
    List<Integer> list=new ArrayList<Integer>();
    list.add(1);
    list.add(3);
    list.add(4);
    list.add(9);
    list.add(2);
   
   int count=0;
   int search=2;
   for(int temp:list){
    if(search==temp)
      {
        System.out.println(count);
        break;
      }
    count++;
   }
   
   
  }
  }
</code>
    ?

Load More

No More Comments