Complete IIT AIEEE ICSE ISC PMT help forum
This is a free help Forum for Indian Students.
Complete IIT AIEEE ICSE ISC PMT help forum
This is a free help Forum for Indian Students.
Complete IIT AIEEE ICSE ISC PMT help forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Complete IIT AIEEE ICSE ISC PMT help forum

Complete help forum for students preparing for icse iit aieee cbse pmt and other related exams.Stay updated about all 2011 exams.
 
HomeHome  PortalPortal  SearchSearch  Latest imagesLatest images  RegisterRegister  Log in  India NewsIndia News  
Keywords
2009 YEAR ICSE graph UNION question prelim papers CASE 2007 2010 paper computer SELECT CLASS 2004 science RESULT physics 2006
Latest topics
» Nitration of aniline - IIT JEE 2018 Advanced - solved
OUTPUT CONFUSION!! EmptyFri Jun 08, 2018 2:34 am by adianadiadi

» Diamagnetic - Paramagnetic - Ni(CO)4, [Ni(CN)4]2- and [NiCl4
OUTPUT CONFUSION!! EmptyFri Apr 06, 2018 1:05 am by adianadiadi

» IIT JEE chemistry solved interactive question paper
OUTPUT CONFUSION!! EmptySun Oct 29, 2017 12:11 pm by adianadiadi

» IIT JEE 2015 SOLVED QUESTION PAPER
OUTPUT CONFUSION!! EmptyWed Oct 19, 2016 1:44 pm by adianadiadi

» IIT JEE chemistry solved questions
OUTPUT CONFUSION!! EmptySat Jul 18, 2015 6:15 pm by adianadiadi

» General Description of Chinese Market for Foaming Agent ADC
OUTPUT CONFUSION!! EmptyFri May 09, 2014 2:09 pm by happybaicaitou

» How to get Lowest Cost MBBS Admission?
OUTPUT CONFUSION!! EmptyMon Feb 24, 2014 6:39 pm by MENTOR 2014

»  girl boy vashikaran specialist agori baba ji +91-9461165
OUTPUT CONFUSION!! EmptyTue Jan 21, 2014 6:00 pm by krshastri

»  STRONG LOST LOVE SPELL +91-9461165176
OUTPUT CONFUSION!! EmptyTue Jan 21, 2014 6:00 pm by krshastri

Top posters
abhas
OUTPUT CONFUSION!! Vote_lcapOUTPUT CONFUSION!! Voting_barOUTPUT CONFUSION!! Vote_rcap 
Anu..i luv icse...:)
OUTPUT CONFUSION!! Vote_lcapOUTPUT CONFUSION!! Voting_barOUTPUT CONFUSION!! Vote_rcap 
G-7
OUTPUT CONFUSION!! Vote_lcapOUTPUT CONFUSION!! Voting_barOUTPUT CONFUSION!! Vote_rcap 
siya
OUTPUT CONFUSION!! Vote_lcapOUTPUT CONFUSION!! Voting_barOUTPUT CONFUSION!! Vote_rcap 
Candy
OUTPUT CONFUSION!! Vote_lcapOUTPUT CONFUSION!! Voting_barOUTPUT CONFUSION!! Vote_rcap 
jOhNy
OUTPUT CONFUSION!! Vote_lcapOUTPUT CONFUSION!! Voting_barOUTPUT CONFUSION!! Vote_rcap 
Apurva
OUTPUT CONFUSION!! Vote_lcapOUTPUT CONFUSION!! Voting_barOUTPUT CONFUSION!! Vote_rcap 
WinRrule
OUTPUT CONFUSION!! Vote_lcapOUTPUT CONFUSION!! Voting_barOUTPUT CONFUSION!! Vote_rcap 
ambili
OUTPUT CONFUSION!! Vote_lcapOUTPUT CONFUSION!! Voting_barOUTPUT CONFUSION!! Vote_rcap 
saif
OUTPUT CONFUSION!! Vote_lcapOUTPUT CONFUSION!! Voting_barOUTPUT CONFUSION!! Vote_rcap 



Search if you can't find it here

OUTPUT CONFUSION!!

View previous topic View next topic Go down
Go to page : 1, 2  Next
AuthorMessage
jOhNy
Active member
Active member
jOhNy


OUTPUT CONFUSION!! Vide
PostSubject: OUTPUT CONFUSION!! OUTPUT CONFUSION!! EmptySat Jan 31, 2009 3:28 pm

hullo frndz... Cool
i hav a very intriguin ques which came in my prelims(they always come in our skul only!!)

Give the output:
int[]arr={2,4,6,8,10};
int x=1;
arr[x++]=++arr[x++]+arr[x++]:
for(int i=0;i<5;++i)
{
System.out.println(arr[i]);
}

my output-2 15 6 8 10
i think it's rite..everyone says itz wrong pale pale Mad Mad
so plzz help..
thnxx a lot. afro
Back to top Go down
jOhNy
Active member
Active member
jOhNy


