Syvum Home Page

Home > Discussions > For all activities

Discussion topic: Contributed Answer/Explanation to Q. 13

Viewing messages

To go to the homepage of this topic, click here.
<  Page 2 of 5  >  >>
From: dj_glitzzzReply 21 of 86Reply
Subject: Contributed Answer/Explanation to Q. 15
   200

Posted at: Tue Jan 26 13:35:45 2010 (GMT)

From: dj_glitzzzReply 22 of 86Reply
Subject: Contributed Answer/Explanation to Q. 16
   400
   if the condition is true... then the value afer question mark is stored in
   sum... else the value after semi colons is stored in sum

Posted at: Tue Jan 26 13:41:43 2010 (GMT)

From: dj_glitzzzReply 23 of 86Reply
Subject: Contributed Answer/Explanation to Q. 17
   a default constructor is the constructor that does not accept any argument.

Posted at: Tue Jan 26 13:43:51 2010 (GMT)

From: sneha1991Reply 24 of 86Reply
Subject: Contributed Answer/Explanation to Q. 2
   Object is an identifiable entity with some characteristics and
   behaviour.E.g.Maruti is an object for class car.

Posted at: Tue Feb 9 16:57:17 2010 (GMT)

From: sneha1991Reply 25 of 86Reply
Subject: wrong answer
   there are lot many more errors in this particular question.

Posted at: Tue Feb 9 17:00:08 2010 (GMT)

From: sneha1991Reply 26 of 86Reply         View replies (2)
Subject: Contributed Answer/Explanation to Q. 13
   int n[]={2,4,6,8,10};

Posted at: Tue Feb 9 17:01:46 2010 (GMT)

From: sneha1991Reply 27 of 86Reply
Subject: Contributed Answer/Explanation to Q. 13
   int n[]={2,4,6,8,10}; for(int i=0;i<5;i++)
   System.out.println("n["+i+"]="+n[i];

Posted at: Tue Feb 9 17:04:12 2010 (GMT)

From: sneha1991Reply 28 of 86Reply
Subject: Contributed Answer/Explanation to Q. 13
   int n[]={2,4,6,8,10}; for(int i=0;i<5;i++)
   System.out.println("n["+i+"]="+n[i]);

Posted at: Tue Feb 9 17:06:02 2010 (GMT)

From: sonali16Reply 29 of 86Reply         View replies (1)
Subject: Contributed Answer/Explanation to Q. 3
   A variable is a quantity which varies during the execution of the program. A
   variable is a memory location where the information is stored. This
   information can be changed during the execution of the program

Posted at: Mon Feb 22 05:07:39 2010 (GMT)

From: sonali16Reply 30 of 86Reply
Subject: Contributed Answer/Explanation to Q. 3
   A variable is a quantity which varies during the execution of the program.A
   variable is a memory location where the information is stored. This
   information can be changed during the execution of the program.

Posted at: Mon Feb 22 05:08:17 2010 (GMT)

From: sonali16Reply 31 of 86Reply
Subject: Contributed Answer/Explanation to Q. 5
   The 'new' operator allocates memory location.

Posted at: Mon Feb 22 05:10:14 2010 (GMT)

From: sonali16Reply 32 of 86Reply
Subject: Contributed Answer/Explanation to Q. 15
   Below are the output in both the cases-
   
   1) 200
   
   
   2) 400

Posted at: Mon Feb 22 05:20:51 2010 (GMT)

From: sonali16Reply 33 of 86Reply
Subject: -
   The ans given by you is wrong!! The correct answer should be 98.

Posted at: Mon Feb 22 05:25:04 2010 (GMT)

From: ishan20Reply 34 of 86Reply
Subject: Contributed Answer/Explanation to Q. 20
   A package is a set of "related" classes..
   For example: lang package..........लैन्ग पएकेग

Posted at: Mon Feb 22 17:07:22 2010 (GMT)

From: omarmirza10Reply 35 of 86Reply
Subject: Contributed Answer/Explanation to Q. 23
   Answer is below
   <p>
   import java.io.*;
   </p>
   <p>
   public class Q52k6<br />
   {<br />
      public static void main(String args[])throws IOException<br />
      {<br />
          BufferedReader br=new BufferedReader(new
   InputStreamReader(System.in));<br />
          int tc;<br />
          System.out.println("Enter the total cost");<br />
          tc=Integer.parseInt(br.readLine());<br />
          int am;<br />
          <br />
          if(tc<=2000)<br />
          {<br />
              System.out.println("Discount Obtained = 5%");<br
   />
              am=tc-((5*tc)/100);<br />
              System.out.println("Amount to be paid = " +am);<br
   />
           }<br />
           if(tc>=2001&&tc<=5000)<br />
           {<br />
               System.out.println("Discount obtained = 25%" );<br
   />
               <br />
               am=tc-((25*tc)/100);<br />
               System.out.println("Amount to be paid = " +am);<br
   />
           }<br />
           if(tc>=5001&&tc<=10000)<br />
           {<br />
               System.out.println("Discount obtained = 35%");<br
   />
               am=tc-((35*tc)/100);<br />
               System.out.println("Amount to be paid = " +am);<br
   />
           }<br />
           if(tc>10000)<br />
           {<br />
               System.out.println("Discount obtained = 50%");<br
   />
               am=tc-((50*tc)/100);<br />
               System.out.println("Amount to be paid = " +am);<br
   />
           }<br />
       }<br />
       <br />
          <br />
      
   </p>
   <p>
   }
   </p>

