0% found this document useful (0 votes)
1 views11 pages

COC Level 5 Web Dev DB Admin EOS Questions Plus Practical

Uploaded by

moges tesfaye
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views11 pages

COC Level 5 Web Dev DB Admin EOS Questions Plus Practical

Uploaded by

moges tesfaye
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

COC Level 5: Web Development and

Database Administration
Based on Ethiopian Occupational Standards (EOS)

Section 1: Multiple Choice Questions (MCQ)


1. Which of the following is a valid HTML5 semantic element?

 A. <div>
 B. <header>
 C. <span>
 D. <section>

Answer: B and D

2. Which of the following best describes 'Normalization' in databases?

 A. Data encryption process


 B. Creating backups
 C. Organizing data to reduce redundancy
 D. Adding indexes

Answer: C

3. What is the primary function of CSS in web development?

 A. Handle database queries


 B. Structure page content
 C. Style the visual layout
 D. Write server logic

Answer: C

4. Which HTTP status code means 'Not Found'?

 A. 200
 B. 301
 C. 404
 D. 500

Answer: C

5. Which MySQL command is used to view all databases?


 A. SHOW DATABASES;
 B. SELECT * FROM database;
 C. LIST DATABASES;
 D. SHOW ALL;

Answer: A

Section 2: True / False


1. CSS stands for Cascading Style Sheets. ✅ True

2. MySQL is a NoSQL database system. ✅ False

3. The <script> tag is used to include JavaScript in HTML. ✅ True

4. SSL certificates are used to encrypt data during transfer. ✅ True

5. PHP is executed in the client browser. ✅ False

Section 3: Short Answer Questions


1. What is the difference between client-side and server-side scripting?

✅ Client-side scripting runs in the browser (e.g., JavaScript), while server-side scripting
runs on the server (e.g., PHP, Node.js).

2. List three types of database relationships.

✅ One-to-One, One-to-Many, Many-to-Many.

3. Why is responsive design important?

✅ It ensures the website looks and functions well on all devices, including desktops,
tablets, and mobile phones.

4. What is the purpose of version control systems like Git?

✅ To manage changes to source code, collaborate with teams, and track history of
code changes.

5. Mention two common web security vulnerabilities.

✅ SQL Injection and Cross-Site Scripting (XSS).

Section 4: Practical-Based Questions with Sample Answers


1. Create a PHP script to connect to a MySQL database.
<?php
$conn = new mysqli("localhost", "root", "", "student_db");
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
?>

2. Write a simple HTML form that submits user data to a PHP page.

<form action="submit.php" method="POST">


<input type="text" name="username" placeholder="Enter Username" required>
<input type="submit" value="Submit">
</form>

3. Using SQL, write a query to display names of students from a table where age > 18.

SELECT name FROM students WHERE age > 18;

4. Design a basic responsive layout using CSS.

.container {
display: flex;
flex-wrap: wrap;
}
.box {
flex: 1 1 300px;
margin: 10px;
padding: 20px;
background-color: #f2f2f2;
}

5. Demonstrate how to prevent SQL Injection in PHP.

$stmt = $conn->prepare("SELECT * FROM users WHERE username = ?");


$stmt->bind_param("s", $username);
$stmt->execute();

Additional Multiple Choice Questions


6. Which tag is used to create an ordered list in HTML?

 A. <ul>
 B. <ol>
 C. <li>
 D. <list>
Answer: B

7. Which property is used in CSS to change text color?

 A. text-color
 B. font-color
 C. color
 D. textStyle

Answer: C

8. Which JavaScript method is used to access an element by ID?

 A. getElementByName()
 B. getElementById()
 C. getById()
 D. querySelectorAll()

Answer: B

9. What does SQL stand for?

 A. Structured Query Language


 B. Sequential Query Language
 C. Secure Query Level
 D. Server Query Logic

Answer: A

10. Which of the following is NOT a PHP data type?

 A. String
 B. Boolean
 C. Character
 D. Array

Answer: C

11. Which SQL statement is used to insert new data into a database?

 A. UPDATE
 B. INSERT INTO
 C. ADD NEW
 D. CREATE

Answer: B

12. Which CSS property controls the size of text?

 A. font-size
 B. text-size
 C. size
 D. text-font

Answer: A

13. Which of the following is a JavaScript loop structure?

 A. for
 B. repeat
 C. while
 D. do-while