OUTPUT CONFUSION!! Vide
PostSubject: Re: OUTPUT CONFUSION!! OUTPUT CONFUSION!! EmptyFri Feb 06, 2009 8:35 pm

someone plzz help!!
Back to top Go down
siya
Active member
Active member
siya


OUTPUT CONFUSION!! Vide
PostSubject: Re: OUTPUT CONFUSION!! OUTPUT CONFUSION!! EmptySun Feb 08, 2009 11:49 am

no......jony de answer is
2 15 7 8 10
Back to top Go down
jOhNy
Active member
Active member
jOhNy


OUTPUT CONFUSION!! Vide
PostSubject: Re: OUTPUT CONFUSION!! OUTPUT CONFUSION!! EmptySun Feb 08, 2009 5:04 pm

how come siya??
Back to top Go down
siya
Active member
Active member
siya


OUTPUT CONFUSION!! Vide
PostSubject: Re: OUTPUT CONFUSION!! OUTPUT CONFUSION!! EmptyMon Feb 09, 2009 12:37 am

see d diff. in ur answer n mine is only of 6 n 7 no.so i will tell u d reason.in 3rd line of d question,by ++arr[x++],d value of arr[2] is changed frm 6 to 7 bcoz of a prefix increment of d value of arr[2] on d whole.
Back to top Go down
monika

monika


OUTPUT CONFUSION!! Vide
PostSubject: Re: OUTPUT CONFUSION!! OUTPUT CONFUSION!! EmptyMon Feb 09, 2009 3:48 pm

ya siya's right
Wink
Back to top Go down
akshay
Active member
Active member



OUTPUT CONFUSION!! Vide
PostSubject: Re: OUTPUT CONFUSION!! OUTPUT CONFUSION!! EmptyFri Feb 13, 2009 8:42 am

hey guys the ans is :
15
7
8
10

1. output starts from 15 cause of ++i ( 'i' gets incremented before any sort of evaluation or execution)
2. the outputs dont not come in a row cause you've used the println statement which prints each output in a diff line
Back to top Go down
siya
Active member
Active member
siya


OUTPUT CONFUSION!! Vide
PostSubject: Re: OUTPUT CONFUSION!! OUTPUT CONFUSION!! EmptyFri Feb 13, 2009 1:01 pm

hey as_24!!!!!!check it on comp. d output is not ur answer yaar.i have checked it many times.u 2 check it!!!!!!!!!
Back to top Go down
siya
Active member
Active member
siya


OUTPUT CONFUSION!! Vide
PostSubject: Re: OUTPUT CONFUSION!! OUTPUT CONFUSION!! EmptySat Feb 14, 2009 1:30 pm

hey!!!!! ne1.plz....check it n confirm
Back to top Go down
akshay
Active member
Active member



OUTPUT CONFUSION!! Vide
PostSubject: Re: OUTPUT CONFUSION!! OUTPUT CONFUSION!! EmptySun Feb 15, 2009 2:38 am

sorry, my mistake=P
Back to top Go down
siya
Active member
Active member
siya


OUTPUT CONFUSION!! Vide
PostSubject: Re: OUTPUT CONFUSION!! OUTPUT CONFUSION!! EmptySun Feb 15, 2009 9:44 am

arre no,doesnt matter yaar.....its gud u checked it n now all doubts cleared...
Back to top Go down
jOhNy
Active member
Active member
jOhNy


OUTPUT CONFUSION!! Vide
PostSubject: Re: OUTPUT CONFUSION!! OUTPUT CONFUSION!! EmptyWed Feb 18, 2009 8:55 pm

nooo siya..all doubts r not cleared..i cheked it on the comp..im getting
2
15
7
9
10
wotsay?
Back to top Go down
siya
Active member
Active member
siya


OUTPUT CONFUSION!! Vide
PostSubject: Re: OUTPUT CONFUSION!! OUTPUT CONFUSION!! EmptyThu Feb 19, 2009 12:12 am

arre johny check it again.i have checked it 100 times n each time m gettin dis
2
15
7
8
10
n btw i have got d logic for my answer but cudnt get ne for urs.so plz. check it n confirm it....
Back to top Go down
siya
Active member
Active member
siya


OUTPUT CONFUSION!! Vide
PostSubject: Re: OUTPUT CONFUSION!! OUTPUT CONFUSION!! EmptyFri Feb 20, 2009 8:17 pm

hey!plz. ne body check dis n tell me d final answer!!i think johny sir has forgotten abt his prob. only
Back to top Go down
jOhNy
Active member
Active member
jOhNy


OUTPUT CONFUSION!! Vide
PostSubject: Re: OUTPUT CONFUSION!! OUTPUT CONFUSION!! EmptyFri Feb 20, 2009 8:20 pm

nono siya maam..i haven't 4gotten it...my bluej isn't working so i can't confirm it...
Back to top Go down
siya
Active member
Active member
siya


OUTPUT CONFUSION!! Vide
PostSubject: Re: OUTPUT CONFUSION!! OUTPUT CONFUSION!! EmptyFri Feb 20, 2009 8:22 pm

