Exercises
Explore how Python, Ruby, Java, and C handle function and method parameters. This quiz examines pass-by-value semantics, shared object references, mutation, reassignment, C pointers, array parameters, keyword arguments, and variadic positional parameters. Questions range from basic syntax to practical code tracing and comparisons among the four languages.
Answer the questions below and check the explanation for each answer.
0/6 answered
Auto audio on: the next questions will be read aloud when you click Continue.
The parameter and numbers refer to the same mutable list. Calling append changes that list, so the caller observes [1, 2, 3].
Java passes the value of a primitive argument to the method. Incrementing the parameter changes only the method's local copy, so the caller's score remains 7.
The function must receive the variables' addresses. Parameters of type int * let it dereference those addresses and modify the caller's variables.
Assigning a different object to the local parameter s does not reassign the caller's variable. Therefore, name still refers to the string old.
The copied reference initially points to the caller's Box, so setting its field to 9 is visible. Reassigning the local parameter afterward does not redirect the caller's reference.
In a function parameter, int data[] is adjusted to int *data. Consequently, sizeof(data) measures the pointer, not the caller's array.
Video Courses
recommended
recommended
Advanced
Advanced
Advanced
Ideal for beginners
Ideal for beginners
Thousands of online courses in video, ebooks and audiobooks.
To test your knowledge during online courses
Generated directly from your cell phone's photo gallery and sent to your email
Download our app via QR Code or the links below:.
+ 10 million
students
Free and Valid
Certificate
60 thousand free
exercises
4.8/5 rating in
app stores
Free courses in
video and ebooks