• wonderlic tests
  • EXAM REVIEW
  • NCCCO Examination
  • Summary
  • Class notes
  • QUESTIONS & ANSWERS
  • NCLEX EXAM
  • Exam (elaborations)
  • Study guide
  • Latest nclex materials
  • HESI EXAMS
  • EXAMS AND CERTIFICATIONS
  • HESI ENTRANCE EXAM
  • ATI EXAM
  • NR AND NUR Exams
  • Gizmos
  • PORTAGE LEARNING
  • Ihuman Case Study
  • LETRS
  • NURS EXAM
  • NSG Exam
  • Testbanks
  • Vsim
  • Latest WGU
  • AQA PAPERS AND MARK SCHEME
  • DMV
  • WGU EXAM
  • exam bundles
  • Study Material
  • Study Notes
  • Test Prep

CIS 120 MIDTERM 1 ALGORITHMS & THEIR LIMITATIONS COMPREHENSIVE EXAM 2026 (Complete And Verified Study material) (13pages) LEARNEXAMS

exam bundles Sep 11, 2025
Preview Mode - Purchase to view full document
Loading...

Loading study material viewer...

Page 0 of 0

Document Text

1. Programming Concepts: Closures and Encapsulation (12 points) Multiple choice. For each question, mark all correct answers. There may be zero or more than one. a. What value is computed for ans by the following OCaml program? type ’a ref = { mutable contents : ’a } let x = {contents = 4} let f : int -> int = let x = {contents = 2} in fun (y:int) -> y + x.contents ;; x.contents <- 1 let ans = f x.contents Q 2 Q 3 Q 4 Q 5 b. After running the following OCaml program, the closure named f will contain value bindings for which identifiers? let a : int = 50 let f : int -> int = let b = 60 in fun (c:int) -> a + b + c Q a Q b Q c Q f c. Consider the (simplified) Pixel class given by the Java code below: class Pixel { public int[] rgb = {0, 0, 0}; public Pixel(int r, int g, int b) { rgb[0] = r; rgb[1] = g; rgb[2] = b; } public int[] getComponents() { return rgb; } } To properly encapsulate the state of Pixel objects, the programmer should:


Download Study Material

Buy This Study Material

$16.00
Buy Now
  • Immediate download after payment
  • Available in the pdf format
  • 100% satisfaction guarantee

Study Material Information

Category: exam bundles
Description:

CIS 120 MIDTERM 1 ALGORITHMS & THEIR LIMITATIONS COMPREHENSIVE EXAM 2026 (Complete And Verified Study material) (13pages) LEARNEXAMS

UNLOCK ACCESS $16.00