8 8 votes Consider the following program is pseudo-Pascal syntax program main; var x: integer; procedure Q (z: integer); begin z := z+x; writeln(z); end; procedure P (y: integer); var x: integer; begin x := y+2; Q(x); writeln(x); end begin x := 5; P(x); Q(x); writeln(x); end What is the output of the program when the parameter passing mechanism is call-by-value and the scope rule is static scoping? the parameter passing mechanism is call-by-reference and the scope rule is dynamic scoping? Programming in C gatecse-2000 programming parameter-passing normal out-of-gatecse-syllabus descriptive + – Kathleen 4.3k views answer comment Share Follow Print See all 2 Comments 2 2 Comments reply arch commented Apr 4, 2018 reply Follow flag can someone explain the part b how does it works. 0 0 replyShare P0535_Yedidyah_Sagar commented Oct 1, 2025 reply Follow flag This is not out of syllabus. Topic : Parameter Passing 0 0 replyShare Please log in or register to add a comment.
Best answer 10 10 votes A) Call By Value : 12 7 10 5 B) Call By Reference : 14 14 10 10 Aditya answered Sep 28, 2015 • edited Jan 13, 2016 by Arjun Aditya comment Share Follow See 1 comment 1 1 comment reply shikharV commented Jan 13, 2016 reply Follow flag Call by reference result should be: 14 14 10 10, because procedure P has its own local x which gets changed on calling it, there is no assignment of y therefore, it will not change the value of global x. 7 7 replyShare Please log in or register to add a comment.
2 2 votes COLL BY VALUE; 12,7,10,5 abhishekmehta4u answered Mar 23, 2019 • edited Mar 23, 2019 by abhishekmehta4u abhishekmehta4u comment Share Follow 0 reply Please log in or register to add a comment.
0 0 votes Similar Question Asked in 2003 but in c program language nirmal_aravind answered Sep 19, 2025 nirmal_aravind comment Share Follow 0 reply Please log in or register to add a comment.