Answer: A, C, D

14. Which database command is used to remove all records from a table?

 A. DELETE
 B. REMOVE
 C. TRUNCATE
 D. DROP

Answer: C

15. Which HTTP method is used to update data on a server?

 A. GET
 B. POST
 C. PUT
 D. DELETE

Answer: C

Extended True / False Questions


6. JavaScript can be used for both frontend and backend development. ✅ True

7. In HTML, the <table> element is used to insert images. ✅ False

8. CSS Grid and Flexbox are layout models in CSS. ✅ True

9. A database index improves query performance. ✅ True

10. Cookies are stored on the server side. ✅ False

11. The POST method is idempotent in HTTP. ✅ False

12. Git is used for database management. ✅ False

13. In PHP, variables start with the $ symbol. ✅ True


14. The 'echo' statement in PHP is used to output data. ✅ True

15. HTML stands for HyperText Markdown Language. ✅ False

16. The command `git clone` is used to download a repository. ✅ True

17. You can use CSS to animate elements. ✅ True

18. The SQL `GROUP BY` clause is used for aggregation. ✅ True

19. An ERD is a tool for designing database structure. ✅ True

20. Web hosting is required to run a website on the internet. ✅ True

21. AJAX allows web pages to update asynchronously. ✅ True

22. PHP is a compiled programming language. ✅ False

23. JavaScript runs only on servers. ✅ False

24. A foreign key uniquely identifies a row in a table. ✅ False

25. SSL stands for Secure Socket Layer. ✅ True

26. Frontend code includes HTML, CSS, and JavaScript. ✅ True

27. MySQL supports stored procedures. ✅ True

28. The HTML `<iframe>` tag is used to embed another web page. ✅ True

29. CSS cannot apply styles to specific screen sizes. ✅ False

30. Database normalization increases redundancy. ✅ False

31. Bootstrap is a PHP framework. ✅ False

32. React and Angular are JavaScript frameworks. ✅ True

33. HTTPS is more secure than HTTP. ✅ True

34. Primary key values can be duplicated. ✅ False

35. ORM stands for Object-Relational Mapping. ✅ True

Extended Short Answer Questions


6. What is the purpose of the HTML `<meta>` tag?

✅ To provide metadata about the HTML document such as character set, viewport,
and SEO information.
7. Define a foreign key in database design.

✅ A foreign key is a field in one table that uniquely identifies a row in another table.

8. How does Flexbox differ from CSS Grid?

✅ Flexbox is one-dimensional (row or column), while Grid is two-dimensional (rows


and columns).

9. List two advantages of using frameworks like Laravel or CodeIgniter.

✅ Rapid development, built-in security features, MVC structure, reusable code.

10. What does MVC stand for in web development?

✅ Model-View-Controller.

11. What tool would you use to test an API?

✅ Postman or Curl.

12. How can SQL injection be prevented?

✅ By using prepared statements or parameterized queries.

13. What are media queries in CSS?

✅ They are used to apply styles depending on the device's screen size or resolution.

14. What is a session in web development?

✅ A method to store user data to be used across multiple pages.

15. Why is GitHub used in projects?

✅ For version control, collaboration, and repository hosting.

16. What is a CMS? Give one example.

✅ Content Management System. Example: WordPress.

17. Explain the purpose of a `foreign key constraint`.

✅ It ensures referential integrity between tables.

18. Give two methods of securing a web application.

✅ Input validation and using HTTPS.

19. What is server-side rendering?

✅ Rendering content on the server before sending it to the browser.


20. Describe the use of JSON in web development.

✅ JSON is used to exchange data between a server and a client in a lightweight


format.

21. What is a repository in Git?

✅ It is a storage space where your project lives, either locally or online.

22. State the difference between `==` and `===` in JavaScript.

✅ `==` compares values with type coercion, `===` compares both value and type.

23. What are environment variables?

✅ Variables used to store configuration data such as database credentials.

24. What is the use of `require()` in PHP?

✅ To include and evaluate a file.

25. What is meant by REST API?

✅ An API that follows the constraints of REST architecture and allows stateless
communication.

26. List two features of HTML5.

✅ Semantic elements, multimedia support (audio/video), offline storage.

27. What is SQL `JOIN` used for?

✅ To combine rows from two or more tables based on a related column.

