• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 3 out of 16 pages
Exam (elaborations)

Internet Programming Midterm Questions And Correct Answers

Document preview thumbnail
Preview 3 out of 16 pages

INTERNET PROGRAMMING MIDTERM QUESTIONS AND CORRECT ANSWERS

Content preview

INTERNET PROGRAMMING MIDTERM
QUESTIONS AND CORRECT ANSWERS
WhatA2tagA2isA2usedA2toA2invokeA2PHPA2toA2startA2interpretingA2PHPA2code?
A2AndA2whatA2isA2theA2shortA2formA2ofA2theA2tag?A2-A2Ans--TheA2tagA2usedA2isA2<?
phpA2...A2?>

WhatA2areA2theA2twoA2typesA2ofA2commentA2tags?A2-A2Ans--YouA2canA2useA2//
A2forA2aA2single-lineA2commentA2orA2/*...*/A2toA2spanA2multipleA2lines.


WhichA2characterA2mustA2beA2placedA2atA2theA2endA2ofA2everyA2PHPA2statement?A2-
A2Ans--AllA2PHPA2statementsA2mustA2endA2withA2aA2semicolonA2(;)


WithA2symbolA2isA2usedA2toA2prefaceA2everyA2allA2PHPA2variables?A2-A2Ans--
WithA2theA2exceptionA2ofA2constants,A2allA2PHPA2variablesA2mustA2beginA2withA2$.

WhatA2canA2aA2variableA2store?A2-A2Ans--
AA2variableA2holdsA2aA2valueA2thatA2canA2beA2aA2string,A2aA2number,A2orA2otherA2data.

WhatA2isA2theA2differenceA2betweenA2$variableA2=A21A2andA2$variableA2==A21?A2-A2Ans--
$variableA2=A21A2isA2anA2assignmentA2statements,A2whereasA2theA2==A2inA2$variableA2==A2
1A2isA2aA2comparisonA2operator.

HowA2doA2youA2convertA2oneA2variableA2typeA2toA2another?A2AA2stringA2toA2aA2number?A2-
A2Ans--
ToA2convertA2oneA2variableA2typeA2toA2another,A2referenceA2itA2andA2PHPA2willA2automatic
allyA2convertA2itA2forA2you.

WhatA2isA2theA2differenceA2betweenA2++$jA2andA2$j++?A2-A2Ans--
ThereA2isA2noA2differenceA2betweenA2++$jA2andA2$j+
+A2unlessA2theA2valueA2ofA2$jA2isA2beingA2tested,A2assignedA2toA2anotherA2variable,A2orA2p
assedA2asA2aA2parameterA2toA2aA2function.A2InA2suchA2cases,A2++
$jA2incrementsA2$jA2beforeA2theA2testA2orA2otherA2operationA2isA2performed,A2whereasA2$j+
+A2performsA2theA2operationA2andA2thenA2incrementsA2$j.

AreA2theA2operatorsA2andA2andA2&&A2interchangeable?A2-A2Ans--
Generally,A2theA2operatorsA2&&A2andA2andA2areA2interchangeableA2exceptA2whereA2prece
denceA2isA2important,A2inA2whichA2caseA2&&A2hasA2aA2highA2precedence,A2whileA2andA2ha
sA2aA2lowA2one.

HowA2canA2youA2createA2aA2multilineA2echoA2orA2assignment?A2-A2Ans--
YouA2canA2useA2multipleA2linesA2withinA2quotationA2marksA2orA2theA2<<<_END..._END;A2c
onstructA2toA2createA2aA2multilineA2echoA2orA2assignment.A2InA2theA2latterA2case,A2theA2clo
singA2tagA2mustA2beA2onA2aA2lineA2byA2itselfA2withA2nothingA2beforeA2orA2afterA2it.

,CanA2youA2redefineA2aA2constant?A2-A2Ans--
YouA2cannotA2redefineA2constantsA2because,A2byA2definition,A2onceA2definedA2theyA2retai
nA2theirA2valueA2untilA2theA2programA2terminates.

HowA2doA2youA2escapeA2aA2quotationA2mark?A2-A2Ans--
YouA2canA2useA2\'A2orA2\"A2toA2escapeA2eitherA2aA2singleA2orA2doubleA2quote.

WhatA2isA2theA2differenceA2betweenA2theA2echoA2andA2printA2commands?A2-A2Ans--
TheA2echoA2andA2printA2commandsA2areA2similarA2inA2thatA2theyA2areA2bothA2constructs,A2
exceptA2thatA2printA2behavesA2likeA2aA2PHPA2functionA2andA2takesA2aA2singleA2argument,A2
whileA2echoA2canA2takeA2multipleA2arguments.

WhatA2isA2theA2purposeA2ofA2functions?A2-A2Ans--
TheA2purposeA2ofA2functionsA2isA2toA2separateA2discreteA2sectionsA2ofA2codeA2intoA2theirA2
ownA2self-
containedA2sectionsA2thatA2canA2beA2referencedA2byA2aA2singleA2functionA2name.

HowA2canA2youA2makeA2aA2variableA2accessibleA2toA2allA2partsA2ofA2aA2PHPA2program?A2-
A2Ans--
YouA2canA2makeA2aA2variableA2accessibleA2toA2allA2partsA2ofA2aA2PHPA2programA2byA2decl
aringA2itA2asA2global.

IfA2youA2generateA2dataA2withinA2aA2function,A2whatA2areA2aA2coupleA2ofA2waysA2toA2conver
tA2theA2dataA2toA2theA2restA2ofA2theA2program?A2-A2Ans--
IfA2youA2generateA2dataA2withinA2aA2function,A2youA2canA2conveyA2theA2dataA2toA2theA2restA
2ofA2theA2programA2byA2returningA2aA2valueA2orA2modifyingA2aA2globalA2variable.


