Dakahlia Educational Directorate Computer, IT and Communications Supervision Preparatory Two –2nd Term 2022 Questions Bank Remember that Form: with a Form element you can add a group of other elements to a webpage such as buttons and fields used for data entry in order to send these data to storing. Text input field: which gives ability to the user to enter a string or text data via keyboard Password input field: as the same as text field but (*) symbol will be displayed instead of characters to secure a pass ord key Radio input field: by which the user can select one of a limited number of options such as your gender (male/female) -------------------------------------------------------------------------------------------------------------------------------- Checkbox field: by which you can select more than one choice Button input field the user can click this to achieve or execute JavaScript function such as clear or save entered data within the form Submit button: the user click this to submit the form data to another webpage assigned by action attribute value of the Form Reset button: the user click it to clear all data fields to its original state -------------------------------------------------------------------------------------------------------------------------------- - alert ()statement: used for displaying a dialogue box with message to the user. - document.write() statement: used for displaying a text within the webpage contents. -------------------------------------------------------------------------------------------------------------------------------- - Function is JavaScript statements grouped together in a named block and perform according to calling it 1 - If you want JavaScript statements within <script> … </script> tag to be implemented when an event occurs (such as button click), you should use a function -------------------------------------------------------------------------------------------------------------------------------- Branching IF statement is written as the following: if (condition expression) { Statements to be executed if the condition result lead to true } -------------------------------------------------------------------------------------------------------------------------------- Data validation is the process of ensuring that user input was checked. - Ensuring that the user didn’t leave the field empty is one of the data validation methods Examples of Data validation methods are like - Defining the minimum allowed length for the input field - Matching the data entered in the two fields - Prevent the user from entering type of data that different of field data type -------------------------------------------------------------------------------------------------------------------------------- Internet Safety has many topics like - Identity Theft. - Malware. - Spyware - Virus - Secret codes. In the situations that may happen to you or your colleagues take care of the following - It is better not to sign up for some applications whose goal is not known. - DO NOT publish personal photos and when you do make sure they are secret. - DO NOT publish personal information either in social sites or forums and there should be adult control at home. - Make sure of the real identity of the people you talk to - When applying for a job online, make sure of the real information of the companies and it is better to apply for official or governmental job vacancies online. Some guidelines for internet safety Some important idioms used in internet safety 2 Theoretical questions The first question: - Put (√) OR (X) 1- The web page does not require a form in order for the entered data to be sent to the web site to be stored (X ) 2- To cancel the possibility of choosing two alternative radio buttons at the same time, we use the property (name) to give the same name to the two buttons (√ ) 3- To add a field to enter the student's name we add radio button(X ) 4- The text box allows the visitor to enter text data by typing inside the box(√ ) 5- Radio button allow to the user to select more than one choice (X ) 6- To choose the language you speak or more than one language, check boxes are added to the web page(√ ) 7- Name property is used to select the text that appears on the button. (X ) 8- Submit button is used to delete the data that write into the input fields. (X ) 9- Check box is allowed to select only one choice from many choices. (X ) 10- Reset button is used to delete entered values and return to the default values for the tools. (√ ) 11- HTML isn’t enough to check the entered data to the webpage. (√ ) 12- JavaScript statements must be written in a file separate from the html file. (X ) 13- Java script statements must ended with semi colon (√ ) 14- In java script language There is no difference between small and capital letter . (X ) 15- HTML language Enables you to verify that the data entered on the web page is correct . ( X) 16- It takes into account the case of uppercase or lowercase letters when writing statements in the java script language . (√ ) 17- The message must be enclosed in an alert statement in quotation marks. (√ ) 18- (alert ”Welcome”) Code shows a welcome message box. (X ) 19- We add value attribute to the button to call a function or Implement java script code . (X ) 20- Onclick attribute is used to write the text on the button . (X ) 21- Call function from button functions . (√ ) 22- To access the content of the text box, you must give a name to the form and a name to the text box(√ ) 23- Java script statements must written inside <script> (√ ) 24- Java script statements are executed sequentially one by one . ( √) 25- It is preferable to give an appropriate name to the functions indicating their function . (√ ) 26- The statements inside <script> are executed automatically . (√ ) 3 27- It is preferable that the name of the function indicates its content . ( √) 28- To execute the code of any function, it must be called first . ( √) 29- ou 30- To create a function it is not necessary to give it a name. (X ) 31- If X = 100 then the result of (X > = 20) expression leads to true. (√ ) 32- If the condition result lead to false, the statements within { } will be executed. (X ) 33- the conditional expression has only one result, which is true. (X ) 34- If the condition result lead to True, the statements within { } will be executed. (√ ) 35- We can use if statement to test conditional expressions. (√ ) 36- To Matching the password entered in the two fields we use : if(form1.text1.value=="").(X ) 37- We add Action attribute to the <form> to specify the page to go to with submitting the form data. ( √) 38- To create a function f1() that executed when pressing submit button we use: Function f1 (){ (√ ) 39- to return the value of the function f1() false If the text box is left empty, use the code: return false ; (√ ) 40- The length of the statement entered in the text box is less than or equal to 8 characters ,use the code : Form1.Text1.Value.Length<=8 ( √) 41- To check that a field is not left blank we use the code : Form1.Text1.Value!==Form1.Text2.Value (X ) 42- To prevent non-numeric data from being entered in the text box, we use the condition : (isNaN (form1.text1 . value)) . (√ ) 43- To prevent numeric values from being entered in the text box, we use the function : isNaN . (√ ) 44- To ensure the effectiveness of the web page, the data entered must be validated . (√ ) 45- From data validation pictures Password mismatch . (√ ) 46- Through java script language can not allow the user to leave empty fields . (√ ) 47- Action attribute Specifies the operation to be performed when a submit button is pressed. ( √) 48- The following code is correct to choose whether the text box is empty: If(Form1.Text1.value==''){ (√) 49- It is not possible to control the number of characters entered in a text box in java script language. (X ) 50- We use length attribute to find out the number of characters inside the tool . (√ ) 51- The following code for a text box where it is not accepted to contain the number of characters less than 8 : If(Form1.Text1.Value.Length<8){ ( √) 52- You can post photos or send their email and phone to someone else on the Internet ( X) 53- When dealing with the Internet, do not accept any anonymous messages ( √) 4 54- Not taking a stand on the infringement operations you witness on the Internet is a kind of cover-up for the infringer (√ ) 55- Online dialogues are private, so others cannot copy and print these dialogues (√ ) 56- You must keep your password and username ( √) 57- Do not add other people to your friends list unless you know them ( √) 58- Identity theft is the impersonation or use of someone, another person's name or any information to steal it (√ ) 59- Spyware is a small, malicious program with the ability to self-spread that infects computers ( √) 60- Examples of secret codes include username and password ( √) 61- You should add others to your friends list even if you don't know them personally (X ) ----------------------------------------------------------------------------------------------------------------------------------- Question Two: Choose the correct answer for the following statements 1- The ....... command is used to add radio button. (<input type="password" > - <input type ="text"> - <input type ="radio">) 2- Attribute ……….. is used to give name to the form . (Name – Action – Value ) 3- Submit button is used to ………… Data . (send – delete – require ) 4- Button …….. is used to send data to the webpage. (button – submit – reset ) 5- Button …….. is used to delete data to the webpage. (button – submit – reset ) 6- …….. is used to implement java script statement when calling it . (If statement – function – action attribute ) 7- …….. attribute is used to write text that appears on the button . (Name – Type – Value ) 8- A property that means execution when pressing button and its value is the name of the requested function (Value – onclick – Action – Text ) 9- Represents an event that causes a button to respond to a mouse click and the execution of a specific code (calls a function to execute) (function – Action – onclick – If ) 10- Executes the commands of the function created at (repeated - called - executed) 11- The code of if statement is written inside : (<>-()–{}) 12- If statement is executed when the result expression leads to ………. ( true – false – other ) 13- …… is mean execute or non-execute instruction when the result expression leads to true (Value – Branching – function ) 14- An Attribute that specifies the operation to be performed when the submit button is pressed (action – name – value ) 15- One of the forms of data validation (do not leave a blank field - specify the length of the password - all of the above) 5 16- A property is used to know the length of character number inside the tool . (Value – Onclick – Length ) 17- ……….. is used to receive the back value (Return – Value – Onclick ) 18- A function used to test the content of a text box if it is numeric or non-numeric . (function – If statement - Isnan – Alert statement ) 19- Programs that collect personal information about a user without their consent. (spyware - virus programs - malware) 20- A person impersonating another person’s name or any information about him to steal from him or others: (identity theft - spyware - malware - virus)) 21- Refers to hostile, intrusive or annoying programs intruding into computer systems . (identity theft - spyware - malware - virus) 22- Computer programs collect personal information about users without their consent (identity theft - spyware - malware - virus) 23- All personal data belonging to any individual that should not be disclosed to anyone (identity theft - spyware - malware - secret codes) 24- A small malicious program that has the ability to spread . (spyware - malware - virus) 25- When publishing photos online, you must make sure that they are …………… (downloaded - accessed - confidential). 26- If you want to execute java script statement when the event occurs, we will use …………. (if – Radio – function – form ) -------------------------------------------------------------------------------------------------------------------------------- Question Three: Write the scientific term for the following expressions: 1. It is used with the buttons and fields added to the page to enter Form data and send it to be stored on the site. 2. A button that allows you to choose only one alternative from Radio button several alternatives. 3. Added to the web page to enter text data by typing inside it. Textbox 4. A property that gives a name to the tool or form to be dealt with Name through the code 5. Language used to make your registration page interactive Java script 6. It is used to display a message inside a box, which draws Alert statement attention to reading it. 7. Used to show a message written on the web page itself Document. Write statement 8. A property or event that makes a button respond to a click and Onclick executes a specific code when a certain event occurs. 9. A property used to write a word on the button. 6 Value 10. Executing or not executing commands or statements depending Branching on the result of testing a given conditional expression 11. A sentence that is used to test a conditional expression If statement 12. The process of controlling the data entered, verifying the validity Data validation of the entered data 13. A command used to receive the return value from the execution Return false of a function. 14. A property that determines the number of characters entered in a Length text box 15. A function for entering numerical values only isNaN 16. if(isNaN(form1.text1.value<8) Enter numeric data 17. Annoying hostile programs that infiltrate computer systems, Malware malicious software 18. A malicious little program with the ability to self-spread that Malware infects computers 19. Personal data that should not be disclosed to anyone secret Secret codes codes 20. A set of commands that are executed when called and must be Function given an appropriate name indicating its function 21. A function used to determine whether it is a numeric or non- isNaN numeric value inside the parentheses 22. A part of (if) statement and it has a result (yes or no ). Condition 23. The impersonation or use by a person of another person's name Identity theft or any information related to him to steal from him or the theft of others 24. A button to perform a specific task when clicked. Button 25. Program is used to writing HTML code. Notepad 26. Program is used to open the webpage (that it written with HTML Internet browser code) 27. Button is used to send input data Submit 28. The extension in which the html file is saved .html 29. Action The property of specifying the page to be moved to or the process that will be executed when pressing the submit button 7 30. The value of the Type property for a button to choose one of Radio button several alternatives, such as the student's result (passed or faile( 31. The command used in designing the form. <form> 32. Command to add a field or button to the form window. <input type= " button"> 33. The value of the Type property of a checkbox has more than one Check box alternative, such as the language that the student is fluent in 34. A property that specifies the type of field or button added to the Type form 35. The value of the Type property is a property for the password field Password that added to the form . 36. Button that used to Delete the entered data and return to the default values reset Fourth question: <form name="form1" action="asd.php"> <input type="text" name="T"> <input type="button" value =" "المجموعonclick="Sum( )"> </form> </html> 1-Answer these questions using the above code 1- The ............ property is used to give a name to the form 2- When the button event is clicked, the ........................ function is called. 3- To show the T textbox, we used the following code……… 4- This code is written and saved in a file with the extension ……………….. 5- The property ................... specifies the text to be written on a button 2 Type the following codes 1- Tests the content of the text1 textbox inside Form1 as empty ------------------------------------------------------------------------------------------------------------------------------------- 2- Show the written text inside the t1 text box located in the form1 window (ie the content of the text box) inside a message box ------------------------------------------------------------------------------------------------------------------------------------- 3- Answer these questions using the corresponding code 1- To test a conditional expression, the .......... clause is used. < scrit > 2- This code is used to create a function named ................. function result( ) 3- If the conditional expression is met, ......... is printed in the { message box If(form1.R.value>=50) 4- This code is written and saved in a file with the extension { ............ alert("Welcome"); To create a function we write the command ………………… } } </script> 8 4- Type the following codes 1- Calling a function called Send when clicking on a button with the word "send" written on it. ------------------------------------------------------------------------------------------------------------------------------------- 2- Create a form named form1 on the webpage ------------------------------------------------------------------------------------------------------------------------------------- 5- The following are design commands for a web page with a form called (form3) containing a "Print" command button and a text box named (T) to enter your name. When you click on the command button, a function named (Enter) is called. - Re-write these codes in the answer booklet and complete the blanks with underlining your answer <form ...............="form3"> < input ……………….="Text" name="T"> < ………….. type="……..…….." ........... ="Print" ............="Enter( )"> <…………..> </html> 6- Type the following codes 1- Create a function named "Asd". When called, the message "Egypt" appears on the web page itself -------------------------------------------------------------------------------------------------------------------------------- 2- To get a web page that contains two selection buttons preceded by the words male and female, as shown in the form in front of you -------------------------------------------------------------------------------------------------------------------------------- 7- The following are design commands for a web page with a form named (Form1) that contains a text box named (D) to enter your sum and a "Calculate" command button. When you click on the command button, a function called (Sum) is called Re-write these codes in the answer booklet and complete the blanks with underlining your answer <html> <form name="…………………"> < …………… type="Text" …………..="D"> < input type="……..…….." ........... =" "احسة..............="Sum( )"> <…………..> </html> 8- Type the following codes 1- Create a function named "Asd". When called, a "Welcome" message appears in a message box ------------------------------------------------------------------------------------------------------------------------------- 9 2- To get a web page that contains two radio buttons preceded by the words “success” and “fail”. As in the form in front of you ------------------------------------------------------------------------ 9- The following are commands for creating a function named Data. When calling it, a message box appears written inside it "It is not allowed to leave the field blank" if the name field T1 on the Form1 window is left empty Re-write these codes in the answer booklet after correcting the seven mistak es, with underlining what has been corrected < html > </script > Data() function } If ( T1.Form1.value = = // ) { write ( "? ( "غير مسموح تترك الحقل فارغ } } </script> </form> 10What is the output of executing the following codes? 1- Alert("welcome to") …………………………….……………………………………………………….. 2- Function country () ………….………………………………………………………………………….. 3- Form1. Text1. Value =="" ………….………………………………………………………………. 4-<input type"=password "name=" t2"> ……………………………………………….………………. 5- If (form1. text .value ="") …………………….……………………………….…………………….. 6- <input type="text">………….…………………..………………………………………………….. 7- Function f1(){………….………………………………………………………………………. 8-<form name="form1"> ………………………………….………………………………………. 9- Return false ; ……………….………………………………………………………………… 10- If (form1. text1. Value. Length ==6) ……………….…………………………………………… 11- If (form1. text .value ="") ……………….……………………………….……………………… 12-Alert(form1.text1.value.length(……………….………………………………………………… 13- <input type="button" value="click me" onclick="Result">……………………………. 14 - document.write(" ;( " يارب النجاح 10