Question 19 (continued from previous response):
This psychology problem is solved step by step below, with detailed explanations to help you understand the method and arrive at the correct answer.
This psychology problem is solved step by step below, with detailed explanations to help you understand the method and arrive at the correct answer.

ScanSolve AI Answer
Here are the solutions for the questions from the image:
Question 19 (continued from previous response):
e) Delete all employees from the finance department.
DELETE FROM Employee
WHERE department = 'Finance';
f) Write a query to display the department names along with the total number of employees in each department.
SELECT department, COUNT(ID) AS TotalEmployees
FROM Employee
GROUP BY department;
g) Write a query to increase the salary of all employees in the HR Department by 10%.
UPDATE Employee
SET salary = salary * 1.10
WHERE department = 'HR';
Question 20: Write the codes of the following calculator by using VB6.0 (15 marks)
This requires writing Visual Basic 6.0 code for a calculator. Below is a basic structure for a simple calculator that handles addition, subtraction, multiplication, and division.
Assumptions for the calculator interface:
txtDisplay (TextBox) to show input and results.btn0 to btn9 (CommandButtons) for digits.btnPlus, btnMinus, btnMultiply, btnDivide (CommandButtons) for operators.btnEquals (CommandButton) to calculate the result.btnClear (CommandButton) to clear the display.btnDecimal (CommandButton) for the decimal point.' General Declarations Section (at the top of the form's code module)
Option Explicit
Dim FirstNumber As Double
Dim SecondNumber As Double
Dim Operator As String
Dim IsNewNumber As Boolean ' Flag to indicate if a new number is being entered
Private Sub Form_Load()
' Initialize on form load
txtDisplay.Text = "0"
IsNewNumber = True
End Sub
' --- Digit Buttons (0-9) ---
Private Sub btn0_Click()
Call AddDigit("0")
End Sub
Private Sub btn1_Click()
Call AddDigit("1")
End Sub
Private Sub btn2_Click()
Call AddDigit("2")
End Sub
Private Sub btn3_Click()
Call AddDigit("3")
End Sub
Private Sub btn4_Click()
Call AddDigit("4")
End Sub
Private Sub btn5_Click()
Call AddDigit("5")
End Sub
Private Sub btn6_Click()
Call AddDigit("6")
End Sub
Private Sub btn7_Click()
Call AddDigit("7")
End Sub
Private Sub btn8_Click()
Call AddDigit("8")
End Sub
Private Sub btn9_Click()
Call AddDigit("9")
End Sub
' Helper function to add digits to the display
Private Sub AddDigit(Digit As String)
If IsNewNumber Then
txtDisplay.Text = Digit
IsNewNumber = False
Else
If txtDisplay.Text = "0" And Digit = "0" Then
' Do nothing if trying to add 0 to 0
ElseIf txtDisplay.Text = "0" And Digit <> "0" Then
txtDisplay.Text = Digit ' Replace initial 0 with the new digit
Else
txtDisplay.Text = txtDisplay.Text & Digit
End If
End If
End Sub
' --- Decimal Button ---
Private Sub btnDecimal_Click()
If InStr(txtDisplay.Text, ".") = 0 Then ' Only add if no decimal exists
txtDisplay.Text = txtDisplay.Text & "."
End If
IsNewNumber = False
End Sub
' --- Operator Buttons ---
Private Sub btnPlus_Click()
Call SetOperator("+")
End Sub
Private Sub btnMinus_Click()
Call SetOperator("-")
End Sub
Private Sub btnMultiply_Click()
Call SetOperator("*")
End Sub
Private Sub btnDivide_Click()
Call SetOperator("/")
End Sub
' Helper function to set the operator
Private Sub SetOperator(Op As String)
If Not IsNewNumber Then ' If an operation is pending or a number was just entered
If FirstNumber = 0 Then ' First number not yet set
FirstNumber = CDbl(txtDisplay.Text)
Else ' An operation was already performed or an operator was pressed consecutively
' Perform previous calculation if an operator was already set
If Operator <> "" Then
Call CalculateResult
End If
FirstNumber = CDbl(txtDisplay.Text) ' Store current display as first number
End If
End If
Operator = Op
IsNewNumber = True ' Next digit entry will start a new number
End Sub
' --- Equals Button ---
Private Sub btnEquals_Click()
Call CalculateResult
Operator = "" ' Clear operator after calculation
IsNewNumber = True ' Next digit entry will start a new number
End Sub
' Helper function to perform the calculation
Private Sub CalculateResult()
If Operator = "" Then Exit Sub ' No operator set
SecondNumber = CDbl(txtDisplay.Text)
Dim Result As Double
Select Case Operator
Case "+"
Result = FirstNumber + SecondNumber
Case "-"
Result = FirstNumber - SecondNumber
Case "*"
Result = FirstNumber * SecondNumber
Case "/"
If SecondNumber = 0 Then
MsgBox "Cannot divide by zero!", vbCritical
Result = 0
Else
Result = FirstNumber / SecondNumber
End If
End Select
txtDisplay.Text = CStr(Result)
FirstNumber = Result ' Store result as the new first number for chained operations
End Sub
' --- Clear Button ---
Private Sub btnClear_Click()
txtDisplay.Text = "0"
FirstNumber = 0
SecondNumber = 0
Operator = ""
IsNewNumber = True
End Sub
Question 1 (4 marks): List four (4) types of cyber threats that may affect computer systems.
Here are four types of cyber threats:
Question 2 (5 marks): Choose the correct answer for each question.
A school wants to connect 20 computers in a computer laboratory. Which network topology is most suitable?
The most suitable topology for connecting multiple computers in a lab setting, offering good performance and ease of management, is the Star topology.
Which device is used to connect two different networks together?
A Router is specifically designed to connect different networks (e.g., a local area network to the internet) and forward data packets between them.
Which transport layer protocol is connectionless?
The connectionless transport layer protocol is UDP (User Datagram Protocol). It provides a simple, unreliable datagram service without connection establishment or reliability mechanisms.
Get instant step-by-step solutions to any question. Free to start.
Ask Your Question