CSE 3901 FINAL – RAILS PRACTICE
EXAMINATION 2026 QUESTIONS
WITH ANSWERS GRADED A+
◍ what happens when a variable is passed into a method?.
Answer: the method won't change the actual variable (it works with a copy
of the variable)-an instance method is needed to change the actual variable
◍ Activity.
Answer: an entry point into the application responsible for managing user
interaction with a screen of information
◍ the only things that should have recursive calls with while-loops inside
are....
Answer: certain types of parsers or things that navigate "general trees" not
binary trees
◍ Layout.
Answer: defines a set of UI objects and the objects' positions on the screen.
Made up of definitions written in XML. Each definition is used to create an
object that appears onscreen.
◍ ReverseDNS.
Answer: the package name convention, where the domain name of the
organization is reversed and suffixed with further identifiers. This keeps
package names unique and distinguishes applications from each other in the
google play store
◍ lateinit.
Answer: indicates to the compiler that you will provide a non-null value
before you attempt to use the contents of the property
,◍ Toast.
Answer: a short message that informs the user of something but does not
require input or action
◍ A hashing function must always return the same....
Answer: output value for a given input value
◍ R class.
Answer: during compilation, the build tools generate the R class that
contains the list of IDs as integer constants, allowing access to resources in
the application
◍ A hashing function must....
Answer: not have any preconditions
◍ Hashing functions may....
Answer: return negative values
◍ How does wiring up views work here before we introduce ViewBinding?.
Answer: Before ViewBinding, to wire up views we get the reference to the
inflated View objects and set listeners on those objects to respond to user
actions
◍ How does wiring up work using ViewBinding?.
Answer: We have to call inflate, passing in the layoutinflater and assigning
our binding to the value. Layout Inflater is responsible for inflating XML
layouts into UI elements. We also have to call setContentView with the
reference to the root UI element in the layout We can now add listeners to
the elements within the bindingCode:binding =
ActivityMainBinding.inflate(layoutInflater)setContentView(binding.root)
◍ define px, dp, sp, mm, in,.....
Answer: px - stands for pixel. A unit of screen space. Does not scale
properly for different display densities, not recommendedDp -
density-independent pixel, used for margins, padding, or anything else with
a specific pixel value. Scales with the screen sizeSp - scale-independent
pixel, density independent pixels that take into account font size
, preferences. We use these for text sizept, mm, in - scaled units that have
specific sizes, not recommended
◍ Activity lifecycle table.
Answer: Columns = {In memory?, visible to user?, in
foreground?}Nonexistent - no, no, nocreated - yes, no, nostarted - yes,
yes/partially, noresumed - yes, yes, yes
◍ When a hashing algorithm is applied to a map....
Answer: hash the keys, NOT the values
◍ Stages of lifecycle explained.
Answer: Nonexistent - app has not been launched yet, or app was destroyed.
There is no instance in memoryCreated - represents an activity that has an
instance in memory but is not visible on screen. Occurs when the app first
renders and when the view is fully out of viewStarted - represents an activity
that has lost focus but whose view is visible or partially visible. For
instance, if there was a transparent activity on top or if in multi window
modeResumed - represents an activity that is in memory, fully visible, and
in the foreground. The user interacts with this state
◍ Given a non-empty heap with all distinct integer entries and total preorder ≤,
the smallest element is at the root. The largest element....
Answer: has to be a leaf node.
◍ In a non-empty binary search tree with all distinct integer entries and total
preorder ≤, the node of the largest element....
Answer: has no right child
◍ Rotation and the activity lifecycle.
Answer: Activities are destroyed and recreated on configuration changes,
such as rotation. That is why we need to store data in a viewmodel which
has a simpler lifecycle, so it persists on configuration changes.
◍ Create log functions using logcat to monitor the activity lifecycle.
Answer: private const val TAG = "ActivityName"Log.d(TAG, "msg")We
can use $ to pull in a specific valuewe can override the lifecycle functions
EXAMINATION 2026 QUESTIONS
WITH ANSWERS GRADED A+
◍ what happens when a variable is passed into a method?.
Answer: the method won't change the actual variable (it works with a copy
of the variable)-an instance method is needed to change the actual variable
◍ Activity.
Answer: an entry point into the application responsible for managing user
interaction with a screen of information
◍ the only things that should have recursive calls with while-loops inside
are....
Answer: certain types of parsers or things that navigate "general trees" not
binary trees
◍ Layout.
Answer: defines a set of UI objects and the objects' positions on the screen.
Made up of definitions written in XML. Each definition is used to create an
object that appears onscreen.
◍ ReverseDNS.
Answer: the package name convention, where the domain name of the
organization is reversed and suffixed with further identifiers. This keeps
package names unique and distinguishes applications from each other in the
google play store
◍ lateinit.
Answer: indicates to the compiler that you will provide a non-null value
before you attempt to use the contents of the property
,◍ Toast.
Answer: a short message that informs the user of something but does not
require input or action
◍ A hashing function must always return the same....
Answer: output value for a given input value
◍ R class.
Answer: during compilation, the build tools generate the R class that
contains the list of IDs as integer constants, allowing access to resources in
the application
◍ A hashing function must....
Answer: not have any preconditions
◍ Hashing functions may....
Answer: return negative values
◍ How does wiring up views work here before we introduce ViewBinding?.
Answer: Before ViewBinding, to wire up views we get the reference to the
inflated View objects and set listeners on those objects to respond to user
actions
◍ How does wiring up work using ViewBinding?.
Answer: We have to call inflate, passing in the layoutinflater and assigning
our binding to the value. Layout Inflater is responsible for inflating XML
layouts into UI elements. We also have to call setContentView with the
reference to the root UI element in the layout We can now add listeners to
the elements within the bindingCode:binding =
ActivityMainBinding.inflate(layoutInflater)setContentView(binding.root)
◍ define px, dp, sp, mm, in,.....
Answer: px - stands for pixel. A unit of screen space. Does not scale
properly for different display densities, not recommendedDp -
density-independent pixel, used for margins, padding, or anything else with
a specific pixel value. Scales with the screen sizeSp - scale-independent
pixel, density independent pixels that take into account font size
, preferences. We use these for text sizept, mm, in - scaled units that have
specific sizes, not recommended
◍ Activity lifecycle table.
Answer: Columns = {In memory?, visible to user?, in
foreground?}Nonexistent - no, no, nocreated - yes, no, nostarted - yes,
yes/partially, noresumed - yes, yes, yes
◍ When a hashing algorithm is applied to a map....
Answer: hash the keys, NOT the values
◍ Stages of lifecycle explained.
Answer: Nonexistent - app has not been launched yet, or app was destroyed.
There is no instance in memoryCreated - represents an activity that has an
instance in memory but is not visible on screen. Occurs when the app first
renders and when the view is fully out of viewStarted - represents an activity
that has lost focus but whose view is visible or partially visible. For
instance, if there was a transparent activity on top or if in multi window
modeResumed - represents an activity that is in memory, fully visible, and
in the foreground. The user interacts with this state
◍ Given a non-empty heap with all distinct integer entries and total preorder ≤,
the smallest element is at the root. The largest element....
Answer: has to be a leaf node.
◍ In a non-empty binary search tree with all distinct integer entries and total
preorder ≤, the node of the largest element....
Answer: has no right child
◍ Rotation and the activity lifecycle.
Answer: Activities are destroyed and recreated on configuration changes,
such as rotation. That is why we need to store data in a viewmodel which
has a simpler lifecycle, so it persists on configuration changes.
◍ Create log functions using logcat to monitor the activity lifecycle.
Answer: private const val TAG = "ActivityName"Log.d(TAG, "msg")We
can use $ to pull in a specific valuewe can override the lifecycle functions