Posts

Mr. Myers wants to edit the marks assigned to the questions

Pyramid Examples Java Program for find duplicate element and increased duplicate element by 1   A mathematics question paper has certain number of questions and each question is assigned some random maximum marks Mr. Myers wants to edit the marks assigned to the questions such that.  (1) all questions in the paper should have distinct maximum marks. (2) the total marks of all the questions should be as low as possible. Mr. Myers wants to achieve this by making minimal changes in the original format, assigning the question at least so much marks as it originally had. find the minimum total marks that can set the paper for. ? All the inputs in array are minimum marks for a question and it can increase if the duplicates occurred  in the array. Example Input 3 2 4 4 Example Output 11 Explanation As two questions have the same marks, max marks for one of them needs to be incremented to 4.  He can set the paper with 2+4+4=11 marks. This program can be solved by

Object Orinted Programing

  OOP's  Theory Based Question & Answers 1.) Object : An Object is an instance variable of class. An Object is contain an references address. 2.) Class : A class is collection of methods and objects. 3.) Encapsulation : Wrapping of the data into single unit known as encapsulation. ex. class. 4.) Inheritance : Inheritance show relationship between two classes, main purposes of inheritance is code re-usability. There are three types of inheritance, Single, Multilevel, Hierarchical. 5.)  Polymorphism : One to many form is refers to polymorphism. There are two types of polymorphism         (i). Method Overloading : If a class have same methods, but different parameters known as method overloading.        (ii). Method Overloading : If a child class have same method as declared in the parent, known as the method overloading. 6.) Abstraction : Abstraction is a process of hiding implementation details and showing only essentials  information or features. 7.) Data Hiding :

Pyramid Examples In Java

Pyramid Examples Pyramid Example 1 public class Pyramid_Ex1 { public static void main(String[] args) { for (int i =1; i<=5; i++) { for(int j=1; j<=i; j++) { System.out.print("*"); } System.out.println(); } } } Output is * ** *** **** ***** Pyramid Example 2 public class Pyramid_Ex2 { public static void main(String[] args) { for (int i=1; i<=5; i++) { for(int j=5; j>=i; j--) { System.out.print("*"); } System.out.println(); } } } Output is ***** **** *** ** * Pyramid Example 3 public class Pyramid_Ex3 { public static void main(String[] args) { for (int i=1; i<=5; i++) { for(int j=1; j<=i; j++) { System.out.print(j); } System.out.println(); } } } Output is 1 12 123 1234 12345 Pyramid Example 4 public class Pyramid_Ex4 { public static void main(String[] args) { f

Top 10 HR Interviews Questions For Freshers

There are the ten HR interview questions-answer which is frequently asked all type of interview. 1. Tell me about your self ? 2. What is your strength and weakness  ? 3. Why should I hire you ? 4. Why should You hire you  ? 5. What are you know about our company ?   6. What are your career aspirations, dreams and where do you see your self  after 5 years ?   7.  What are your short term and long term goal ? 8. Describe yourself  in one statement ? 9. What are your career achievements ?   10. Please tell us a little bit about your family ? 

Genral Ability

In a survey of 1000 fruit eaters who like to east one fruit among people, mango and grapes; 400 do not like grape, 380 do not like mango and 542 do not like apple, 294 like both mango and apple, 277 like both grape and mango and 120 like both grape and apple How many people like only grapes. a. 281 b. 107 c. 216 d. 207 e. 210 Check Answer 216

2D Array , Print 1 to 10 Table In Java (Click On Full View ↑↑)

By  Using  2D Array , Print 1 to 10 Table  In Java  ----------------------------------------------------------------------------------------   public class Table {    public static void main(String[] args)   {     int[][] a=new int[10][10];      for(int i=1; i<=10; i++)      {        for(int j=1; j<=10; j++)         {               a[i-1][j-1]=i*j;           System.out.print(a[i-1][j-1]+"\t");          }             System.out.println("\n");       }               } } ---------------------------------------------------------------- Output : 1    2    3    4    5    6    7    8    9 ..  2    4    6    8    10   12   14   16   18 .. 3    6    9    12   15   18   21   24   27    4    8    12   16   20   24   28   32   36 5    10   15   20   25   30   35   40   45 6    12   18   24   30   36   42   48   54  7    14   21   28   35   42   49   56   63 8    16   24   32   40   48   56   64   72 9    18   27   36   45   5

How To Merge Two Arrays In Java (Click On Full View ↑)

How To Merge Two Arrays In Java -------------------------------------------------------------------------------------   public class Merge {     public static void main(String[] args)  {     int[] arr1= {2,4,6,7,8};     int[] arr2= {3,5,9,1};     int a=arr1.length;     int b=arr2.length;     int[] res=new int[a+b];         for(int i=0; i<arr1.length; i++)     {         res[i]=arr1[i];     }     for(int j=0; j<arr2.length; j++)     {         res[a+j]=arr2[j];     }     for(int k=0; k<res.length; k++)     {          System.out.print(res[k]+",");     }     } } ----------------------------------------------------------------------------------- Output : 2,4,6,7,8,3,5,9,1,

Print An Array, In Ascending Order In Java (Click On Full View ↑ )

Sort The Elements Of An array In Ascending Order. (In Java)  ----------------------------------------------------------------------------------------------------------------------------   public class SortArray {     public static void main(String[] args) {           int[] arr= {5,4,3,2,1};           int temp=0;  for(int i = 0; i < arr.length; i++)   {       for(int j = i+1; j < arr.length; j++)     {          if(arr[i] > arr[j])        {             temp = arr[i];             arr[i] = arr[j];             arr[j] = temp;         }       }     }        for (int i = 0; i < arr.length; i++)       {             System.out.print(arr[i]+" ");        }    }      }  ---------------------------------------------------------------------------------------------------------------------------- Output : 1 2 3 4 5                  

Print Two's Table By Using One Dimensional Array Or Array In Java (Click ↑ On Full View)

Print Two's Table By Using One Dimensional Array Or Array In Java   -------------------------------------------------------------               package helloJava;             public class OneD {    public static void main(String[] args) {         int[] table = new int[11];       for(int i=1; i<=table.length-1; i++)     {             System.out.println(i*2);     }       }  }

Check The Given No Is Perfect Number ( ⇠Click On The Post For Best Page View)

Check The Given No. Is Perfect Number In C#.Net Language ------------------------------------------------------------------------------------------------------------------  using System; class Test {     public static void Main()     {         Console.WriteLine("enter the no");          int no = Convert.ToInt32(Console.ReadLine());         int rem = 0;         int temp = no;         for (int i = 1; i < no; i++)         {             if (no % i == 0)             {                 rem = rem + i;             }         }             if(rem==temp)             {                 Console.WriteLine("given no is perfect no");             }             else             {                 Console.WriteLine("not perffect no");             }             } } -----------------------------------------------------------------------------------------------------------------------------------

Top 10 IT Companes in India

Image
Top 10 IT Companies In India 1. TCS                                   2. Accenture 3.  Infosys 4. IBM 5. HCL 6. Wipro 7. Tech Mahindra 8. Cognizant 9. Capgemini 10. Oracle Competitors for this all companies   also given below. There are also may be chances included in Top delivered IT services like - Zensar Hexaware Technologies  L&T Infotech ITC Infotech Kpmg Happiest Mind Technologies KPIT NIIT Technologies Mindtree Birlasoft 3i Infotech UST Global Genpact