28. How is data validated in HTML forms?

✅ Using the `required` attribute, `pattern`, `min`, `max`, and client-side scripts.

29. What is a CDN?

✅ Content Delivery Network: distributes static files across multiple servers worldwide.

30. Why should you hash passwords?

✅ To protect user credentials in case of a data breach.

31. What is the difference between `localStorage` and `sessionStorage`?

✅ `localStorage` persists after the browser closes; `sessionStorage` is cleared on tab


close.

32. Name one benefit of modular code design.


✅ Improved maintainability and reusability.

33. What does the SQL command `ALTER TABLE` do?

✅ It modifies an existing table, such as adding or dropping columns.

34. What is the difference between HTTP and HTTPS?

✅ HTTPS encrypts data with SSL/TLS, making it more secure.

35. What is a controller in MVC architecture?

✅ It handles input, processes it, and returns output to the view.

Practical Task Questions


16. 1. Create an HTML form that accepts a user's name, email, and message, and
submits it to a PHP script called 'submit.php'.

✅ Solution: Use <form> with method='POST' and input fields for name, email, and a
<textarea> for message.

17. 2. Write a SQL query to retrieve all users who registered in the year 2023 from a
table named 'users'.

✅ Solution: SELECT * FROM users WHERE YEAR(registration_date) = 2023;

18. 3. Design a CSS class that makes text red, bold, and center-aligned.

✅ Solution: .redText { color: red; font-weight: bold; text-align: center; }

19. 4. Write a JavaScript function that alerts 'Hello, World!' when a button is clicked.

✅ Solution: function greet() { alert('Hello, World!'); }

20. 5. Create a PHP script that connects to a MySQL database called 'school' with
username 'root' and no password.

✅ Solution: $conn = new mysqli('localhost', 'root', '', 'school');

21. 6. Write a SQL query to delete all records from the 'orders' table where order_date is
before 2022.

✅ Solution: DELETE FROM orders WHERE order_date < '2022-01-01';

22. 7. Implement a JavaScript function to validate that a form input is not empty.

✅ Solution: function validateInput(id) { return document.getElementById(id).value !== '';


}
23. 8. Write an SQL command to create a table named 'products' with columns id, name,
and price.

✅ Solution: CREATE TABLE products (id INT PRIMARY KEY, name VARCHAR(100),
price DECIMAL(10,2));

24. 9. Use PHP to check if a session variable 'username' is set and print it.

✅ Solution: if (isset($_SESSION['username'])) { echo $_SESSION['username']; }

25. 10. Create an HTML5 page with a responsive layout using Flexbox.

✅ Solution: <div style='display: flex; flex-wrap: wrap;'>...</div>

26. 11. Write a PHP function that calculates the factorial of a number.

✅ Solution: function factorial($n) { return ($n <= 1) ? 1 : $n * factorial($n - 1); }

27. 12. Develop a login form using HTML and validate it using JavaScript.

✅ Solution: Use <form>, <input type='text'> and <input type='password'>, then validate
inputs with JS before submit.

28. 13. Write a SQL statement to add a new column 'email' to the 'customers' table.

✅ Solution: ALTER TABLE customers ADD email VARCHAR(255);

29. 14. Create a MySQL query to count the number of products in each category.

✅ Solution: SELECT category, COUNT(*) FROM products GROUP BY category;

30. 15. Write a JavaScript function to change the background color of an element by ID.

✅ Solution: function changeBg(id, color)


{ document.getElementById(id).style.backgroundColor = color; }

31. 16. Build a simple PHP registration form with error handling for empty inputs.

✅ Solution: Check each $_POST value and display messages if empty before inserting
to DB.

32. 17. Write a CSS rule that hides an element with class 'hidden'.

✅ Solution: .hidden { display: none; }

33. 18. Write a SQL query that joins 'orders' and 'customers' tables using customer_id.

✅ Solution: SELECT * FROM orders JOIN customers ON orders.customer_id =


customers.id;

34. 19. Create a PHP script that uploads a file to a folder named 'uploads'.
✅ Solution: Use move_uploaded_file($_FILES['file']['tmp_name'], 'uploads/' .
$_FILES['file']['name']);

35. 20. Write JavaScript code to display current date and time in a div.

✅ Solution: document.getElementById('time').innerHTML = new


Date().toLocaleString();

You might also like