WhatA2isA2theA2resultA2ofA2combiningA2aA2stringA2withA2aA2number?A2-A2Ans--
WhenA2youA2combineA2aA2stringA2withA2aA2number,A2theA2resultA2isA2anotherA2string.

WhyA2doA2youA2supposeA2thatA2anA2underscoreA2isA2allowedA2inA2variableA2namesA2($curr
ent_user),A2whereasA2hyphensA2areA2notA2($current-user)?A2-A2Ans--
InA2PHP,A2theA2hyphenA2isA2reservedA2forA2theA2subtraction,A2decrement,A2andA2negationA
2operators


WhatA2isA2theA2mainA2benefitA2ofA2usingA2aA2function?A2-A2Ans--
UsingA2functionsA2avoidsA2theA2needA2toA2copyA2orA2rewriteA2similarA2codeA2sectionsA2ma
nyA2timesA2overA2byA2combiningA2setsA2ofA2statementsA2soA2thatA2theyA2canA2beA2calledA2
byA2aA2simpleA2name.

HowA2manyA2valuesA2canA2aA2functionA2return?A2-A2Ans--
ByA2default,A2aA2functionA2canA2returnA2aA2singleA2value.A2ButA2byA2initializingA2arrays,A2ref
erences,A2andA2globalA2variables,A2itA2canA2returnA2anyA2numberA2ofA2values.

, WhatA2isA2theA2differenceA2betweenA2accessingA2aA2variableA2byA2nameA2andA2byA2refere
nce?A2-A2Ans--
WhenA2youA2referenceA2aA2variableA2byA2name,A2suchA2asA2byA2assigningA2itsA2valueA2toA
2anotherA2variableA2orA2byA2passingA2itsA2valueA2toA2aA2function,A2itsA2valueA2isA2copied.A2
TheA2originalA2doesA2notA2changeA2whenA2theA2copyA2isA2changed.A2ButA2ifA2youA2referen
ceA2aA2variable,A2onlyA2aA2pointerA2(orA2reference)A2toA2itsA2valueA2isA2used,A2soA2thatA2aA2
singleA2valueA2isA2referencedA2byA2moreA2thanA2oneA2name.A2ChangingA2theA2valueA2ofA2t
heA2referenceA2willA2changeA2theA2originalA2asA2well.

WhatA2isA2theA2meaningA2ofA2scopeA2inA2PHP?A2-A2Ans--
ScopeA2refersA2toA2whichA2partsA2ofA2aA2programA2canA2accessA2aA2variable.A2ForA2examp
le,A2aA2variableA2ofA2globalA2scopeA2canA2beA2accessedA2byA2allA2partsA2ofA2aA2PHPA2progr
am.

HowA2canA2youA2incorporateA2oneA2PHPA2fileA2withinA2another?A2-A2Ans--
ToA2incorporateA2oneA2fileA2withinA2another,A2youA2canA2useA2theA2includeA2orA2requireA2di
rectives,A2orA2theirA2saferA2variants,A2include_onceA2andA2require_once.

HowA2isA2anA2objectA2differentA2fromA2aA2function?A2-A2Ans--
AA2functionA2isA2aA2setA2ofA2statementsA2referencedA2byA2aA2nameA2thatA2canA2receiveA2a
ndA2returnA2values.A2AnA2objectA2mayA2containA2zeroA2orA2manyA2functionsA2(whichA2areA2
thenA2calledA2methods)A2asA2wellA2asA2variablesA2(whichA2areA2calledA2properties),A2allA2c
ombinedA2inA2aA2singleA2unit.

HowA2doA2youA2createA2aA2newA2objectA2inA2PHP?A2-A2Ans--
ToA2createA2aA2newA2objectA2inA2PHP,A2useA2theA2newA2keywordA2likeA2this:A2$objectA2=A2
newA2Class;

WhatA2syntaxA2wouldA2youA2useA2toA2createA2aA2subclassA2fromA2anA2existingA2one?A2-
A2Ans--
ToA2createA2aA2subclass,A2useA2theA2extendsA2keywordA2withA2syntaxA2suchA2asA2this:A2cl
assA2SubbclassA2extendsA2Parentclass

HowA2canA2youA2causeA2anA2objectA2toA2beA2initializedA2whenA2youA2createA2it?A2-A2Ans--
ToA2causeA2anA2objectA2toA2beA2initializedA2whenA2youA2createA2it,A2youA2canA2callA2aA2pie
ceA2ofA2initializingA2codeA2byA2creatingA2aA2constructorA2methodA2calledA2__constructA2wit
hinA2theA2class,A2andA2placeA2yourA2codeA2there.

WhyA2isA2itA2aA2goodA2ideaA2toA2explicitlyA2declareA2propertiesA2withinA2aA2class?A2-A2Ans--
ExplicitlyA2declaringA2propertiesA2withinA2aA2classA2isA2unnecessary,A2asA2theyA2willA2beA2i
mplicitlyA2declaredA2uponA2firstA2use.A2ButA2itA2isA2consideredA2goodA2practiceA2asA2itA2hel
psA2withA2codeA2readabilityA2andA2debugging,A2andA2isA2especiallyA2usefulA2toA2otherA2peo
pleA2whoA2mayA2haveA2toA2maintainA2yourA2code.

Document information

Uploaded on
December 21, 2025
Number of pages
16
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$14.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
LECTUREKIM
1.0
(2)
Sold
17
Followers
0
Items
4362
Last sold
1 week ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions