HTC Global Services Interview Question: The programs that i encounter... | Glassdoor.co.in

Interview Question

Programmer Analyst Interview Chennai

The programs that i encountered: 1.Get the average marks

  from user and if avg>=80&&avg>=100 print grade A. avg>=60&&avg<=79 print grade B,else grade C. 2.write a program for the series 1,2,2,4,8,32. 3.write a function that accepts int array as parameter and print the sorted array. 4.draw a flow chart for the question 1. 5.write a function that accept string as a parameter and prints the number of vowels . 6.write an abstract class and performs the string length and reverse string operation. 7.write a class program with default and parameterized constructor and perform constructor overloading operation. 8.write a program for string validation. • Should not start with ‘.’ And should end with ‘.’ • The string must contain at least 3 spaces. • Size of the string not more than 20. 9.write a program for email validation • There is only one @ symbol • ‘.’ should come after the @ symbol • Should not start with ‘.’
Answer

Interview Answer

4 Answers

3

For me its easy because I am very good in programming.I attended with a calm mind and cleared it.

Interview Candidate on 09-Jan-2016
3

the answer for 1st program is
import java.util.scanner
public Class RankCard{
public static void main (string args[])
{
int marks;
Scanner input = new Scanner(System.in);
System.out.println("Enter your marks to know your Grade");
marks = input.nextInt();
if(marks&gt;=80&amp;&amp;marks&gt;=100)
{
System.out.println("hey you got A Grade");
}
else if (marks&gt;=60&amp;&amp;marks&gt;=79)
{
System.out.println("you got B Grade");
}
else
{
System.out.println("you got C grade");
}
}
}

prashanth sunny on 04-Feb-2016
3

Answer for pgm 3:
Import Java.util.Arrays;
Public class ArraySorting{
Public static void main (String args[]) {
Int [ ] series = new int [] {1,3,4,3,1,6,3};
Arrays.sort(series);
PrintArray("sorted array",series);
Private static void printArray(string message,int[] series)
{
System.out.println(message +"[length: " +arrays.length "]" );
for(int I=o;I&lt;=series.length;I++)
{
If (I!=0)
{
System.out.println(", ")
}
System.out.println(array[i]
}
System.out.println();
}
}
Output:
Sorted array:[ length: 6]
1
,
1
,
3
,
3
,
3
,
4
,
6

Anonymous on 05-Feb-2016
8

THankx for sharing ur experience with us..it is helpful

SOHIL on 14-Feb-2016

Add Answers or Comments

To comment on this, Sign In or Sign Up.