Posted at: Tue Feb 23 16:13:07 2010 (GMT)

From: omarmirza10Reply 36 of 86Reply         View replies (3)
Subject: Contributed Answer/Explanation to Q. 22
   Answer is below:
   import java.io.*;<br />
   public class Q42k6<br />
   {<br />
      public static void main(String args[])throws IOException<br />
      {<br />
          BufferedReader br=new BufferedReader(new
   InputStreamReader(System.in));<br />
          int n;<br />
          System.out.println("Enter the desired number");<br />
          n=Integer.parseInt(br.readLine());<br />
          int k=1;<br />
          int sum=0;<br />
          int sum2=0;<br />
          for(k=1;k<=n;k++)<br />
          {<br />
              if(k%2==0)<br />
              {<br />
                  sum+=k;<br />
               }<br />
               else<br />
               {<br />
                   sum2+=k;<br />
               }<br />
           }<br />
           System.out.println("Sum of Even Numbers = " +sum);<br
   />
           System.out.println("Sum of Odd numbers = " +sum2);<br
   />
       }<br />
   }

Posted at: Tue Feb 23 16:15:57 2010 (GMT)

From: omarmirza10Reply 37 of 86Reply
Subject: Contributed Answer/Explanation to Q. 24
   Answer is below;
   public class January
   {
       public static void main(String args[])
         {
           String sentence="January 26 is celebrated as Republic day in
   India";
           
           String sen1=sentence.replace("January","August");
           
           String sen2=sen1.replace("26","15");
           
           String sen3=sen2.replace("Republic","Inpedence");
           
           System.out.println("The sentence is\n " + sen3);
             
         }
   }

Posted at: Tue Feb 23 16:23:08 2010 (GMT)

From: omarmirza10Reply 38 of 86Reply
Subject: Contributed Answer/Explanation to Q. 22
   Answer is below:
   import java.io.*;<br />
   public class Q42k6<br />
   {<br />
      public static void main(String args[])throws IOException<br />
      {<br />
          BufferedReader br=new BufferedReader(new
   InputStreamReader(System.in));<br />
          int n;<br />
          System.out.println("Enter the desired number");<br />
          n=Integer.parseInt(br.readLine());<br />
          int k=1;<br />
          int sum=0;<br />
          int sum2=0;<br />
          for(k=1;k<=n;k++)<br />
          {<br />
              if(k%2==0)<br />
              {<br />
                  sum+=k;<br />
               }<br />
               else<br />
               {<br />
                   sum2+=k;<br />
               }<br />
           }<br />
           System.out.println("Sum of Even Numbers = " +sum);<br
   />
           System.out.println("Sum of Odd numbers = " +sum2);<br
   />
       }<br />
   } 

Posted at: Tue Feb 23 16:48:26 2010 (GMT)

From: omarmirza10Reply 39 of 86Reply
Subject: Contributed Answer/Explanation to Q. 22
   Answer is below:
   import java.io.*;<br />
   public class Q42k6<br />
   {<br />
      public static void main(String args[])throws IOException<br />
      {<br />
          BufferedReader br=new BufferedReader(new
   InputStreamReader(System.in));<br />
          int n;<br />
          System.out.println("Enter the desired number");<br />
          n=Integer.parseInt(br.readLine());<br />
          int k=1;<br />
          int sum=0;<br />
          int sum2=0;<br />
          for(k=1;k < = n;k++)<br />
          {<br />
              if(k%2==0)<br />
              {<br />
                  sum+=k;<br />
               }<br />
               else<br />
               {<br />
                   sum2+=k;<br />
               }<br />
           }<br />
           System.out.println("Sum of Even Numbers = " +sum);<br
   />
           System.out.println("Sum of Odd numbers = " +sum2);<br
   />
       }<br />
   } 

Posted at: Tue Feb 23 16:56:33 2010 (GMT)

From: omarmirza10Reply 40 of 86Reply
Subject: Contributed Answer/Explanation to Q. 22
   Answer is below:
   import java.io.*;<br />
   public class Q42k6<br />
   {<br />
      public static void main(String args[])throws IOException<br />
      {<br />
          BufferedReader br=new BufferedReader(new
   InputStreamReader(System.in));<br />
          int n;<br />
          System.out.println("Enter the desired number");<br />
          n=Integer.parseInt(br.readLine());<br />
          int k=1;<br />
          int sum=0;<br />
          int sum2=0;<br />
          for(k=1;k <= n;k++)<br />
          {<br />
              if(k%2==0)<br />
              {<br />
                  sum+=k;<br />
               }<br />
               else<br />
               {<br />
                   sum2+=k;<br />
               }<br />
           }<br />
           System.out.println("Sum of Even Numbers = " +sum);<br
   />
           System.out.println("Sum of Odd numbers = " +sum2);<br
   />
       }<br />
   } 

Posted at: Tue Feb 23 16:56:52 2010 (GMT)

<  Page 2 of 5  >  >>

To post to this forum, you must be signed in as a Syvum member. Please sign in / register as a member.

Contact Info © 1999-2024 Syvum Technologies Inc. Privacy Policy Disclaimer and Copyright