What is the difference between Call by value and Call by reference?

1 Answer

Answer :

A: Call By Value : When a function is called by value, then the value of the actual parameter is copied to the formal parameter (i.e. a separate copy is made). Any changes made with the values of the formal parameter does not affect (change) the actual parameter.

Call By Reference : When a function is called by reference, then the reference(address) of the actual parameter is sent to the formal parameter. Any changes made with the values at that address of the formal parameter affects (changes) the value of the actual parameter.

Related questions

Description : A ……………. takes a reference to an object of the same class as itself as an argument. A) Reference constructor B) Copy Constructor C) Self Constructor

Last Answer : B) Copy Constructor

Description : Automatic initialization of object is carried out using a special member function called ………… A) Friend B) Casting C) Reference Parameter D) Constructor

Last Answer : D) Constructor

Description : Which of the following cannot be passed to a function? A) Reference variable B) Arrays C) Class objects D) Header files

Last Answer : D) Header files

Description : With ................ a page is brought into main memory only when the reference is made to a location on that page. A) demand paging B) main paging C) prepaging D) postpaging

Last Answer : A) demand paging

Description : State True or False. 1. Term of reference is the final output of Feasibility Study 2. Design specification report is the final output of System Analysis A) 1-true, 2-true B) 1-false, 2-true C) 1-true, 2-false D) 1-false, 2-false

Last Answer : A) 1-true, 2-true

Description : The output of problem definition stage is …………….. A) Master Development Plan B) Terms of reference C) Feasibility report D) Final product

Last Answer : B) Terms of reference

Description : Arrays in C language can have ................. with reference to memory representation. (A) n-subscripts (B) two-subscripts (C) only one subscript (D) three subscripts only

Last Answer : (C) only one subscript 

Description : Which of the following points lies on the same side as the origin, with reference to the line 3x+7y=2 ? (A) (3, 0) (B) (1, 0) (C) (0.5, 0.5) (D) (0.5, 0)

Last Answer : (D) (0.5, 0) Explanation: If (0.5, 0) is substituted in the equation, we get 1.5 which is less than 2, then it lies on the same side as that of the origin. 

Description : Which layer of OSI reference model is responsible for decomposition of messages and generation of sequence numbers to ensure correct re-composition from end to end of the network? (A) Physical (B) Data-link (C) Transport (D) Application

Last Answer : (C) Transport 

Description : Which layers of the OSI reference model are host-to-host layers ? (A) Transport, Session, Presentation, Application (B) Network, Transport, Session, Presentation (C) Data-link, Network, Transport, Session (D) Physical, Data-link, Network, Transport

Last Answer : (A) Transport, Session, Presentation, Application

Description : The advantage of ............... is that it can reference memory without paying the price of having a full memory address in the instruction. (A) Direct addressing (B) Indexed addressing (C) Register addressing (D) Register Indirect addressing

Last Answer : (D) Register Indirect addressing

Description : Consider a program that consists of 8 pages (from 0 to 7) and we have 4 page frames in the physical memory for the pages. The page reference string is :  1 2 3 2 5 6 3 4 6 3 7 3 1 5 3 6 3 4 2 4 3 4 5 ... to fill available page frames with pages): (A) 9 and 6 (B) 10 and 7 (C) 9 and 7 (D) 10 and 6

Last Answer : (B) 10 and 7

Description : In XML, DOCTYPE declaration specifies to include a reference to ............ file. (A) Document Type Definition (B) Document Type Declaration (C) Document Transfer Definition (D) Document Type language

Last Answer : (A) Document Type Definition

Description : Which of the following is not valid with reference to Message Passing Interface (MPI)? (A) MPI can run on any hardware platform (B) The programming model is a distributed memory model. (C) All ... implicit. (D) MPI - Comm - Size returns the total number of MPI processes in specified communication.

Last Answer : (C) All parallelism is implicit.

Description : A LRU page replacement is used with four page frames and eight pages. How many page faults will occur with the reference string 0172327103 if the four frames are initially empty? (A) 6 (B) 7 (C) 5 (D) 8

Last Answer : (B) 7

Description : Which of the following is/are correct with reference to Abstract class and interface ? (a) A class can inherit only one Abstract class but may inherit several interfaces. (b) An Abstract class can provide complete and default ... true (C) Both (a) and (b) are true (D) Neither (a) nor (b) is true

