Basic VIVA Questions
Basic VIVA Questions
CQUESTI
ONSFORVI
VACS619
Whati
sHTML?
HTMLstandsf
orHyperTextMarkupLanguage.I
tisalanguageofWorldWideWeb.I
tisa
st
andar
dtextf
ormat
tingl
anguagewhichisusedtocreateanddispl
aypagesont
heWeb.
Whatar
eTags?
HTMLtagsar
ecomposedoft
hreet
hings:
anopeni
ngt
ag,
cont
entandendi
ngt
ag.Somet
ags
ar
euncl
osedtags.
HTMLdocument
scont
aint
wot
hings:
ocont
ent
,and
ot
ags
Whenawebbr
owserr
eadsanHTMLdocument
,thebr
owserr
eadsi
tfr
om t
opt
obot
tom and
l
eftt
ori
ght
.
Forexampl
e
<p>Par
agr
pah</
p>
Whent
oUseGET?
Thedef
aul
tHTTPmet
hodwhensubmi
tt
ingf
orm dat
aisGET.
Howev
er,
whenGETi
sused,
thef
orm dat
awi
l
lbev
isi
blei
nthepage'
saddr
essf
iel
d:
Whent
oUsePOST?
Al
waysusePOSTift
hefor
m dat
acontai
nssensi
ti
veorpersonal
inf
ormat
ion.ThePOSTmet
hod
doesnotdi
spl
ayt
hefor
m dat
ainthepageaddr
essfi
eld.
Doal
lHTMLt
agshav
eanendt
ag?
No.Ther
ear
esomeHTMLt
agst
hatdon'
tneedacl
osi
ngt
ag.Forexampl
e:<i
mage>t
ag,
<br
>.
Howmanyt
ypesofheadi
ngdoesanHTMLcont
ain?
TheHTMLcontai
nssi
xtypesofheadi
ngswhicharedefi
nedwiththe<h1>to<h6>t ags.Each
ty
peofheadi
ngtagdi
spl
aysdif
fer
enttextsi
zefr
om another
.So,<h1>ist
helargestheadingtag
and<h6>
Howt
ocr
eat
eahy
per
li
nki
nHTML?
TheHTMLpr
ovi
desananchort
agt
ocr
eat
eahy
per
li
nkt
hatl
i
nksonepaget
oanot
herpage.<a
hr
ef="
..
..
..
..
..
."
>Li
nkText</
a>
Whatar
esomecommonl
i
stst
hatar
eusedwhendesi
gni
ngapage?
Ther
ear emanycommonl
i
stswhi
chareusedt
odesi
gnapage.Youcanchooseanyora
combinati
onoft
hefol
l
owi
ngli
stt
ypes:
o Or
der
edl
i
st-Theor
der
edl
i
stdi
spl
aysel
ement
sinnumber
edf
ormat
.Iti
srepr
esent
edby
<ol
>tag.
oUnorder
edli
st-Theunor
der
edl
i
stdi
spl
aysel
ement
sinbul
l
etedf
ormat
.Iti
s
r
epresent
edby<ul>t
ag.
o Def
ini
ti
onl
i
st-Thedef
ini
ti
onl
i
stdi
spl
aysel
ement
sindef
ini
ti
onf
orml
i
kei
ndi
cti
onar
y.
The<dl
>,<dt
>and<dd>t
agsar
eusedt
odef
inedescr
ipt
ionl
i
st.
Doesa<!
DOCTYPEht
ml>t
agi
saHTMLt
ag?
No,
the<!
DOCTYPEht
ml>decl
arat
ioni
snotanHTMLt
ag.
Whati
sbut
tont
ag?
Thebutt
ontagi
susedinHTML5.I ti
susedt
ocr
eat
eacli
ckablebutt
onwithintheHTMLf or
m
onthewebpage.I
tisgener
all
yusedtocr
eat
ea"
submi
t"or"r
eset"but
ton.Let'
sseethecodeto
di
splayt
hebutt
on.
<but
tonname="
but
ton"t
ype="
but
ton"
>Cl
i
ckHer
e</
but
ton>
Whatar
ethenew<i
nput
>ty
pesf
orf
ormv
ali
dat
ioni
nHTML5?
Thenewi
nputt
ypesf
orf
ormv
ali
dat
ionar
eemai
l
,URL,
number
,tel
,anddat
e.
Exampl
e:
<i
nputt
ype="
emai
l
">
DefineBootstr
ap.
Answer:Bootstr
apisafront
-endframeworkthati
susedforcreatingHTML, CSS,andJSweb
appl
icat
ions.It
slay
outisveryresponsi
ve,
fastandeasytouse.Itmost l
yfocusesonbuil
dinga
mobileappli
cati
onwit
hhav i
ngdesi gnt
emplatesf
orcreat
ingUIlikeDropdown,Forms,Buttons,
Aler
tsTab,etc.
WhyBoot st
rapisusedforMobi l
eWebdev el
opment?
Answer: Itisusedf orMobi leWebdev elopmentbecausei thasr esponsi
vedesi gnsand
templateswhi char eeasyt ouse.
Whatdoy ouunder standbyBoot str
apcont ainer?
Answer: Boot str
apcont ai
nerbehav eslikeacont ainerwhereyoucanputHTMLcodeandi ti
sa
partwit
hi nt hepagewher et hecontentoft hesitecanbepl acedt omakei tresponsiveandfast
.
DefineFluidLay out .
Answer: FluidLay outi susef ulwheny ouneedt omakeanappt hatinvol
vesthef ul
lwidthofthe
screeni.e.Fl uidLay outadjustsi t
selfaccordingt othebrowsersi ze.
DefineFixedLay out .
Answer: Af i
xedl ay outi sr
esponsi veandeasyt ousebutj ustl
iket hefl
uidlayout,i
tcannot
adjusti
tsel faccor dingt othebr owsersize.Thef i
xedlay
outshoul dbe940pxi nmostcases.
Whatar et hedi fferentbut tonst y
lesinBoot str
ap?
Answer: Inboot strap, ther
ear esev enstyleswhi chwecanusewi ththebootstr
apbut ton.
• . bt n-
def aul t.
• . bt n-
pr imar y
• . bt n-
success
• . bt n-
inf o
• . bt n-
war ning.
• . bt n-
danger .
• . bt n-
link.
Whatar
elabelsinBootstrap?
Answer
:Bootstr
aplabelsareusedf
oroff
eri
ngcount
s,ti
psorothert
hingstoprov
idemar
kupon
webpages.Tousethel abeli
nBoot
str
apweusetheclass.
label
stoindicat
ethel
abel
s.
Whati
sPHP?
PHPisar ecursiv
eacronymfor"
PHP:Hypert
extPr
epr
ocessor"
.PHPisaserversi
descri
pti
ng
l
anguaget hatisembeddedi
nHTML.Itisusedtomanagedynamiccont
ent
,databases,
sessi
on
tr
acki
ng,ev enbuil
denti
ree-
commercesit
es.
Whatar
ethecommonusagesofPHP?
CommonusesofPHP−
• PHPper
for
mssy
stem f
unct
ions,
i.
e.f
rom f
il
esonasy
stem i
tcancr
eat
e,open,
read,
wr
it
e,andcl
oset
hem.
• PHPcanhandl
efor
ms,
i.
e.gat
herdat
afr
om f
il
es,
sav
edat
atoaf
il
e,t
hruemai
lyoucan
senddat
a,r
etur
ndat
atot
heuser
.
• Youadd,
del
ete,
modi
fyel
ement
swi
thi
nyourdat
abaset
hruPHP.
• Accesscooki
esv
ari
abl
esandsetcooki
es.
I
nhowmanyway
syoucanembedPHPcodei
nanHTMLpage?
Al
l PHPcodemustbei
ncl
udedi
nsi
deoneoft
het
hreespeci
almar
kupt
agsat
ear
erecogni
sed
bythePHPParser
.
<?phpPHPcodegoesher
e?>
<? PHPcodegoesher
e?>
<scr
ipt
language="
php"
>PHPcodegoesher
e</
scr
ipt
>
Mostcommont agist
he<?
php.
..
?>
I
sPHPacasesensi
ti
vel
anguage?
No,
PHPi
spar
ti
all
ycasesensi
ti
ve.
Whatar
ethedi
ff
erentt
ypesofPHPv
ari
abl
es?
PHPhasat
otal
ofei
ghtdat
aty
peswhi
chweuset
oconst
ructourv
ari
abl
es−
I
nteger
s−ar
ewhol
enumber
s,wi
thoutadeci
mal
poi
nt,
li
ke4195.
• Doubl
es−ar
efl
oat
ing-
poi
ntnumber
s,l
i
ke3.
14159or49.
1.
• Bool
eans−hav
eonl
ytwopossi
blev
aluesei
thert
rueorf
alse.
• NULL−i
saspeci
alt
ypet
hatonl
yhasonev
alue:
NULL.
• Obj
ect
s-Anobj
ecti
sadat
aty
pet
hatnotonl
yal
l
owsst
ori
ngdat
abutal
soi
nfor
mat
ion
on,
howt
opr
ocesst
hatdat
a.
• St
ri
ngs−ar
esequencesofchar
act
ers,
li
ke'
PHPsuppor
tsst
ri
ngoper
ati
ons.
'
• Ar
ray
s−ar
enamedandi
ndex
edcol
l
ect
ionsofot
herv
alues.
• Resour
ces-(
Aresour
cei
saspeci
alv
ari
abl
e,hol
dingar
efer
encet
oanext
ernal
r
esour
ce.
)
Whatar
erul
esf
ornami
ngaPHPv
ari
abl
e?
Rul
esf
ornami
ngav
ari
abl
ear
efol
l
owi
ng−
• Var
iabl
enamesmustbegi
nwi
thal
ett
erorunder
scor
echar
act
er.
• Av
ari
abl
enamecanconsi
stofnumber
s,l
ett
ers,
under
scor
esbuty
oucannotuse
char
act
ersl
i
ke+,
-,%,
(,).&,
etc
Whati
snumer
icar
ray
?
Numer
icar
ray−Anar
raywi
thanumer
ici
ndex.Val
uesar
est
oredandaccessedi
nli
nearf
ashi
on.
Whati
sassoci
atear
ray
?
Associ
ati
vearr
ay−Anar r
aywit
hstri
ngsasindex.Thisstor
esel
ementv
aluesi
nassoci
ati
on
wit
hkeyv al
uesrat
hert
haninastr
ictl
ineari
ndexorder.
Whati
sMul
ti
dimensi
onal
arr
ay?
Mul
ti
dimensional
arr
ay−Anar
raycont
aini
ngoneormor
ear
ray
sandv
aluesar
eaccessedusi
ng
mul
ti
plei
ndices.
Howwi
l
lyougeti
nfor
mat
ionsentv
iagetmet
hodi
nPHP?
ThePHPpr
ovi
des$_
GETassoci
ati
vear
rayt
oaccessal
lthesenti
nfor
mat
ionusi
ngGETmet
hod.
Howwi
l
lyougeti
nfor
mat
ionsentv
iapostmet
hodi
nPHP?
ThePHPprov
ides$_
POSTassoci
ati
vear
rayt
oaccessal
lthesenti
nfor
mat
ionusi
ngPOST
method.
Howpr
eg_
mat
ch(
)funct
ionwor
ks?
preg_match(
)-Thepreg_match(
)funct
ionsear
chesst
ri
ngf
orpat
ter
n,r
etur
ningt
ruei
fpat
ter
n
exist
s,andfal
seother
wise.
Whati
sthedi
ff
erencebet
weenSQLandMy
SQLorSQLSer
ver
?
SQLorSt ructuredQueryLanguageisalanguage;
languaget hatcommuni cat
eswit
har el
ati
onal
databaset husprovi
dingway sofmanipul
ati
ngandcr eat
ingdat abases.MySQLandMicrosoft
’s
SQLSer verbot harerelat
ionaldat
abasemanagementsy stemst hatuseSQLast hei
rstandar
d
rel
ati
onal databaselanguage.
Whatar
evar
iousDDLcommandsi
nSQL?Gi
vebr
iefdescr
ipt
ionoft
hei
rpur
poses.
Fol
l
owi
ngar
evar
iousDDLorDat
aDef
ini
ti
onLanguagecommandsi
nSQL−
• CREATE−i
tcr
eat
esanewt
abl
e,av
iewofat
abl
e,orot
herobj
ecti
ndat
abase.
• ALTER−i
tmodi
fi
esanexi
sti
ngdat
abaseobj
ect
,suchasat
abl
e.
• DROP−i
tdel
etesanent
ir
etabl
e,av
iewofat
abl
eorot
herobj
ecti
nthedat
abase.
Whatar
evar
iousDMLcommandsi
nSQL?Gi
vebr
iefdescr
ipt
ionoft
hei
rpur
poses.
Fol
l
owi
ngar
evar
iousDMLorDat
aMani
pul
ati
onLanguagecommandsi
nSQL−
SELECT−i
tret
ri
evescer
tai
nrecor
dsf
rom oneormor
etabl
es.
•I
NSERT−i
tcr
eat
esar
ecor
d.
• UPDATE−i
tmodi
fi
esr
ecor
ds.
• DELETE−i
tdel
etesr
ecor
ds.
I
sPHPacasesensi
ti
vel
anguage?
I
nPHP,
var
iabl
enamesar
ecase-
sensi
ti
vebutf
unct
ionnamesar
enotcasesensi
ti
ve.
Whatt
ypesofl
oopsexi
sti
nPHP?
f
or,
whi
l
e,dowhi
l
eandf
oreach.
Whati
stheuseofConst
antFunct
ion?
Aconst
antf
unct
ioni
susedt
oret
urnt
heconst
antv
alue.
Whatar
etagsused?
Theyallowmaki
ngt
her
esul
toft
heexpr
essi
onbet
weent
het
agsdi
rect
lyt
othebr
owser
response.
Whati
sthedi
ff
erencebet
weenexpl
ode(
)andspl
i
t()f
unct
ions?
Spl
itfunct
ionspl
i
tsast
ri
ngi
ntoar
raybyr
egul
arexpr
essi
on.Expl
odespl
i
tsast
ri
ngi
ntoar
rayby
str
ing.
I
sPHPsuppor
tsmul
ti
plei
nher
it
ance?
ThePHPcompr
isesonl
ysi
ngl
einher
it
ancewhi
chmeanst
hatacl
asscoul
dbeenl
argedf
rom
j
ustonesi
ngl
ecl
assut
il
izi
ngt
hekey
wor
d‘ext
ended.
’
Whati
sthedi
ff
erencebet
weenI
Dandcl
assi
nCSS?
Thediff
erencebet
weenanIDandClassi
sthatanIDcanbeut
il
izedt
oident
if
yoneel
ement
,
whereasaclasscanbeusedt
oidenti
fymorethanone.
Whati
stheuseof“
echo”i
nPHP?
I
nPHP,
echoi
susedt
opr
int
/out
putdat
aont
hewebpage.
Exampl
e:
<?phpecho‘Car
insur
ance’
;?>
Howt
odecl
areanar
rayi
nPHP?
Ex:
var$ar
r=ar
ray
(‘appl
e’
,‘
grape’
,‘
lemon’
);
Whati
stheuseof„
pri
nt‟i
nPHP?
I
tisnotactual
l
yarealf
unct
ion,
iti
sal
anguageconst
ruct
.Soy
oucanut
il
izewi
thout
parent
heseswithi
tsar
gumentl
ist
.
Whati
s$GLOBALS?
The$GLOBALSisaPHPsuperglobal
var
iabl
e.I
tcanbeut
il
izedi
nst
eadofagl
obal
key
wor
dto
accessv
ari
abl
esfr
om gl
obalscope.
TheGETMet
hod
I
nGETmet hodthedat
aissentasURLparameter
sthatareusual
l
yst
ri
ngsofnameandval
ue
pai
rssepar
atedbyamper
sands(&).I
ngener
al,
aURLwi thGETdatawi
lll
ookl
iket
his:
ht
tp:
//www.
exampl
e.com/
act
ion. name=j
php? ohn&age=24
ThePOSTMet
hod
I
nPOSTmethodthedataissentt
ot heser
verasapackageinaseparatecommunicat
ionwi
th
t
hepr
ocessi
ngscri
pt.Dat
asentthroughPOSTmethodwi l
lnotv
isi
bleintheURL.
Whati
sVar
iabl
einPHP
Var
iabl
esar
eusedt
ost
oredat
a,l
i
kest
ri
ngoft
ext
,number
s,et
c.
I
nPHPv
ari
abl
ecanbedecl
aredas:
$var
_name=v
alue;
Nami
ngConv
ent
ionsf
orPHPVar
iabl
es
Thesear
ethef
oll
owi
ngr
ulesf
ornami
ngaPHPv
ari
abl
e:
• Al
lvar
iabl
esi
nPHPst
artwi
tha$si
gn,
fol
l
owedbyt
henameoft
hev
ari
abl
e.
• Av
ari
abl
enamemustst
artwi
thal
ett
erort
heunder
scor
echar
act
er_
.
• Av
ari
abl
enamecannotst
artwi
thanumber
.
• Av
ari
abl
enamei
nPHPcanonl
ycont
ainal
pha-
numer
icchar
act
ersand under
scor
es(
A-z,
0-9,
and_
).
• Av
ari
abl
enamecannotcont
ainspaces.
Whati
sConst
anti
nPHP
Aconst
anti
sanameorani
dent
if
ierf
oraf
ixedv
alue.
PHPCondi
ti
onal
Stat
ement
s
Ther
ear
esev
eral
stat
ement
sinPHPt
haty
oucanuset
omakedeci
sions:
• Thei
fst
atement
• Thei
f.
..
elsest
atement
• Thei
f.
..
elsei
f.
..
.el
sest
atement
• Theswi
tch.
..
casest
atement
Whati
sPHPAr
ray
s
Arr
aysarecomplexvar
iabl
est
hatal
l
owust
ost
oremor
ethanonev
alueoragr
oupofv
alues
underasi
nglev
ar i
abl
ename.
PHPFunct
ionsForSor
ti
ngAr
ray
s
• sor
t()andr
sor
t()—Forsor
ti
ngi
ndexedar
ray
s
• asor
t()andar
sor
t()—Forsor
ti
ngassoci
ati
vear
ray
sbyv
alue
• ksor
t()andkr
sor
t()—Forsor
ti
ngassoci
ati
vear
ray
sbykey
My
Sql
SQLbasi
cquer
ies/st
atement
s/commands
CREATE,
SELECT,
INSERT,
UPDATE,
DELETE
Howt
ocr
eat
eaMy
SQLconnect
ion?
my
sql
_connect
(ser
ver
name,
user
name,
passwor
d);
Howt
osel
ectadat
abase?
my
sql
_sel
ect
_db(
$db_
name)
;
Whati
sthedi
ff
erencebet
weenSQLandMy
sql
?
SQL(
Struct
uredQueryLanguage)i
saprogrammingl
anguagecr
eat
edformanagingdatahel
din
aRel
ati
onalDatabaseManagementSystem.Mysqli
sanopensour
ce,
relat
ional
database
managementSystem
HTML
I
fIdonotput<!
DOCTYPEht
ml>wi
l
lHTML5wor
k?
No,thebrowserwil
lnotbeabl
etoi
dent
if
ythati
tisanHTMLdocumentandHTML5t
agsdonot
functi
onproper
ly.
Howt
ocr
eat
eahy
per
li
nki
nHTML?
TheHTMLpr
ovi
desananchort
agt
ocr
eat
eahy
per
li
nkt
hatl
i
nksonepaget
oanot
herpage.
Theset
agscanappeari
nanyoft
hef
oll
owi
ngway
s:Unv
isi
tedl
i
nk-I
tisdi
spl
ayed,
under
li
nedandbl
ue.
Vi
sit
edl
i
nk-I
tisdi
spl
ayed,
under
li
nedandpur
ple.
Act
ivel
i
nk-I
tisdi
spl
ayed,
under
li
nedandr
ed.
Whi
chHTMLt
agi
susedt
odi
spl
ayt
hedat
aint
het
abul
arf
orm?
TheHTMLt abl
etagi
susedtodispl
aydataintabularform(row*column).I
tal
somanagesthe
l
ayoutoft
hepage,e.
g.,
headersect
ion,
navigat
ionbar ,bodycont
ent
, f
oot
ersect
ion.Her
eist
he
l
istoft
agsusedwhil
edispl
ayi
ngthedatainthetabularform:
Whati
sthedi
ff
erencebet
weenHTMLel
ement
sandt
ags?
HTMLelementscommunicat
etothebrowsertorendert
ext
.Whentheel
ementsareencl
osedby
br
acket
s<>,theyf
orm HTMLtags.Mostoftheti
me, t
agscomeinapai
randsurr
oundcontent
.
Howt
oinser
tacopy
rightsy
mbol
onabr
owserpage?
Youcani
nser
tacopy
rightsy
mbol
byusi
ng©
;or©
inanHTMLf
il
e.
Doesahy
per
li
nkonl
yappl
ytot
ext
?
No,youcanusehy per
li
nksontextandimagesboth.TheHTMLanchort
agdefi
nesahy per
li
nk
thatl
inksonepagetoanotherpage.The"
href
"att
ribut
eist
hemostimport
antat
tri
but
eofthe
HTMLanchort ag.
Sy
ntax
<ahr
ef="
..
..
..
..
..
."
>Li
nkText</
a>
Whati
sast
ylesheet
?
Astyl
esheetisusedtobui
ldaconsi
stent
,tr
anspor
tabl
e,andwell-
desi
gnedsty
letempl
ate.You
canaddthesetemplat
esonsever
aldif
fer
entwebpages.Itdescr
ibest
helookandfor
mat t
ingof
adocumentwr i
tt
eninmarkupl
anguage.
Expl
aint
hel
ayoutofHTML?
HTMLl
ayoutspeci
fi
esawayi
nwhi
cht
hewebpagei
sar
ranged.
Ev
erywebsi
tehasaspeci
fi
clay
outt
odi
spl
aycont
enti
naspeci
fi
cmanner
.
<header
>:I
tisusedt
odef
ineaheaderf
oradocumentorasect
ion.
<nav
>:I
tisusedt
odef
ineacont
ainerf
ornav
igat
ionl
i
nks
<sect
ion>:
Iti
susedt
odef
ineasect
ioni
nadocument
<ar
ti
cle>:
Iti
susedt
odef
ineani
ndependent
,sel
f-
cont
ainedar
ti
cle
<asi
de>:
Iti
susedt
odef
inecont
entasi
def
rom t
hecont
ent(
li
keasi
debar
)<f
oot
er>:
I
tisusedt
odef
ineaf
oot
erf
oradocumentorasect
ion
Howmanyt
agscanbeusedt
osepar
ateasect
ionoft
ext
s?
Thr
eet
agsar
eusedt
osepar
atet
het
ext
s.
<br
>t ag-Usual
ly<br
>tagisusedt
osepar
atet
hel
i
neoft
ext
.Itbr
eakst
hecur
rentl
i
neand
conveysthefl
owtothenextl
ine
<p>t
ag-The<p>t
agcont
ainst
het
exti
nthef
orm ofanewpar
agr
aph.
<bl
ockquot
e>t
ag-Iti
susedtodefinealargequotedsecti
on.I
fyouhav
eal
argequot
ati
on,
then
putt
heenti
ret
extwit
hin<bl
ockquote>.
..
..
..
..
..
..
</bl
ockquot
e>tag.
Howt
omakeapi
ctur
eofabackgr
oundi
mageofawebpage?
Tomakeapict
ureabackgr
oundi
mageonawebpage,
youshoul
dputt
hef
oll
owi
ngt
agcode
af
tert
he</
head>tag.
<bodybackgr
ound="
image.
gif
">