Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Web Technology Notes, Lecture notes of Web Programming and Technologies

question bank available for the subject web technology for computer science

Typology: Lecture notes

2018/2019

Uploaded on 04/09/2019

aliasgarsakar98
aliasgarsakar98 🇮🇳

4.5

(4)

1 document

1 / 113

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
WEB TECHNOLOGY- Q&A
UNIT – I
2 MARKS
1. How constants are defined in VBScript?
Constants are defined in VBScript as follows
[Public | Private]ConstConstant_Name =Value
2. What are the coding conventions to be followed in VBScript?
Coding conventions can include the following:
Naming conventions for objects, variables, and procedures.
Commenting conventions.
Text formatting and indenting guidelines.
3. Give the purpose of dialog box.(NOV-2012,14)
Dialog boxes can be used to raise an alert, or to get confirmation on any input or to have a kind of input
from the users.
4. How objects are defined in HTML?
The <object> tag defines an embedded object within an HTML document. Use this element to embed
multimedia (like audio, video, Java applets, ActiveX, PDF, and Flash) in your web pages. You can also use the
<object> tag to embed another webpage into your HTML document.
5. List the logical operators used in VBScript
Operator Description
And Performs a logical conjunction on two expressions (if both expressions
evaluate to True, result is True. If either expression evaluates to False,
result is False)
Or Performs a logical disjunction on two expressions (if either or both
expressions evaluate to True, result is True).
Not Performs logical negation on an expression.
Xor Performs a logical exclusion on two expressions (if one, and only one, of
the expressions evaluates to True, result is True. However, if either
expression is Null, result is also Null).
6. How variables are defined in VBScript (NOV-2013,APR-2013)
Variables are declared using “dim” keyword. Since there is only ONE fundamental data type, all the
declared variables are variant by default. Hence, a user need notmention the type of data during declaration.
Example 1: In this Example, IntValue can be used as a String, Integer or even arrays.
Dim var
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Partial preview of the text

Download Web Technology Notes and more Lecture notes Web Programming and Technologies in PDF only on Docsity!

WEB TECHNOLOGY- Q&A

UNIT – I

