MCQs — Programming Fundamentals

Practice questions for Computer Science.

Question 101

Which code is an example of inline CSS?

A. <style>p { color: red; }</style>
B. <link rel="stylesheet" href="red.css">
C. p { color: red; }
D. <p style="color: red;">Hello</p>
Question 102

Which code is an example of embedded CSS?

A. <p style="color: red;">Hello</p>
B. <style> p { color: red; } </style>
C. <link rel="stylesheet" href="style.css">
D. <css> p { color: red; } </css>
Question 103

Which line links the external style sheet style.css to a web page?

A. <link rel="stylesheet" href="style.css">
B. <style src="style.css">
C. <a href="style.css">Style</a>
D. <link src="style.css">
Question 104

A student wants to change the colour of just one heading on one page quickly. Which type of CSS is the simplest to use?

A. External CSS with many files
B. Embedded CSS on every page
C. Inline CSS
D. A comment in the HTML code
Question 105

What is a limitation of inline CSS?

A. It cannot change the colour of text
B. It cannot be used in the body
C. It needs a separate file
D. The style must be repeated on every element that needs it
Question 106

What is JavaScript?

A. A language used only to style web pages
B. A program used to view web pages
C. A programming language used to make web pages interactive
D. A device used to store web pages
Question 107

Which HTML tag is used to write JavaScript code inside a web page?

A. <script>
B. <js>
C. <style>
D. <code>
Question 108

Why is JavaScript used along with HTML and CSS?

A. It stores the web page on the server
B. It replaces the need for HTML
C. It only changes the colour of text
D. It adds actions and behaviour, such as responding to a button click
Question 109

What is a variable in JavaScript?

A. A fixed value that can never change
B. A named place in memory that stores a value
C. A tag used to display an image
D. A comment written by the programmer
Question 110

Which of the following keywords is used to declare a variable in JavaScript?

A. var
B. int
C. dim
D. string
Question 111

What does initialising a variable mean?

A. Deleting the variable
B. Printing the variable on the screen
C. Giving the variable its first value
D. Renaming the variable
Question 112

Which statement declares a variable named age and gives it the value 15?

A. var 15 = age;
B. age var = 15;
C. var age == 15;
D. var age = 15;
Question 113

Which of the following is a valid variable name?

A. 1score
B. score1
C. my score
D. total-marks
Question 114

Which symbol is used for multiplication in JavaScript?

A. x
B. %
C. *
D. ^
Question 115

Which operator gives the remainder after division?

A. %
B. /
C. *
D. +
Question 116

What is the difference between = and == in JavaScript?

A. = compares two values, while == assigns a value
B. Both operators assign values
C. Both operators compare values
D. = assigns a value, while == compares two values
Question 117

What is the value of x after this code? var x = 5; x = x + 3;

A. 5
B. 8
C. 3
D. 53
Question 118

Which statement runs a block of code only when a condition is true?

A. for
B. function
C. if
D. var
Question 119

What does the else part of an if-else statement do?

A. It runs when the condition is false
B. It runs when the condition is true
C. It repeats the code
D. It declares a variable
Question 120

What will be displayed? var marks = 60; if (marks >= 50) { alert("Pass"); }

A. A message box showing Fail
B. A message box showing Pass
C. A message box showing 60
D. No message is shown

🎯 How to get the most out of these questions

  • Attempt each question before revealing the answer.
  • Read the explanation even when you answered correctly — it reinforces the concept.
  • Note down any question you got wrong and revisit it the next day.
  • Use the pagination below the list to work through every page — do not stop at page 1.

📌 MCQs — FAQs

Are the answers in this section verified?

Yes — every answer on this page has been verified. MCQs also include explanations where available.

Can I print these questions?

Yes — use your browser's print option (Ctrl+P / Cmd+P) to print or save the page as PDF.

How often are questions updated?

New questions are added regularly. If a paper pattern changes, existing questions are reviewed and updated.

Scroll to Top