Can anyone help me on the following questions...please! My advanced Thank you!
(1) Question:Data Conversion
Suppose A="JOHN", B="JANE", AND C="3DOES". What is the value of 0.A+B+C-3?
A. "0JOHNJANEDOES"
B. JOHNJANE3DOES
C. 0
D. 3
E. A and D
F. B and C
G. All of the above
H. None of the above
(2) QUESTION
The $PIECE function is a useful string-valued function. It returns a sub-string of a base string as defined by a delimiter and one or more positional indicators. .
For example, $P("ONE,TWO,THREE,FOUR,",2)="TWO" This is because the base string (inside the quotes) is "ONE,TWO,THREE,FOUR,". The delimiter is the "," and the 2 is the positional indicator.
This statement says, "take the second piece out of the variable with the piece defined as the portion of the variable placed between the defined delimiter (",")." There is an optional argument that allows for the definition of the positional indicator to multiple places (i.e. "take the second through the fourth pieces" would be indicated by replacing the positional indicator with "2,4").
Further examples: S X= "JOHN DOE;1234 MAIN;ANYTOWN" $P(X;1)="JOHN DOE" $P(X;2)="1234 MAIN" $P(X;2,3)="1234 MAIN;ANYTOWN"
Question: Assume X is as shown above. What would appear if we executed the statement: WRITE $P(X;1,3)
A. JOHN
B. JOHN DOE
C. JOHN DOE; ANYTOWN
D. JOHN DOE1234 MAINANYTOWN
E. JOHN DOE; 1234 MAIN; ANYTOWN
F. An error
G. Nothing
(3) QUESTION
Set and Kill Variables are defined dynamically. When you log-in to a system, no variables are defined. In the course of running, a program will define variables via the READ (R) and SET (S) commands, and undefine variables via the KILL (K) command.
Notice that commands can be abbreviated to one letter. As you know, there are two kinds of variables - string and numeric. A variable may be defined via a READ command, in which case it is automatically a string. The other way a variable can be defined is by the SET command which can define it as either string or numeric.
The syntax for the SET command is:
S arg1,arg2...argx
S VAR=expression
Assigns the value of the expression to the variable VAR.The data type of VAR is determined by the expression.
S VAR1=exp1,VAR2=exp2...
Assigns values to multiple variables.
S X=Y
Assigns the value of variable Y to variable X.
Question: If I say: R Z S X=Z, Y=X What type of variables are X, Y and Z?
A. All string
B. All numeric
C. X, Y numeric; Z string
D. X numeric; Y, Z string
E. X numeric; Y, Z undefined
F. Can't tell without more information
Question (4)
What is the value of A after executing the following?
S A=1, B=1, C=1, A=1+A+(A-1)
A. 5
B. 3
C. 2
D. 1
Question (5)
There is a KILL command which removes a variable and its value from the symbol table, thus undefining it.
The syntax for the KILL is:
K A KILL command followed by 2 spaces kills all variables.
K VAR The variable VAR is killed, if it exists.
K (VAR,VAS) All variables except VAR and VAS are killed.
The most common use of KILL is to free storage space. Another use is to flag conditions - if a particular value is defined, that means one thing; and if it is undefined, that means something else.
Question:
K S S="4",T=S+2,Z=T>6 K K, J, S What variables are defined and what are their values? A. T=6,Z=” “
B. T=”6”, Z=0
C. S=”4”,T=6,Z=0
D. S=”4”,T=”6”,X=”0”
E. S=”4”,T=”6”,Z=”FALSE”
F. S=”4”,T=”S+2”,Z=”T>6”
G. No variables are defined
Question(6):
As a final quiz on SET and KILL, after executing the logic below, what variables are defined and what are their values?
S T=1,B="1",A=1,B=A=T=(T=B) K (A)
A. A=0
B. A=1
C. A=3
D. A=1,B=”1”,T=1
E. A=131071
F. B=”1”, T=1