2 Hassan is testing his JavaScript. He has a variable named 'score' set to 10. He wants to increase the score by 5. Which line of code should he write? A score + 5; B score =+ 5; C score += 5; D score++ 5;
3 Hina is writing JavaScript. She wants to convert a string '123' into a number. Which function should she use? A Number('123') B parseInt('123') C parseFloat('123') D All of the above
4 What does HTML stand for? A Hyper Text Markup Language B High-Level Text Machine Language C Hyperlink and Text Markup Language D Home Tool Markup Language
5 Usman is learning about JavaScript events. He wants to run a function when a user clicks a button. Which event should he use? A onmouseover B onchange C onclick D onload
6 Leo is writing JavaScript. He needs to check if a user's age is 18 or older. He writes an if statement. Which condition should Leo use inside the parentheses? A age = 18 B age >= 18 C age > 18 D age == 18
8 Farhan is creating a dynamic website. He wants a button that shows an alert message when clicked. He is using JavaScript. Which JavaScript method should Farhan use to display a pop-up message? A console.log() B document.write() C alert() D prompt()
10 What is programming? A Designing pictures B Writing instructions for a computer C Using the internet D Typing documents
11 Aisha is creating a link that opens in a new tab. She knows she needs to add an attribute to the <a> tag. Which attribute should she use? A target="_blank" B target="_new" C newtab="true" D open="new"
12 Emma is writing a CSS rule to center the text inside a div. She tries several properties. Which CSS property should Emma use to horizontally center the text content? A align: center B text-align: center C margin: auto D vertical-align: middle
13 Which of the following is primarily a client-side scripting language used to make web pages interactive? A Python B PHP C SQL D JavaScript
14 Priya is working on a website and wants to change the color of all links when the mouse hovers over them. Which CSS pseudo-class should she use? A :link B :visited C :hover D :active
16 Ibrahim is designing a webpage. He wants the background to be an image. Which CSS property should he use? A background-image B background-img C image-background D bg-image
17 Nadia is creating a table in HTML. She wants the table to have a border. Which attribute should she add to the <table> tag? A border="1" B borders="true" C style="border" D frame="border"
18 Zara is building a dynamic website. She wants to update the content of a div with id 'output' using JavaScript. Which method should she use? A document.getElementById('output').innerHTML = 'New Content'; B document.querySelector('#output').textContent = 'New Content'; C Both A and B are correct D document.write('New Content');
19 Which error occurs due to wrong program logic? A Syntax error B Logical error C Runtime error D System error
20 Qiao is writing HTML. She wants to add a hyperlink to Google. Which tag should she use? A <a href="https://www.google.com">Google</a> B <link href="https://www.google.com">Google</link> C <url href="https://www.google.com">Google</url> D <href="https://www.google.com">Google</href>
21 Bongani is writing a JavaScript program. He wants to repeat a block of code exactly 10 times. Which loop should he use? A for loop B while loop C do while loop D All of the above can be used
22 Grace is learning about CSS selectors. She wants to apply a style only to an element with id 'main-header'. Which CSS selector should she use? A .main-header B #main-header C main-header D *main-header
23 Maya is designing a CSS layout. She wants to add space between the border of an element and its content. Which CSS property should she use? A margin B padding C border-spacing D indent
24 What is the primary purpose of JavaScript in web development? A To define the content and structure of a web page. B To style the visual presentation of a web page. C To add interactivity and dynamic behavior to a web page. D To store data on a server.