2 MARKS

  1. How constants are defined in VBScript? Constants are defined in VBScript as follows [Public | Private]ConstConstant_Name =Value
  2. What are the coding conventions to be followed in VBScript? Coding conventions can include the following:  Naming conventions for objects, variables, and procedures.  Commenting conventions.  Text formatting and indenting guidelines.
  3. Give the purpose of dialog box.(NOV-2012,14) Dialog boxes can be used to raise an alert, or to get confirmation on any input or to have a kind of input from the users.
  4. How objects are defined in HTML? The tag defines an embedded object within an HTML document. Use this element to embed multimedia (like audio, video, Java applets, ActiveX, PDF, and Flash) in your web pages. You can also use the tag to embed another webpage into your HTML document. 5. List the logical operators used in VBScript Operator Description And Performs a logical conjunction on two expressions (if both expressions evaluate to True, result is True. If either expression evaluates to False, result is False) Or Performs a logical disjunction on two expressions (if either or both expressions evaluate to True, result is True). Not Performs logical negation on an expression. Xor Performs a logical exclusion on two expressions (if one, and only one, of the expressions evaluates to True, result is True. However, if either expression is Null, result is also Null). 6. How variables are defined in VBScript (NOV-2013,APR-2013) Variables are declared using “dim” keyword. Since there is only ONE fundamental data type, all the declared variables are variant by default. Hence, a user need notmention the type of data during declaration. Example 1: In this Example, IntValue can be used as a String, Integer or even arrays. Dim var

    Example 2: Two or more declarations are separated by comma(,) Dim variable1,variable

    1. What is meant by Err object (APR-2013) The Err object holds information about the last runtime error that occured. It is not necessary to create an instance of this object; it is intrinsic to VBScript. Its default property is Number, which contains an integer representing a VBScript error number or an ActiveX control Status Code (SCODE) number
    2. Name any two control structures used in VBScript  If Then Statement  Select Case Statement
    3. What are VBScript Datatypes VBScript has only one data type called a Variant. It is a special kind of data type that can contain different kinds of information, depending on how it's used. Because Variant is the only data type in VBScript, it's also the data type returned by all functions in VBScript.
    4. Write the syntax of Do-while loop in VBScript The syntax of a Do..While loop in VBScript is: Do While condition [statement 1] [statement 2] ... [statement n] [Exit Do] [statement 1] [statement 2] ... [statement n] Loop
    5. Give the expansion of HTML (NOV.2012,NOV.2014) HyperText Markup Language(HTML) is a set of standards used to tag the elements of a hypertext document. It is the standard protocol for formatting and displaying documents on the World Wide Web
    6. Define Loop (APR.2014) A loop statement allows us to execute a statement or group of statements multiple times
    7. What are the necessities of using HTML forms (JULY 2012) HTML Forms are required, when we want to collect some data from the site visitor. For example, during user registration you would like to collect information such as name, email address, credit card, etc.
    8. State any four VB Script operators(APR.2012)
      1. Arithmetic Operators
      2. Comparison Operators
      3. Logical Operators
      4. Concatenation Operators
    9. How is a date functions declared?(APR.2012)
    1. Give the syntax of For….Next loop in VBScript(JULY.2014) Syntax: For counter=start To end [Step step] [statements] [Exit For] [statements] Next
    2. What a class contains in VBScript (APR.2014)  Class is a construct that is used to define a unique type.  Classes can contain variables, properties, methods or events.
    3. Name the properties in Error object handling The Err has the following important properties.  Err.Number - The code value of the runtime error. For example, Err.Number=1, 1 is the code value of the “Division zero” error.  Err.Description – The description string of the runtime error.  Err.Source – The source string of the runtime error.

    5 MARKS

    1. Discuss the usage of dictionary object in VBScript (NOV.2012,APR. 2014,JULY 2014,APR. 2016) The Dictionary object stores name/value pairs(referred to as the key and item respectively) in an array. The key is a unique identifier for the corresponding item and cannot be used for any other item in the same Dictionary object. The following code creates a Dictionary object called “cars”, adds some key/item pairs, retrieves the item value for the key ‘b’ using the Item property and then outputs the outputting string to the browser. CODE: <% Dim cars Set cars = CreateObject("Scripting.Dictionary") cars.Add "a", "Alvis" cars.Add "b", "Buick" cars.Add "c", "Cadillac" Response.Write "The value corresponding to the key 'b' is " cars.Item("b") %> Output: "The value corresponding to the key 'b' is Buick" Explanation: This code creates a Dictionary object called "cars", adds some key/item pairs, retrieves the item value for the key 'b' using the Item property and then outputs the resulting string to the browser.
    1. Explain on any one control statement used in VBScript Select Case statement:- We can also use the "Select Case" statement if you want to select one of many blocks of code to execute: Syntax:- The syntax of a Switch Statement in VBScript is: Select Case expression Case expression list statement statement .... .... statement1n Case expression list statement statement .... .... Case expression list n statement statement .... .... Case Else elsestatement elsestatement .... .... End Select Example:- d=weekday(date) Select Case d Case 1 response.write("Sleepy Sunday") Case 2 response.write("Monday again!") Case 3 response.write("Just Tuesday!") Case 4 response.write("Wednesday!") Case 5

    DimintRadius intRadius= const pi=3. Area= pi*intRadius*intRadius MsgboxArea VARIABLES:- VBScript variables are used to hold values or expressions. A variable can have a short name, like x, or a more descriptive name, like carname. Rules for VBScript variable names:  Must begin with a letter  Cannot contain a period (.)  Cannot exceed 255 characters In VBScript, all variables are of type variant, that can store different types of data. Declaring (Creating) VBScript Variables:-  Creating variables in VBScript is most often referred to as "declaring" variables.  We can declare VBScript variables with the Dim, Public or the Private statement. Like this: Dim x Dim carname  Now we have created two variables. The name of the variables are "x" and "carname".  we can also declare variables by using its name in a script. Like this: carname="Volvo"
    1. Write a short note on Math functions and Date functions A.MATHEMATICAL FUNCTIONS:- (APR. 2013,APR. 2012) Mathematical Functions help us to evaluate the mathematical and trigonometrical functions of a given input number. Syntax:- variablename = Mathematical_function_Name(Expression) Function Description

    Int A Function, which returns the integer part of the given number Log A Function, which returns the natural logarithm of the given number. Negative numbers disallowed Oct A Function, which returns the Octal value of the given percentage Hex A Function, which returns the Hexadecimal value of the given number Rnd A Function, which returns a random number between 0 and 1 Sgn A Function, which returns a number corresponding to the sign of the specified number Sqr A Function, which returns the square root of the given number. Negative numbers disallowed Abs A Function, which returns the absolute value of the given number Exp A Function, which returns the value of e raised to the specified number Sin A Function, which returns sine value of the given number Cos A Function, which returns cosine value of the given number Tan A Function, which returns tan value of the given number B. DATE FUNCTIONS: (NOV.2012) Date functions helps the developers to convert date from one format to another or to express the date value in the format that suits a specific condition. Syntax:- variablename = Date_function_Name(Expression) Function Description Date A Function, which returns the current system date CDate A Function, which converts a given input to Date DateAdd A Function, which returns a date to which a specified time interval has been added DateDiff A Function, which returns the difference between two time period DatePart A Function, which returns a specified part of the given input date value DateSerial A Function, which returns a valid date for the given year,month and date FormatDateTime A Function, which formats the date based on the supplied parameters IsDate A Function, which returns a Boolean Value whether or not the supplied parameter is a date Day A Function, which returns an integer between 1 and 31 that represents the day of the specified Date

    result is False) Or Performs a logical disjunction on two expressions (if either or both expressions evaluate to True, result is True). Not Performs logical negation on an expression. Xor Performs a logical exclusion on two expressions (if one, and only one, of the expressions evaluates to True, result is True. However, if either expression is Null, result is also Null).

    1. CONCATENATION OPERATORS Operator Description & Concatenate (join two strings together)
      • Adds two numbers together
    2. How to define a VBScript Procedure? Explain with an example The general format of the VBScript procedures are as follows: Procedure_typeProcedure_Name(argument_list) the procedure heading declaration statements execution statements End Procedure_type A procedure can have two parts: a. A declaration statement act as a reservation from the memory cells that are needed to hold data and program output and what kind of information will be stored in each memory cell. b. An execution statement is a statement that is translated into machine language and executed later. Example:-
    8. How to add VBScript code to an HTML page?(NOV.2012,14,APR.2012)  To add VBScript code to an HTML page, enclose the script within a pair of We can also place Example:- OUTPUT:- Hello World!
    1. Discuss the usage of date functions in VBScript  Date functions helps the developers to convert date from one format to another or to express the date value in the format that suits a specific condition  Date function is used to display current system date while working on the script and is the most basic and widely used function which is used while working with the Dates.

    Double Contains a float value, ranging between 1,79769313486232E308 and - 4,94065645841247E-324 for negative values and between 4,94065645841247E- 324 to 1,79769313486232E308 for positive values Date / Time contains a date between 1th January 100 and 31 December 9999. String Contains a string that can contain several billion characters Object Can contain any object Error Contains an error identifier

    1. Write a note on VBScript variables and Operators (NOV-2015) VARIABLES:- VBScript variables are used to hold values or expressions.A variable can have a short name, like x, or a more descriptive name, like carname. Rules for VBScript variable names:  Must begin with a letter  Cannot contain a period (.)  Cannot exceed 255 characters In VBScript, all variables are of type variant, that can store different types of data. Declaring (Creating) VBScript Variables:- Creating variables in VBScript is most often referred to as "declaring" variables.we can declare VBScript variables with the Dim, Public or the Private statement. Like this: Now we have created two variables. The name of the variables are "x" and "carname". we can also declare variables by using its name in a script. Like this: carname="Volvo" OPERATORS:- (JULY 2012) Refer Q.NO-6 (in 5-Marks)
    2. Explain the execution of for… Next loop in VBScript For...Next Loop:- We can use the For...Next statement to run a block of code a specified number of times. The For statement specifies the counter variable (i), and its start and end values. The Next statement increases the counter variable (i) by one. Syntax:- For var_name = Start_value To End_value // body of the loop Next Dim x Dim carname

    Example:- The following example causes a procedure called MyProc to execute 50 times. The For statement specifies the counter variable x and its start and end values. The Next statement increments the counter variable by 1. Sub DoMyProc50Times() Dim x For x = 1 To 50 MyProc Next End Sub

    1. What are the built in functions available in VBScript? Discuss them with examples. A built in function that is built into an application and can be accessed by end-users VBScript Built in functions are as follows:
      1. Mathematical functions
      2. Date and Time functions
      3. String functions
      4. MATHEMATICAL FUNCTIONS:- Mathematical Functions help us to evaluate the mathematical and trigonometrical functions of a given input number. Syntax:- variablename = Mathematical_function_Name(Expression) Function Description Int A Function, which returns the integer part of the given number Fix A Function, which returns the integer part of the given number Log A Function, which returns the natural logarithm of the given number. Negative numbers disallowed Oct A Function, which returns the Octal value of the given percentage Hex A Function, which returns the Hexadecimal value of the given number Rnd A Function, which returns a random number between 0 and 1 Sgn A Function, which returns a number corresponding to the sign of the specified number Sqr A Function, which returns the square root of the given number. Negative numbers disallowed Abs A Function, which returns the absolute value of the given number Exp A Function, which returns the value of e raised to the specified number Sin A Function, which returns sine value of the given number

     Date Function- It returns current system Date Dim myDate OUTPUT: 17-03- myDate=Date msgbox myDate  IsDate- It checks weather the given value is Date type or not Examples:

    1. Dim myDate,x OUTPUT: False myDate= x=IsDate(myDate) msgbox x
    2. myDate="India" OUTPUT: False x=IsDate(myDate) msgbox x 3.myDate=#10/05/2010# OUTPUT: True x=IsDate(myDate) msgbox x  DateDiff Function- It provides difference between two dates, based on interval day/month) or Returns the number of intervals between two dates. Examples: Dim Date1, Date2, x Date1=#10-10-09# Date2=#10-10-11# x=DateDiff("yyyy", Date1, Date2) Msgbox x 'Differnce in Years Date1=#10-10-09# Date2=#10-10-11# x=DateDiff("q", Date1, Date2) Msgbox x 'Differnce in Quarters Date1=#10-10-09# Date2=#10-10-11# x=DateDiff("m", Date1, Date2) Msgbox x 'Differnce in Months Date1=#10-10-09# Date2=#10-10-11# x=DateDiff("w", Date1, Date2) Msgbox x 'Differnce in weeks Date1=#10-10-09#

    Date2=#10-10-11# x=DateDiff("d", Date1, Date2) Msgbox x 'Differnce in days Likewise, Hours, Minutes and Seconds can be calculated.

    1. STRING FUNCTIONS:- String functions helps the developers to work with the strings effectively. Below are string methods supported in VBScript Syntax:- variablename = String_function_Name(Expression) Function Description InStr Returns the first occurrence of the specified substring. Search happens from left to right. InstrRev Returns the first occurrence of the specified substring. Search happens from Right to Left. Lcase Returns the lower case of the specified string. Ucase Returns the Upper case of the specified string. Left Returns a specific number of characters from the left side of the string. Right Returns a specific number of characters from the Right side of the string. Mid Returns a specific number of characters from a string based on the specified parameters. Ltrim Returns a string after removing the spaces on the left side of the specified string. Rtrim Returns a string after removing the spaces on the right side of the specified string. Trim Returns a string value after removing both leading and trailing blank spaces. Len Returns the length of the given string. Replace Returns a string after replacing a string with another string. Space Fills a string with the specified number of spaces. StrComp Returns an integer value after comparing the two specified strings. String Returns a String with a specified character the specified number of times. StrReverse Returns a String after reversing the sequece of the characters of the given string. Len Function- It finds length of the String Example: Dim val,x OUTPUT: 9 val="Hyderabad" x=Len(val)

    RGB -The RGB function returns a number that represents an RGB color value. Syntax: RGB(red, green, blue) Parameter Description red Required. A number from 0 to 255, inclusive, representing the red component of the color green Required. A number from 0 to 255, inclusive, representing the green component of the color blue Required. A number from 0 to 255, inclusive, representing the blue component of the color Example: <%response.write(rgb(255,0,0))%> The output of the code above will be:255 ‘red Eval Function-Evaluates an expression and returns the result.

    1. Explain the execution of While…Wend loop in VBScript(JULY 2014) In a While..Wend loop, if the condition is True, all statements are executed until Wend keyword is encountered. If the condition is false, the loop is exited and the control jumps to very next statement after Wend keyword. Syntax The syntax of a While..Wend loop in VBScript is: While condition(s) [statements 1] [statements 2] ... [statements n] Wend
    1. Explain VBScript in detail (JULY 2012) VBScript:-  Microsoft VBScript (Visual Basic Script) is a general-purpose, lightweight and active scripting language developed by Microsoft that is modelled on Visual Basic.  VBScript is an interpreted script language from Microsoft that is a subset of its Visual Basic programming language designed for interpretation by Web browsers  VBScript is a propriety client side scripting language by Microsoft, supported by Internet Explorer.  It is widely used in enterprises.  Nowadays, VBScript is the primary scripting language for Quick Test Professional (QTP), which is a test automation tool. Adding VBScript code into HTML:-  To add VBScript code to an HTML page, enclose the script within a pair of We can also place Example:-