okk.. but m 100000000% dat my answer is correct.well nebody plllllz...confirm it...n johny u got a blueJ for ur comp. also in a pirated CD!!!!!!!!!!!!!!!!he he
Back to top Go down
jOhNy
Active member
Active member
jOhNy


OUTPUT CONFUSION!! Vide
PostSubject: Re: OUTPUT CONFUSION!! OUTPUT CONFUSION!! EmptyFri Feb 20, 2009 8:29 pm

arre babaa..pirated cdz ka bhoot sawar ho gya kya??mera toh bheja bhi pirated hai..hehee
Back to top Go down
Anu..i luv icse...:)
Active member
Active member
Anu..i luv icse...:)


OUTPUT CONFUSION!! Vide
PostSubject: Re: OUTPUT CONFUSION!! OUTPUT CONFUSION!! EmptyFri Feb 20, 2009 8:55 pm

hey...

i copy pasted this program...it is not working in my blueJ!!!!
Back to top Go down
Anu..i luv icse...:)
Active member
Active member
Anu..i luv icse...:)


OUTPUT CONFUSION!! Vide
PostSubject: Re: OUTPUT CONFUSION!! OUTPUT CONFUSION!! EmptyFri Feb 20, 2009 9:10 pm

int[]arr={2,4,6,8,10};
int x=1;
arr[x++]=++arr[x++]+arr[x++]:
for(int i=0;i<5;++i)
{
System.out.println(arr[i]);
}

i want to knw the correct solution...so, lets start step by step here itself, as this prog is not working in my blueJ!! Very Happy

x=1
so,
arr[x++]=arr[1]

++arr[x++]= ++arr[2] =++6=7 (am i right?)

+arr[x++]=arr[3]=8

so, the final answer is 7+8=15

is this right or wrong?
Back to top Go down
akshay
Active member
Active member



OUTPUT CONFUSION!! Vide
PostSubject: Re: OUTPUT CONFUSION!! OUTPUT CONFUSION!! EmptyFri Feb 20, 2009 9:20 pm

siya's right. i've also checked it
Back to top Go down
Anu..i luv icse...:)
Active member
Active member
Anu..i luv icse...:)


OUTPUT CONFUSION!! Vide
PostSubject: Re: OUTPUT CONFUSION!! OUTPUT CONFUSION!! EmptyFri Feb 20, 2009 9:23 pm

as_24...ok...but how is it done? i want explanation for the logic...i want to know how to solve it...thts y i asked whether my first step was right or wrong

btw...y doesnt it work in my blueJ? its giving: [ expected
Back to top Go down
siya
Active member
Active member
siya


OUTPUT CONFUSION!! Vide
PostSubject: Re: OUTPUT CONFUSION!! OUTPUT CONFUSION!! EmptyFri Feb 20, 2009 9:25 pm

hey anu see my previous post....dere i have xplained it!!
Back to top Go down
Anu..i luv icse...:)
Active member
Active member
Anu..i luv icse...:)


OUTPUT CONFUSION!! Vide
PostSubject: Re: OUTPUT CONFUSION!! OUTPUT CONFUSION!! EmptyFri Feb 20, 2009 9:27 pm

where yaar? i saw only ur answer...no explaination
Back to top Go down
akshay
Active member
Active member



OUTPUT CONFUSION!! Vide
PostSubject: Re: OUTPUT CONFUSION!! OUTPUT CONFUSION!! EmptyFri Feb 20, 2009 9:41 pm

here's the program:

int[]arr={2,4,6,8,10};
int x=1;
arr[x++]=++arr[x++]+arr[x++];
for(int i=0;i<5;++i)
{
System.out.println(arr[i]);
}

..and here's the working:

x=1
arr[1]=++arr[2]+arr[3];
=in subscript 1 of arr[] =7+8=15
thats the calculation.
++arr[2] increments the value in subscript 2 of arr[]. so 1 is added to 6 to get 7.
then under the 'for' construct values get printed on the output screen in order.so this is how the ouput goes:
2
15
7
8
10
Back to top Go down
Anu..i luv icse...:)
Active member
Active member
Anu..i luv icse...:)


OUTPUT CONFUSION!! Vide
PostSubject: Re: OUTPUT CONFUSION!! OUTPUT CONFUSION!! EmptySat Feb 21, 2009 1:14 am

frm where u got 2 in the first line?

i didnt understand Evil or Very Mad
Back to top Go down
Sponsored content




OUTPUT CONFUSION!! Vide
PostSubject: Re: OUTPUT CONFUSION!! OUTPUT CONFUSION!! Empty

Back to top Go down

OUTPUT CONFUSION!!

View previous topic View next topic Back to top
Page 1 of 2Go to page : 1, 2  Next

Permissions in this forum:You cannot reply to topics in this forum
Complete IIT AIEEE ICSE ISC PMT help forum :: Exam papers & Model test papers :: ICSE / ISC exam papers and model test papers-