The OR gate in VB.NET and PHP
Answers are for parents and teachers.
1
Trace the OR simulator for the clicks B, B, A, B from the start state and write the state after each click.
B: Off On, lit. B: Off Off, unlit. A: On Off, lit. B: On On, lit.
2
The buggy click code of this week is used and the state is On On. Which click shows a wrong lamp, and what does it show?
A click on A. A becomes Off and the lamp shows unlit, but B is still On, so it should be lit.
3
Write the PHP test for a page with three lists $x, $y and $z that lights the lamp when at least one list is on.
if ($x == "on" || $y == "on" || $z == "on")
4
The OR function of this week gets Apply with list1 = on and list2 = “yes”. What does it return?
on off lit. The text yes is not allowed, so it becomes off, and the first list alone lights the lamp.
5
What does 10 | 3 give in PHP, and how do you find it?
11. Write 1010 and 0011 and take the OR of each column: 1011, which is 11.