IBDP Computer Science B2.5 File processing HL Paper 1 - New Syllabus

Question 

Alexia and Jay are researching the web development language PHP.

They type the phrase “PHP” directly into a web browser (see Figure 7).

The web browser redirects them to a popular search engine, which executes a search.

(a) Define the term search engine. [1]

The operation of a search engine can be divided into three steps (see Figure 8).

(b) Describe how a web crawler functions. [2]
(c) Outline why keywords are important for web indexing. [2]
(d) Discuss whether an organization should use black hat search engine optimization (SEO) techniques to improve the ranking of its website. [6]

Search engines return a very large number of results, but many of the web pages are not useful. The search needs to be refined.

Alexia and Jay’s teacher recommended that they use an online database that accesses the deep web.

(e) Distinguish between the surface web and the deep web. [2]

One of the online databases provides Alexia and Jay with the following code:

<?php
if(isset($_FILES['CV'])){
    $errors = array();
    $file_name = $_FILES['CV']['name'];
    $file_size = $_FILES['CV']['size'];
    $file_tmp = $_FILES['CV']['tmp_name'];
    $file_type = $_FILES['CV']['type'];

    $file_ext = strtolower(end(explode('.',$_FILES['CV']['name'])));
    $extensions = array("pdf","doc","docx");

    if(in_array($file_ext,$extensions) === false){
        $errors[] = "This file extension not allowed";
    }

    if($file_size > 2097152){
        $errors[] = "File size must be under 2 Mb";
    }

    if(empty($errors) == true){
        move_uploaded_file($file_tmp,"CV/".$file_name);
        echo "Success";
    }else{
        print_r($errors);
    }
}
?>

<html>
<body>
<h1>Curriculum Vitae</h1>
<form action="" method="POST" enctype="multipart/form-data">
    <input type="file" name="CV"/>
    <input type="submit"/>
</form>
</body>
</html>
(f) Identify four steps that take place during the processing of this PHP code. [4]

The PHP code is processed on the server.

(g) Explain why an organization would choose to use server-side processing rather than client-side processing when delivering content to the client. [3]

Most-appropriate topic code

A2.1: Network fundamentals — parts (a), (b), (c), (d) and (e)
B2.5: File processing — part (f)
B2.1: Programming fundamentals — part (g)
▶️ Answer/Explanation

(a)
For the correct answer:

A search engine is a software system, program, or application that searches the World Wide Web or a database for information matching keywords or other criteria specified by the user.

Explanation: Search engines allow users to locate relevant resources by processing a search query and returning matching results.

(b)
For the correct answer:

  • A web crawler, also called a bot or spider, starts from a seed or designated starting page.
  • It examines web pages for information such as keywords, content, hyperlinks, and metadata.
  • It follows hyperlinks from one page to another and continually updates the search engine’s index with new or changed content.
  • The crawling process may be performed using depth-first or breadth-first approaches and can be restricted by rules such as those specified in robots.txt.

Explanation: Crawling is the process of automatically discovering and examining web pages so that their content can subsequently be indexed by a search engine.

(c)
For the correct answer:

  • Web crawlers look for keywords in elements such as meta tags, the meta description, title, and potentially the URL of a web page.
  • The frequency and relevance of keywords in the page content can then be used by the ranking algorithm when determining the position of the page in search results.

Explanation: Keywords help search engines determine what a webpage is about and whether it is relevant to a user’s search query. Strategic use of relevant keywords can therefore support Search Engine Optimization (SEO).

(d)
For the correct answer, the response should provide a balanced discussion and a supported conclusion.

Black hat SEO involves manipulating search-engine guidelines or ranking algorithms to obtain a higher ranking and potentially increase traffic, visitors, or revenue.

Examples of black hat techniques include:

  • Keyword stuffing
  • Poor-quality, duplicated, or rewritten content
  • Hidden keywords
  • Paid links
  • Link farming
  • Cloaking, where different content is shown to the search engine and the user
  • “Sneaky redirects”
  • Blog comment spam and other techniques intended to manipulate rankings

Advantages:

  • May initially increase website traffic and the number of visitors.
  • Can direct users towards content that the organization wants them to see.
  • May temporarily improve the website’s search-engine ranking.
  • Increased traffic may potentially increase revenue.

Disadvantages:

  • The organization’s reputation may be damaged.
  • Search engines may penalize websites that use inappropriate techniques.
  • The website may be blacklisted or receive a lower search-engine ranking.
  • An initial improvement may disappear if the techniques are detected and penalized.
  • The website may be flagged as unsafe.
  • There are ethical issues if inaccurate, unreliable, or inappropriate content is promoted.

Conclusion: Although black hat SEO may produce short-term improvements in ranking and traffic, the potential long-term consequences, including penalties, blacklisting, reputational damage, and ethical concerns, generally make it an unsuitable strategy for an organization.

(e)
For the correct answer:

  • The deep web is part of the World Wide Web that is not indexed by normal search engines and therefore cannot normally be discovered through ordinary search results. It includes databases and dynamic pages that may require authentication.
  • The surface web consists of webpages that are indexed by common search engines and are therefore accessible through normal searches.

Explanation: The key distinction is whether the content is indexed by conventional search engines. The deep web should not be confused with the dark web.

(f)
For the correct answer, four steps may be identified:

  1. The user selects a file and clicks the Submit button.
  2. Information is extracted from the uploaded file, including its file name, file size, file type, temporary file location, and file extension.
  3. The file is checked against the specified criteria using conditional statements. The file extension must be pdf, doc, or docx, and the file size must not exceed 2097152 bytes.
  4. If errors occur, they are added to the error array. If the error array is empty, the file is uploaded and a success message is displayed; otherwise, the errors are displayed.

Explanation: The PHP code processes the uploaded file, validates its extension and size, and either moves the valid file to the CV directory or displays the relevant errors.

(g)
For the correct answer:

  • With server-side processing, the script is executed on the web server rather than on the client’s browser.
  • The client receives only the processed result, so the processing and underlying data can remain on the server.
  • This provides a more consistent experience because the result is less dependent on the processing capacity of the client’s device and gives the organization greater control over the processing.

Explanation: Server-side processing is particularly useful when an organization needs to protect underlying data or processing logic and wants the same service to operate consistently across clients with different hardware capabilities.

Scroll to Top