Robert Half Assessment Test IT and Programming Concepts 4 — Questions and Answers
Question 1: What does 'polymorphism' mean in object-oriented programming?
- A class can only have one constructor
- Objects of different types can be treated through a shared interface, with each responding differently (Correct answer)
- Two classes cannot share the same method name
- A method must always return a value
Correct answer: Objects of different types can be treated through a shared interface, with each responding differently
Polymorphism allows different classes to be used interchangeably through a common interface, each implementing behavior in its own way.
Question 2: Which HTTP status code indicates a successful request?
- 404
- 500
- 301
- 200 (Correct answer)
Correct answer: 200
HTTP status code 200 (OK) means the request was successful and the server returned the expected response.
Question 3: What is the main advantage of using a virtual machine (VM)?
- It eliminates the need for a CPU
- It allows multiple isolated operating systems to run on one physical machine (Correct answer)
- It doubles the RAM available to applications
- It replaces the need for a network switch
Correct answer: It allows multiple isolated operating systems to run on one physical machine
VMs use a hypervisor to run multiple isolated OS instances on one physical host, improving resource utilization and flexibility.
Question 4: In CSS, what does the 'box model' describe?
- The 3D rendering of HTML elements
- The layout model that includes content, padding, border, and margin around elements (Correct answer)
- A JavaScript library for creating animations
- The process of loading web fonts
Correct answer: The layout model that includes content, padding, border, and margin around elements
The CSS box model defines how the content, padding, border, and margin of an element combine to determine its total size and spacing.
Question 5: What is a 'primary key' in a relational database?
- The first column in any table
- A unique identifier for each row in a table (Correct answer)
- The column with the largest data values
- A password used to access the database
Correct answer: A unique identifier for each row in a table
A primary key uniquely identifies each record in a table and cannot contain NULL values or duplicates.
Question 6: Which programming paradigm treats computation as the evaluation of mathematical functions and avoids changing state?
- Object-Oriented Programming
- Procedural Programming
- Functional Programming (Correct answer)
- Event-Driven Programming
Correct answer: Functional Programming
Functional programming emphasizes pure functions, immutability, and avoiding side effects, inspired by mathematical function evaluation.
Question 7: What does SSL/TLS provide in web communications?
- Faster page load times by compressing data
- Encrypted and authenticated communication between a client and server (Correct answer)
- Dynamic IP address assignment for web servers
- Automatic code minification for JavaScript files
Correct answer: Encrypted and authenticated communication between a client and server
SSL/TLS encrypts data in transit and authenticates the server's identity, enabling the HTTPS protocol used on secure websites.
What does 'polymorphism' mean in object-oriented programming?