Last Answer : Answer: C

Description : Which of the following statements are true with reference to the way of describing XML data ? (a) XML uses DTD to describe the data (b) XML uses XSL to describe the data (c) XML uses a description node to describe the data Codes : (A) (a) only (B) (b) only (C) (a) and (b) (D) (a) and (c)

Last Answer : Answer: D

Description : A software program that infers and manipulates existing knowledge in order to generate new knowledge is known as: (A) Data Dictionary (B) Reference Mechanism (C) Inference Engine (D) Control Strategy

Last Answer : (C) Inference Engine

Description : Which of the following statement is not correct with reference to cron daemon in UNIX O.S? (A) The cron daemon is the standard tool for running commands on a predetermined schedule. (B) It starts ... command lines and the times at which they invoked. (D) Crontab for individual users are not stored.

Last Answer : (D) Crontab for individual users are not stored.

Description : Which of the following option with reference to UNIX operating system is not correct? (A) INT signal is sent by the terminal driver when one types and it is a request to terminate the current operation. ( ... that it defaults to producing a core dump if not caught. (D) KILL is a blockable signal.

Last Answer : (D) KILL is a blockable signal.

Description : When one object reference variable is assigned to another object reference variable then (A) a copy of the object is created. (B) a copy of the reference is created. (C) a copy of the ... not created. (D) it is illegal to assign one object reference variable to another object reference variable.

Last Answer : (B) a copy of the reference is created.

Description : Which of the following statement(s) is/are correct with reference to curve generation? I. Hermite curves are generated using the concepts of interpolation. II. Bezier curves are generated using the concepts of approximation. III. The ... (B) II and III only (C) I and II only (D) I, II and III only

Last Answer : (D) I, II and III only

Description : Suppose there are four processes in execution with 12 instances of a Resource R in a system. The maximum need of each process and current allocation are given below: With reference to current allocation, is system safe? If so, ... B) Yes, P1 P2 P3 P4 (C) Yes, P4 P3 P1 P2 (D) Yes, P2 P1 P3 P4

Last Answer : (C) Yes, P4 P3 P1 P2

Description : Consider the reference string 0 1 2 3 0 1 4 0 1 2 3 4 If FIFO page replacement algorithm is used, then the number of page faults with three page frames and four page frames are .......... and ........... respectively. (A) 10, 9 (B) 9, 9 (C) 10, 10 (D) 9, 10

Last Answer : (D) 9, 10

Description : In TCP/IP Reference model, the job of ............... layer is to permit hosts to inject packets into any network and travel them independently to the destination. (A) Physical (B) Transport (C) Application (D) Host-to-network

Last Answer : Answer: Marks to all

Description : Suppose that the virtual Address space has eight pages and physical memory with four page frames. If LRU page replacement algorithm is used, .............. number of page faults occur with the reference string. 0 2 1 3 5 4 6 3 7 4 7 3 3 5 5 3 1 1 1 7 2 3 4 1 (A) 11 (B) 12 (C) 10 (D) 9

Last Answer : (A) 11

Description : Which of the following operators cannot be overloaded in C/C++? (1) Bitwise right shift assignment (2) Address of (3) Indirection (4) Structure reference

Last Answer : Answer: 4

Description : What is function? What is call by value? What is call by reference? What is the difference between them?

Last Answer : Function: A function is a group/set of statements/instruction that performs a specific task. It can be system defined i.e. clrscr(), getch(), or user defined i.e. add(), sub(). ... reflected inside as well as outside the function. Difference between Call by Value and Call by Reference:

Description : What is call by value and call by reference?

Last Answer : PASSING PARAMETERS TO FUNCTIONS : The called function receives the information from the calling function through the parameters. The variables used while invoking the calling function are called actual parameters and the variables used in the ... *b) { int temp; temp=*a; *a=*b; *b=temp; }

Description : Distinguish between call by value and call by reference.

Last Answer : Call by value Call by reference   A copy of actual arguments is passed to respective formal arguments.   The address of actual arguments is passed to formal arguments Actual ... is not reflected in other functions  Changes made in the function is reflected outside also.  

Description : Differentiate between call by value and call by reference method.

Last Answer : Call by Value Call by reference In call by value, a copy of actual arguments is passed to respective formal arguments. In call by reference, the location, that is, the address of actual arguments is ... ;a,&b); //function call void swap(int *a,int *b)// function definition { }

