Active TopicsActive Topics  Display List of Forum MembersMemberlist  CalendarCalendar  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
 One Stop GATE ForumGATE AT A GLANCETest Series
Message Icon Topic: IT TEST ID:03 Post Reply Post New Topic



Post Resume: Click here to Upload your Resume & Apply for Jobs

Author Message
balu
Senior Member
Senior Member


Joined: 20Feb2007
Online Status: Offline
Posts: 236
Quote balu Replybullet Topic: IT TEST ID:03
    Posted: 23Feb2007 at 1:03pm
 
48. What is printed by the print statements in the program P1, assuming call-by-reference parameter passing?

Program P1()
{
X=10,y=3;
func1(y,x,x);
print x;
print y;
}

func(x,y,z)
{
y=y+4;
z=x+y+z;
}

56. Quick sort is run on two inputs below to sort in ascending order

(i) 1,2,3,………n
(ii) n,n-1,…….2,1

Let C1 and C2 be the number of camparsions made for the input (i) and (ii) repectively. Then,

I have doubt in the answers of these questions.....

Can anybody help me plz...
IP IP Logged
manju
Senior Member
Senior Member


Joined: 20Feb2007
Online Status: Offline
Posts: 221
Quote manju Replybullet Posted: 23Feb2007 at 1:05pm
 for 1st question, ans 31,3!!!

Actual value of Y is untouched and modification is on X only,

As it is a pass by reference,

y= y+4 (this makes X =14,since pass by ref. z value is also changed to 14)

z=x+y+z(this means 3+14+14 = 31)
IP IP Logged
vukkusila_ravi
Newbie
Newbie


Joined: 20Jul2007
Location: India
Online Status: Offline
Posts: 1
Quote vukkusila_ravi Replybullet Posted: 31Jul2007 at 1:37am
the answer for ur question is c1=c2 because
both takes same time complexity l.e., O(n2).
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum

GET LATEST FRESHERS JOBS IN YOUR MAIL





This page was generated in 1.938 seconds.
Vyom is an ISO 9001:2000 Certified Organization

© Vyom Technosoft Pvt. Ltd. All Rights Reserved.

Job Interview Questions | Girls Magazine | DLL, OCX File Errors | Freshers Jobs | Placement Papers | More Papers