solution - STET Computer Science : Test 1

Question : What type of error is ‘use of undeclared variables’?

Solution : Compile-time

Description -

Run-time :-

Run-time (or runtime) refers to the period when a program is executing — that is, when the code is running on a computer or device. It starts when you launch the program and ends when the program finishes or is closed.

exception :-

An exception is an event that occurs during the execution of a program that disrupts the normal flow of instructions. It’s usually an error or an unexpected condition that the program doesn’t know how to handle immediately.

Logical :-

A logical error happens when your program runs without crashing, but it doesn't do what you intended. The code is syntactically correct (no syntax errors), but the logic—the sequence of instructions or conditions—is flawed, so the output or behavior is wrong.

Compile-time :-

Compile time is the phase in programming when your source code (the code you write) is translated by a compiler into machine code or an intermediate form before the program is run. At compile time compiler  

 

  • Syntax checking: The compiler checks your code for syntax errors (like missing semicolons, wrong keywords).

  • Type checking: It checks if data types are used correctly (like not assigning a string to an integer variable).

  • Code optimization: The compiler may optimize the code for better performance.

  • Code generation: It converts the source code into executable code or bytecode.

 

STET Computer Science : Test 1

Question : When a process is moved from main memory to the secondary storage, it is called:

Solution : swapping

Description -

Spooling :-

Spooling temporarily stores data in a buffer (usually on disk) so that it can be accessed and processed by slower peripheral devices at their own pace. It's like a queue system.

swapping :-

swapping is a memory management technique used to move processes between main memory (RAM) and secondary storage (usually a hard drive or SSD).

Scheduling :-

Scheduling in an Operating System (OS) is the method by which processes are selected to run on the CPU. It’s a key part of process management, aiming to maximize CPU usage, responsiveness, and system efficiency.

Caching :-

Caching is a technique used by operating systems to store frequently accessed data or instructions in a faster storage area (called a cache) so that future requests for that data can be served more quickly.

STET Computer Science : Test 1

Question : Which of the following semiconductor devices can act as a simple switch?

Solution : Transistor

Description -

Bipolar Junction Transistor (BJT)

  • ON state: Base-emitter junction is forward-biased → Current flows from collector to emitter (like closed switch).

  • OFF state: No base current → No collector-emitter current (like open switch).

Field Effect Transistor (FET or MOSFET)

  • ON state: Gate voltage controls a conducting channel → Current flows between drain and source.

  • OFF state: Gate voltage turns the channel off → No current flows.

Fast, efficient electronic switching used in computers, power supplies, and more.

STET Computer Science : Test 1

Question : The name given to variables, classes, methods, etc. is called:

Solution : identifier

Description - an identifier is the name used to identify a variable, function, class, array, object, or any user-defined element. It's the programmer-defined name for an entity in your code.

STET Computer Science : Test 1

Question : While scheduling processes, which of the following controls the degree of multiprogramming (the number of processes in memory)?

Solution : Long-term scheduler

Description -

The long-term scheduler is a component of the operating system responsible for controlling which jobs or processes are admitted into the system for execution. It plays a key role in managing system load and multiprogramming levels.

The long-term scheduler, also known as the job scheduler, decides which jobs are to be admitted into the system for processing. These jobs are moved from the job pool (on disk) to the ready queue (in main memory).

 

 

STET Computer Science : Test 1

Question : Optical fibre works on the principle of:

Solution : total internal reflection

Description - Optical fibre works on the principle of total internal reflection.

STET Computer Science : Test 1

Question : The layers of the TCP/IP protocol are:

Solution : Application Layer - Transport Layer(TCP/UDP) - Network/Internet Layer(IP) - Network Access Layer

Description -

Layer Key Protocols Role
Application HTTP, FTP, DNS, SMTP, etc. Interface for applications
Transport TCP, UDP Reliable/unreliable data delivery
Internet IP, ICMP, ARP Routing, addressing
Network Access Ethernet, Wi-Fi, etc. Hardware and physical transmission

STET Computer Science : Test 1

Question : Switching the CPU to another process requires performing a state save of the current process and a state restore of a different process. This task is known as:

Solution : context switch

Description -

A context switch in an operating system (OS) is the process of storing the state of a running process or thread so that it can be resumed later, and loading the state of another process or thread to run instead.

When a context switch occurs, the OS performs the following tasks:

  1. Saves the state of the currently running process (registers, program counter, stack pointer, etc.) into its process control block (PCB).

  2. Loads the state of the next process to run from its PCB.

  3. Updates memory management structures, if needed.

  4. Transfers control to the next process.

 

STET Computer Science : Test 1

Question : How can you write into HTML output using JavaScript?

Solution : document.write()

Description -

<!DOCTYPE html>
<html>
<head>
<title>Document Write Example</title>
</head>
<body>

<script>
document.write("<h1>Hello from JavaScript!</h1>");
</script>

</body>
</html>

STET Computer Science : Test 1

Question : Which of the following statements is true about "Race Condition"?

Solution : When multiple processes are accessing shared data without access control and the final result depends on the execution order

Description -

  • A race condition in an operating system (OS) is a situation where the output or behavior of a program depends on the sequence or timing of uncontrollable events, such as the execution order of threads or processes.
  • When two or more threads/processes access shared resources (like memory or files) at the same time without proper synchronization, the result can be unpredictable or incorrect — this is called a race condition.

STET Computer Science : Test 1