Description : Which method will a web browser call on a new applet? A) main method B) destroy method C) execute method D) init method

Last Answer : D) init method

Description : Native – protocol pure Java converts ……….. into the ………… used by DBMSs directly. A) JDBC calls, network protocol B) ODBC class, network protocol C) ODBC class, user call D) JDBC calls, user call

Last Answer : A) JDBC calls, network protocol

Description : Match the following mechanisms for interrupting the execution of a process and their uses. i) Interrupt a) Call to an operating system function ii) Trap b) Reaction to an asynchronous external event iii) Supervisor Call c) Handling of a error ... -a, iii-b C) i-b, ii-c, iii-a D) i-a, ii-c, iii-b

Last Answer : C) i-b, ii-c, iii-a

Description : Which one of the following is a correct implementation of the metapredicate “not” in PROLOG (Here G represents a goal) ? (A) not(G):– !, call(G), fail. not(G). (B) not(G):– call(G), !, fail. not(G). (C) not(G):– call(G), fail, !. not(G). (D) not(G):– call(G), fail. not(G):– !.

Last Answer : (B) not(G):– call(G), !, fail. not(G).

Description : Which statement is not true about process 0 in the Unix operating system? (A) Process 0 is called init process. (B) Process 0 is not created by fork system call. (C) After forking process 1, process 0 becomes swapper process. (D) Process 0 is a special process created when system boots.

Last Answer : (A) Process 0 is called init process.

Description : FAN IN of a component A is defined as (A) Number of components that can call or pass control to component A. (B) Number of components that are called by component A. (C) Number of components related to component A. (D) Number of components dependent on component A.

Last Answer : (A) Number of components that can call or pass control to component A.

Description : The RST 7 instruction in 8085 microprocessor is equivalent to: (A) CALL 0010 H (B) CALL 0034 H (C) CALL 0038 H (D) CALL 003C H

Last Answer : (C) CALL 0038 H

Description : The Unix Kernel maintains two key data structures related to processes, the process table and the user structure. Which of following information is not the part of user structure? (A) File descriptor table (B) System call state (C) Scheduling parameters (D) Kernel stack

Last Answer : (C) Scheduling parameters

Description : Suppose that the time to do a null remote procedure call (RPC) (i.e, 0 data bytes) is 1.0 msec, with an additional 1.5 msec for every 1K of data. How long does it take to read 32 K from the file server as 32 1K RPCs? (A) 49 msec (B) 80 msec (C) 48 msec (D) 100 msec

Last Answer : (B) 80 msec

Description : In UNIX operating system, when a process creates a new process using the fork() system call, which of the following state is shared between the parent process and child process? (A) Heap (B) Stack (C) Shared memory segments (D) Both Heap and Stack

Last Answer : (C) Shared memory segments 

Description : One of the disadvantages of user level threads compared to Kernel level threads is (1) If a user level thread of a process executes a system call, all threads in that process are ... privileges. (4) The library procedures invoked for thread management in user level threads are local procedures.

Last Answer : If a user level thread of a process executes a system call, all threads in that process are blocked.

Description : Methods can be overloaded with a difference only in the type of the return value .. A) Not supported B) False C) True D) None of the above

Last Answer : B) False

Description : A tree with n vertices is called graceful, if its vertices can be labelled with integers 1, 2, ...,n such that the absolute value of the difference of the labels of adjacent vertices are all different. Which of the following trees are ... (B) (b) and (c) (C) (a) and (c) (D) (a), (b) and (c)

Last Answer : Answer: D

Description : If a variable is declared final, it must include ...................... value. A) integer B) no C) initial D) float

Last Answer : C) initial

Description : Using which keyword we can access value of the instance variables and class variables of that class inside the method of that class itself. A) super B) final C) this D) either super or this

Last Answer : C) this

Description : The ....................... looks only for a match between the value of the expression and one of its case constants. A) if B) match C) switch D) None of the above

Last Answer : C) switch

Description : State True or False. i) While overloading operators new operator can be overloaded. ii) The binary operator such as +, -, * and must explicitly return a value. A) True, True B) True, False C) False, True D) False, False

Last Answer : C) False, True

Description : State True or False i) A destructor never takes any argument nor does it return any value. ii) It releases memory space for future use. A) True, True B) True, False C) False, True D) False, False

Last Answer : A) True, True