WorksheetsICT CBP Q3 Test Einstein 2026
Total questions: 53
Worksheet time: 32mins
Users mistype their email addresses. What's an effective solution?
Allow registration despite email format errors.
JavaScript validation for common mistakes.
Provide the 'Confirm Email' field.
Use HTML5 email input.
You're creating a registration form for a website. Users must provide a username, password, and email. What's the best approach to ensure validation? Use _______________ validation only.
Combined HTML5 and JavaScript
HTML5
JavaScript
Server-side and Client-side
In JavaScript, how do you access the value of an input element with the id 'username'?
document.getElementByClass('username').value
document.getElementById('username').value
document.getElementByName('username').value
document.querySelector('#username').value
The feedback form requires ratings, but some users submit it without rating. How do you enforce it?
Allow without rating.
Keep rating optional.
Set default rating.
Use JavaScript validation.
Users input invalid birthdates below age 13 in the registration form. How to ensure compliance?
Allow registration regardless.
Implement JavaScript age check.
Prompt age confirmation.
Use HTML5 date input.
Which JavaScript method is often used to validate if a checkbox is checked in a form?
document.getElementById()
document.querySelector()
isCheckboxChecked()
isChecked()
You need to ensure that users do not leave the username field empty. Which of the following JavaScript syntaxes would you use to validate if the username input is not null or undefined?
if (username != null)
if (username !== null)
if (username == null)
if (username === null)
Implementing form validation for sensitive data, what's a critical security measure?
Disabling validation.
Random number generator for validation.
Using plain text storage.
Validating client-side and server-side.
You're validating a textarea input field to ensure it contains only alphanumeric characters (a-z, A-Z, 0-9) and spaces. Which JavaScript code snippet provides the most effective validation?
if (textarea === isNaN(textarea)) { /* Validation logic */ }
if (textarea.includes('!@#$%^&*()')) { /* Validation logic */ }
if (textarea.indexOf('!@#$%^&*()') === -1) { /* Validation logic */ }
if (textarea.match(/^[a-zA-Z0-9 ]+$/)) { /* Validation logic */ }
You're validating a password input field to ensure it contains at least one special character (!@#$%^&*). Which JavaScript code snippet provides the most effective validation?
if (password === isNaN(password)) { /* Validation logic */ }
if (password.includes('!@#$%^&*')) { /* Validation logic */ }
if (password.indexOf('!@#$%^&*') !== -1) { /* Validation logic */ }
if (password.match(/[!@#$%^&*]/)) { /* Validation logic */ }
When validating an email input field using JavaScript, which code snippet demonstrates the most effective approach?
if (email === 'email@example.com') { /* Validation logic */ }
if (email.includes('@')) { /* Validation logic */ }
if (email.indexOf('@') !== -1) { /* Validation logic */ }
if (email.match(/\S+@\S+\.\S+/)) { /* Validation logic */ }
You're developing a drawing application using Canvas and want to allow users to change the color of the drawing brush. Which event listener should you use to detect color selection changes from a color picker input element?
onchange
onclick
onmouseover
onsubmit
You're developing a game using JavaScript Canvas and need to detect collision between two game objects. Which is needed to continuously monitor this?
addEventListener
oncollision
oncollisioncheck
onmousemove
Mr. Racab is creating a canvas-based application that needs to respond to touch events on touch-enabled devices. Which event should he handle to capture touch interactions?
onpinch
onswipe
ontouch
ontouchstart
When working with JavaScript Canvas, which method obtains the drawing context?
canvasContext()
drawContext()
getCanvas()
getContext()
You're implementing an undo feature in your canvas drawing application and must store previous drawing states. Which data structure is suitable for storing a history of drawing actions?
Array
Object
Set
Map
You're building a canvas-based application and want to draw text on the canvas. Which method should you use to set the font style and size?
ctx.font
ctx.fontStyle()
ctx.setFont()
ctx.setFontStyle()
A web application needs to capture mouse clicks within the canvas area. Which event listener should you use to achieve this?
canvas.addEventListener('click', function(event) { // Handle click event });
canvas.addEventListener('mousedown', function(event) { // Handle click event });
canvas.onclick = function(event) { // Handle click event };
document.addEventListener('click', function(event) { // Handle click event });
Which of the following statements about JavaScript events is true?
Events are actions that occur within the browser or document.
Events can only be triggered by user interactions.
Events can only be handled using inline event handlers.
Events are not relevant in JavaScript programming.
What is the purpose of an event listener in JavaScript?
To handle events asynchronously
To trigger events manually
To execute code when a specific event occurs
To stop event propagation
Which of the following is NOT a valid way to declare a function in JavaScript?
function myFunction() {}
const myFunction = function() {}
myFunction: function() {}
() => {}
In a web application's shopping cart feature, items are stored as elements in an array. Which method would you use to remove the last item added to the cart?
slice()
pop()
shift()
ctrl()
You're tasked with creating an animated banner for a website. Which JavaScript method would you use to ensure smooth animation transitions?
console.log()
setTimeout()
document.createElement()
addEventListener()
While developing an online game, you need to animate the movement of characters. Which technique would you employ to achieve this?
CSS animations
SVG animations
Canvas animations
Text animations
You're designing a user authentication system for a website. What operator in JavaScript would you use to verify both the username and password before granting access?
&&
||
!
=
Which JavaScript method is commonly used to change the position of an HTML element over time to create animation effects?
setTimeout()
addEventListener()
document.createElement()
animate()
Which CSS property is commonly used to specify the duration of an animation in JavaScript?
color
font-size
opacity
animation-duration
In JavaScript animation, what is the purpose of the easing function?
To define the starting position of an animation
To handle user input events
To specify the speed curve of an animation
To determine the ending state of an animation
Which JavaScript event is commonly used to trigger animations based on user interactions such as mouse clicks or keyboard inputs?
mouseover
keydown
scroll
click
You're developing an animation-heavy website and need to optimize performance. Which approach would be most effective for improving animation smoothness and reducing resource consumption?
Use CSS transitions for animation effects
Utilize the requestAnimationFrame() method for animation loops
Implement setInterval() for precise timing control
Apply jQuery animations for cross-browser compatibility
You're debugging an animation code that's causing performance issues. Which tool or method would you use to identify and resolve the performance bottleneck?
Insert console.log() statements to trace code execution
Utilize browser developer tools to profile JavaScript performance
Apply try-catch blocks to handle potential errors
Implement alert() dialogs to debug code logic
Suppose you encounter a situation where an animation on your webpage is causing layout thrashing and impacting performance. How would you diagnose and address this issue?
Increase the frame rate of the animation
Reduce the number of animated elements
Apply hardware acceleration to the animated elements
Apply a debounce function to the animation function
You're developing an animation that involves changing an element's position over time. Which CSS property would you manipulate to achieve this effect efficiently?
opacity
transform
width
margin
How would you handle game state persistence in a JavaScript game to allow players to continue their progress across sessions?
Store game state in browser cookies.
Utilize web storage APIs such as localStorage or sessionStorage.
Write game state to a server-side database.
Implement a custom JavaScript function to save game state.
How would you implement sound effects in a JavaScript game?
Use the HTML
Embed sound files directly in the JavaScript code
Utilize the console.log() method to play sounds
Include sound files as background music in the CSS
How would you implement a scoring system in a JavaScript game?
Use global variables to track the score.
Update the DOM directly with the current score.
Store the score in a local storage.
Utilize an object to manage the game state including the score.
You're developing a JavaScript game, and the player complains that jumping feels very slow. How would you address this issue?
Add more obstacles to distract the player from the jumping mechanic.
Increase the gravitational force acting on the player character.
Implement a smoother animation transition for the jumping action.
Decrease the friction coefficient between the player character and the ground.
You're tasked with declaring a variable in JavaScript to store the player's current score in a game. Which variable declaration approach would you choose considering the score should not be modified once initialized?
let score = 0;
const score = 0;
var score = 0;
int score = 0;
Mr. Skyler is creating a JavaScript object to represent a player character in his game. Which syntax should he use to define this object with properties for 'name' and 'score'?
{name, score}
{name: 'John', score: 100}
['name', 'score']
(name, score)
In your game code, you need to add a new element to an array and get the updated length of the array. Which JavaScript method should you use for this task?
push()
pop()
shift()
unshift()
You're implementing a scoring system in your JavaScript game, where players earn points by completing objectives and defeating enemies. How would you design the scoring mechanism to reward player skill and encourage replayability?
Assign a fixed number of points to each objective regardless of difficulty.
Use dynamic scoring based on player performance and the level of challenge.
Provide bonus points for completing objectives within a time limit.
Remove scoring altogether to focus solely on gameplay experience.
Your JavaScript game relies heavily on keyboard input for player controls. How would you ensure that the game remains playable even on devices without physical keyboards, such as smartphones and tablets?
Provide alternative on-screen touch controls for essential gameplay actions.
Require players to connect external keyboards to access all game features.
Implement voice recognition technology for controlling the game.
Limit gameplay to devices with physical keyboards only.
Your JavaScript game features social features such as player profiles and leaderboards. How would you ensure data privacy and security for player accounts and sensitive information stored on your game servers?
Store player data in plaintext format to simplify access and retrieval
Encrypt sensitive player information using industry-standard encryption algorithms
Require players to share personal information publicly for social features
Implement a public API for third-party developers to access player data directly
You're designing a JavaScript game that supports multiple languages to cater to an international audience. How would you approach implementing language localization to ensure all players can enjoy the game in their preferred language?
Provide a single language option based on the user's device settings
Automatically detect the user's language based on their IP address
Allow players to manually select their preferred language from a settings menu
Require players to install additional language packs for each supported language
Your team is developing a new JavaScript component for a web application. Before integrating it into the main codebase, you want to ensure each function and method works correctly in isolation. What testing approach should you employ to solve this?
Unit testing
Integration testing
End-to-end testing
Acceptance testing
Your JavaScript game is nearly complete, but you notice that some components are not interacting properly. How would you ensure that all components function correctly and interact seamlessly within the game?
Implement unit testing to verify the functionality of individual components.
Seek feedback from users to identify any issues with component interaction.
Modify the game's design to eliminate the need for component interaction.
Skip testing and proceed with game deployment to meet deadlines.
You're testing a JavaScript function by providing inputs and observing the outputs, without considering the internal implementation details. What type of testing technique are you using?
Debugging
Manual testing
Black box testing
Unit testing
You're testing a complex JavaScript application by examining the code structure, control flow, and data flow within the program. What type of testing technique is this?
White box testing
User testing
Manual testing
Debugging
Users struggle to update their profiles in your JavaScript application. How would you address this issue?
Analyze the codebase for profile management issues.
Conduct user testing sessions to observe interactions and gather feedback.
Skip testing and assume users will adapt.
Debug the application's code.
Users have reported that your JavaScript application crashes unexpectedly when they perform certain actions. How would you address this issue through manual testing?
Ignore user reports and assume the crashes are isolated incidents.
Conduct user testing sessions to replicate the reported crashes.
Skip testing and deploy the application to let the issue resolve itself.
Analyze the codebase for potential bugs causing the crashes.
LAST NAME, FIRSTNAME
"Evaluate your knowledge and ability in using JavaScript on a scale from 1 to 5. A score of 5 shows strong competence, while a score of 1 indicates the need for further study."
"Evaluate your Project Game creation on a scale from 1 to 5. A score of 5 means your project is highly creative, complete, and shows strong skills. A score of 1 means your project needs major improvement and further work."
