PDA

View Full Version : PHP help?




munchmime
Apr 9, 2008, 10:19 PM
I'm an idiot! seriously... I signed up for a PHP class that said no programming exp. needed. I stupidly thought it would be neat to learn. I haven't programmed since I learned pascal 10+ years ago. (I learned how to deliver a baby today, and deal w/ all the complications, I can deal with all sorts of trauma, put in airways, etc. ... but I can't do this...)
We had a test I flunked as most of the class did. I can do most of the coding that we are given - but it is only monkey work - copy it find the syntax error and show the output.
I would like to get the right answers so i can actually learn whats going on :confused: :( and be able to use them as reference later in the class
The test was 50 questions, and the teacher will not go over it - which doesn't help my understanding of the language. can or will anyone help? (php.net has been helpful too) here are the first 25 questions, some of which I got right. - but i even got #1 wrong.
1. Web____ is the design of software applications for the web.
2. ____ is client - side scripting language (not like PHP) that allows Web authors to develop interactive Web pages and sites
3. ____- side scripting (like PHP) running language that is executed from a PC running Apache, for example.
4. Two web servers running on the same machine cannot ____ the same TCP/IP port number for HTTP communications.
5. Apache is the most popular web server used on the internet today. What is the second most popular?
6. The PHP configuration file is named ____.
7. After you instal PHP, you need to configure ____ to use it.
8. PHP code is never sent to the ____ web browser.
9. A(n) ____ tag (eg. <php or ?>) is a character or sequence of characters used to mark the beginning and end of a code segment.
10. PHP, like some programming languages requires you to end all statements with a(n) ____.
11. The term ____ refers to a self - contained code that performs a particular task.
12. Many functions can accept multiple ____ that you should separate with comas.
13. The statement that calls a function is referred to as a function ____.
14. When assigning a numeric value to a variable, do not enclose the value in ____ or PHP will treat the value as a string instead of a number.
15. To create a constant use the ____ function.
16.PHP is ____ typed, meaning that it will determine the data type at the time data is assigned to each variable.
17. Data such as lists of names, test scores, or prices are typically stored in ____.
18. A(n) ____ contains a set of data represented by a single variable name.
19. A(n) ____ refers to each piece of data that is stored within an array.
20. A(n) ____ is an element's numeric position within an array.
21. Variables that can be assigned only a single value are called ____.
22. An operator that compares operands and returns a Boolean value is known as a(n) ____.
23. The names you use for an array or variable must begin with a(n)____.
24. A variables scope can be either global or ____.
25. What superglobal is an array of server environment information?

any and all help is appreciated. Thanx!
perhaps i should buy the "dummies" book?



Shadow
Apr 10, 2008, 01:36 AM
I'm an idiot! seriously... I signed up for a PHP class that said no programming exp. needed. I stupidly thought it would be neat to learn. I haven't programmed since I learned pascal 10+ years ago. (I learned how to deliver a baby today, and deal w/ all the complications, I can deal with all sorts of trauma, put in airways, etc. ... but I can't do this...)
We had a test I flunked as most of the class did. I can do most of the coding that we are given - but it is only monkey work - copy it find the syntax error and show the output.
I would like to get the right answers so i can actually learn whats going on :confused: :( and be able to use them as reference later in the class
The test was 50 questions, and the teacher will not go over it - which doesn't help my understanding of the language. can or will anyone help? (php.net has been helpful too) here are the first 25 questions, some of which I got right. - but i even got #1 wrong.
1. Web____ is the design of software applications for the web.
2. ____ is client - side scripting language (not like PHP) that allows Web authors to develop interactive Web pages and sites
3. ____- side scripting (like PHP) running language that is executed from a PC running Apache, for example.
4. Two web servers running on the same machine cannot ____ the same TCP/IP port number for HTTP communications.
5. Apache is the most popular web server used on the internet today. What is the second most popular?
6. The PHP configuration file is named ____.
7. After you instal PHP, you need to configure ____ to use it.
8. PHP code is never sent to the ____ web browser.
9. A(n) ____ tag (eg. <php or ?>) is a character or sequence of characters used to mark the beginning and end of a code segment.
10. PHP, like some programming languages requires you to end all statements with a(n) ____.
11. The term ____ refers to a self - contained code that performs a particular task.
12. Many functions can accept multiple ____ that you should separate with comas.
13. The statement that calls a function is referred to as a function ____.
14. When assigning a numeric value to a variable, do not enclose the value in ____ or PHP will treat the value as a string instead of a number.
15. To create a constant use the ____ function.
16.PHP is ____ typed, meaning that it will determine the data type at the time data is assigned to each variable.
17. Data such as lists of names, test scores, or prices are typically stored in ____.
18. A(n) ____ contains a set of data represented by a single variable name.
19. A(n) ____ refers to each piece of data that is stored within an array.
20. A(n) ____ is an element's numeric position within an array.
21. Variables that can be assigned only a single value are called ____.
22. An operator that compares operands and returns a Boolean value is known as a(n) ____.
23. The names you use for an array or variable must begin with a(n)____.
24. A variables scope can be either global or ____.
25. What superglobal is an array of server environment information?

any and all help is appreciated. Thanx!
perhaps i should buy the "dummies" book?


development
JavaScript
Server
Share
php.ini
Apache
Client
delimiter
semicolon
function
variables
operator?
""
define()
dynamically(?)
arrays
array
element(?)
-
boolean (true or false)
$
not :p (make a variable global by doing global $var;

Yes, you should :)

angelwatt
Apr 10, 2008, 07:50 AM
I mostly agree with answers given above, though his numbering of the answers got off track.

1. Web____ is the design of software applications for the web.
- Development

2. ____ is client - side scripting language (not like PHP) that allows Web authors to develop interactive Web pages and sites
- JavaScript or VBScript

3. ____- side scripting (like PHP) running language that is executed from a PC running Apache, for example.
- Client

4. Two web servers running on the same machine cannot ____ the same TCP/IP port number for HTTP communications.
- Use/Share

5. Apache is the most popular web server used on the internet today. What is the second most popular?
- MS IIS (ewww, and most vulnerable :))

6. The PHP configuration file is named ____.
- php.ini

7. After you install PHP, you need to configure ____ to use it.
- Apache and PHP

8. PHP code is never sent to the ____ web browser.
- Visitor's or User's or Client's

9. A(n) ____ tag (eg. <php or ?>) is a character or sequence of characters used to mark the beginning and end of a code segment.
- Not sure really. I just call it a PHP tag.

10. PHP, like some programming languages requires you to end all statements with a(n) ____.
- Semicolon ;

11. The term ____ refers to a self - contained code that performs a particular task.
- function

12. Many functions can accept multiple ____ that you should separate with comas.
- Arguments

13. The statement that calls a function is referred to as a function ____.
- Call

14. When assigning a numeric value to a variable, do not enclose the value in ____ or PHP will treat the value as a string instead of a number.
- Quotes " "

15. To create a constant use the ____ function.
- define (http://us.php.net/define)

16. PHP is ____ typed, meaning that it will determine the data type at the time data is assigned to each variable.
- Umm, what? That's horribly phrased.

17. Data such as lists of names, test scores, or prices are typically stored in ____.
- Arrays

18. A(n) ____ contains a set of data represented by a single variable name.
- Array

19. A(n) ____ refers to each piece of data that is stored within an array.
- Index? Set?

20. A(n) ____ is an element's numeric position within an array.
- Index

21. Variables that can be assigned only a single value are called ____.
- Constants?

22. An operator that compares operands and returns a Boolean value is known as a(n) ____.
- Boolean Operator < > && || !=

23. The names you use for an array or variable must begin with a(n)____.
- Dollar Sign $

24. A variables scope can be either global or ____.
- Local?

25. What superglobal is an array of server environment information?
- $_SERVER (http://us3.php.net/variables.predefined)

Fill in the blank is a horrible way to test PHP skills. Just a note for the prof.

elppa
Apr 10, 2008, 07:51 AM
Shadow, I think you got your numbering a little confused!

You've skipped questions but then continued counting, so some of the answers are right but for a different question.

I've made the answers bold where mine differ / are added.

1. development
2. javascript
3. server
4. share
5. Microsoft ISS
6. php.ini
7. apache
8. client's
9. delimiter
10. semicolon
11. function
12. parameter
13. call
14. speech-marks ("")
15. define
16. weakly
17. arrays
18. array
19. value
20. key
21. constants
22. logical operator (?)
23. dollar sign ($)
24. local
25. $_SERVER

Shadow
Apr 10, 2008, 01:11 PM
Shadow, I think you got your numbering a little confused!

You've skipped questions but then continued counting, so some of the answers are right but for a different question.

I've made the answers bold where mine differ / are added.

1. development
2. javascript
3. server
4. share
5. Microsoft ISS
6. php.ini
7. apache
8. client's
9. delimiter
10. semicolon
11. function
12. parameter
13. call
14. speech-marks ("")
15. define
16. weakly
17. arrays
18. array
19. value
20. key
21. constants
22. logical operator (?)
23. dollar sign ($)
24. local
25. $_SERVER

Ya, thats what you get for doing them at 6:45AM!

munchmime
Apr 10, 2008, 03:41 PM
I Thank You guys for the help. I think I have a way better understanding of the basics(?) now; though I did get some of the above questions right.

any how here are some of the last questions, this time I thought to give you the answers I wrote down which I should have done before.
PLEASE!Correct me if I'm wrong? or if I left it blank?


26. A(n)_____ value is a value that is true or false.
-boolean?
27. You must use the _____ keyword to declare a global variable within the scope of a function.
-global?
28. What statement do you use to execute specific programming code when evaluation of a conditional expression returns a value of true?
-if?
29. A(n) _____ variable is a variable that is declared within a function.
30. A(n) _____ statement in a function sends a value back to the calling code.
-return?
31. A(n) _____ variable is declared outside a function and is available to all parts of the program.
32. A(n) _____ statement inside a switch statement represents a specific value and contains one or more statements that execute if the value of a statement matches the value of the switch statement's expression.
-if?
33. The _____ statement contains statements that execute when the value returned by the switch statement expression does not match one of the other statements.
-else if?
34. A(n) _____ statement is the control structure that repeatedly executes a statement or a series of statements while a specific condition is true or becomes true.
-loop?
35. Each repetition of a looping statement is called a(n)_____.
-iteration?
36. The conditional expression in the while statement is enclosed within _____ following the keyword while. - i assume he meant - the keyword "while"
-in paranthesis?
37. A(n) _____ is a variable that increments or decrements with each loop of a for statement.
-Counter?

Thanks again!

angelwatt
Apr 10, 2008, 04:49 PM
26. A(n)_____ value is a value that is true or false.
-boolean? - Correct

27. You must use the _____ keyword to declare a global variable within the scope of a function.
-global? - Correct

28. What statement do you use to execute specific programming code when evaluation of a conditional expression returns a value of true?
-if? - Correct

29. A(n) _____ variable is a variable that is declared within a function.
- Local?

30. A(n) _____ statement in a function sends a value back to the calling code.
-return? - Correct

31. A(n) _____ variable is declared outside a function and is available to all parts of the program.
- Scoped? Those have names?

32. A(n) _____ statement inside a switch statement represents a specific value and contains one or more statements that execute if the value of a statement matches the value of the switch statement's expression.
-if? - case

33. The _____ statement contains statements that execute when the value returned by the switch statement expression does not match one of the other statements.
-else if? - default

34. A(n) _____ statement is the control structure that repeatedly executes a statement or a series of statements while a specific condition is true or becomes true.
-loop? - While Loop

35. Each repetition of a looping statement is called a(n)_____.
-iteration? - Sure, sounds right

36. The conditional expression in the while statement is enclosed within _____ following the keyword while. - i assume he meant - the keyword "while"
-in paranthesis? - Correct

37. A(n) _____ is a variable that increments or decrements with each loop of a for statement.
-Counter? - Correct, or maybe Iterator. It's not like you need to know it's name to use it.

elppa
Apr 10, 2008, 04:54 PM
I Thank You guys for the help. I think I have a way better understanding of the basics(?) now; though I did get some of the above questions right.

any how here are some of the last questions, this time I thought to give you the answers I wrote down which I should have done before.
PLEASE!Correct me if I'm wrong? or if I left it blank?


26. A(n)_____ value is a value that is true or false. -boolean?

Correct.


27. You must use the _____ keyword to declare a global variable within the scope of a function.
-global?

yup.

28. What statement do you use to execute specific programming code when evaluation of a conditional expression returns a value of true?
-if?

I think so, but a conditional expression could also be false!

29. A(n) _____ variable is a variable that is declared within a function.

local

30. A(n) _____ statement in a function sends a value back to the calling code.
-return?

correct


31. A(n) _____ variable is declared outside a function and is available to all parts of the program.

global

32. A(n) _____ statement inside a switch statement represents a specific value and contains one or more statements that execute if the value of a statement matches the value of the switch statement's expression.

-if?

case.


33. The _____ statement contains statements that execute when the value returned by the switch statement expression does not match one of the other statements.
-else if?

default.

Take a look at the switch syntax.


34. A(n) _____ statement is the control structure that repeatedly executes a statement or a series of statements while a specific condition is true or becomes true.
-loop?

while loop.

35. Each repetition of a looping statement is called a(n)_____.
-iteration?

correct.

36. The conditional expression in the while statement is enclosed within _____ following the keyword while. - i assume he meant - the keyword "while"
-in paranthesis?

yes.

37. A(n) _____ is a variable that increments or decrements with each loop of a for statement.
-Counter?

I think this is correct, although I have never really called it a name.

Just look up the switch syntax, most of them are correct:


$var = 'cold';

switch ($var) {
case 'cold':
$temp = 10;
break;

case 'warm':
$temp = 30;
break;

default:
$temp = 20;
break;
}

echo $temp;


The above example will output 10.

savar
Apr 10, 2008, 05:29 PM
There are a few in 1-25 that it seems nobody got, but I didn't read all answers closely. Quoting this is too messy, but this is in reply to angelwatt.

16. PHP is ____ typed, meaning that it will determine the data type at the time data is assigned to each variable.
- Umm, what? That's horribly phrased.

Dynamically typed or weakly typed

18. A(n) ____ contains a set of data represented by a single variable name.
- Array

Object

19. A(n) ____ refers to each piece of data that is stored within an array.
- Index? Set?

Key

21. Variables that can be assigned only a single value are called ____.
- Constants?

Scalar

angelwatt
Apr 10, 2008, 05:51 PM
There are a few in 1-25 that it seems nobody got, but I didn't read all answers closely. Quoting this is too messy, but this is in reply to angelwatt....

I agree with those. Never learned some of that terminology though, but then again I was taught by the web so no big surprise. It's good to learn something new.

munchmime
Apr 11, 2008, 10:10 PM
Sooooo....

Thank you to all that helped!
I can actually understand some of this now, and a lot more of it makes sense to me.
I think this will be the last programming class I take for a long while < I find blood, guts, and trauma far more interesting - so I guess I'll stick with that:eek:.

Thanks again!

-Me