Fise String

download Fise String

of 37

description

Cateva teste

Transcript of Fise String

1) Mesajul tau:

Ce va afisa atunci cand se va aplica nl2br() variabilei ce retine mesajul din casuta de mai sus?a) Ce mai faci? esti bine?b)Ce mai faci? esti bine?c)Ce mai faci? esti bine?d)Ce mai faci? Esti bine?

Corect: c)

2)Ce fac functiile htmlentities() si strip_tags();a)prima inlatura doar tagurile html si a doua doar tagurile phpb)prima inlatura doar tagurile php si a doua doar tagurile htmlc)prima inlatura doar tagurile html si a doua doar tagurile html +tagurile phpd)prima inlatura doar tagurile html si a doua doar tagurile html+tagurile CSS

Corect.C

3)htmlentities() si strip_tags() au ca scop:a)protejarea de atacuri XSS(cross-site scripting)b)protejarea de atacuri de malwarec)criptarea parolelor utilizatorilord)protectia impotriva duplicarii conturilor de utilizatori(boti de advertising)

Correct:A

3)Ce va afisa urmatoarea secventa de cod:#var1=abcdefgh;#var2=a;echo strcmp($var1,$var2);

a)7b)0c)1d)8

Correct a)var1>var2(cu 7 caractere, !!! sirul var2 trebuie sa fie la inceputul lui var1)

4) $var1="abcdefghijklmnopdqrstuvwxyz";

echo strstr($var1,j,true);

a)abcdefghij

b)abcdefghi

c)jklmnopqrstuvwxyz

d)klmnopdqrstuvwxyz

Correct-b) strstr(string,search,before_search)stringRequired. Specifies the string to search

searchRequired. Specifies the string to search for. If this parameter is a number, it will search for the character matching the ASCII value of the number

before_searchOptional. A boolean value whose default is "false". If set to "true", it returns the part of the string before the first occurrence of thesearchparameter.

5) $vara="abcdefgh"; $varb="bc";Echo strops($vara,$varb,1);

a)1 b)0 c)null d)true e)2

Corect a)strpos(string,find,start)stringRequired. Specifies the string to search

findRequired. Specifies the string to find

startOptional. Specifies where to begin the search

6) $varabc="ce mai faci mai baiete de umbli cu curca pe strada";echo strtok($varabc," ");a)ceb)cemaic)cemaifacimaibaietedeumblicucurcapestradad)ce mai faci

Correct)astrtok(string,split)

stringRequired. Specifies the string to split

splitRequired. Specifies one or more split characters

**daca este apelat iar este de ajuns sintaxa strtok(" "); si va mai face inca o separare din ce a rams din sir si va afisa: mai.Se utilizeaza foarte bine in bucle while pentru a putea sparge un text mai lung in bucatele mai mici in functie de un anumit caracter(de exemplu dupa spatiu)

7) $vara="abcdefgh"; echo substr($vara,3,3);

a)defb)cdec)defghd)cdefg

Correct)asubstr(string,start,length)stringRequired. Specifies the string to return a part of

startRequired. Specifies where to start in the string A positive number - Start at a specified position in the string A negative number - Start at a specified position from the end of the string 0 - Start at the first character in string

lengthOptional. Specifies the length of the returned string. Default is to the end of the string. A positive number - The length to be returned from the start parameter Negative number - The length to be returned from the end of the string

// Positive numbers:echo substr("Hello world",10)."
";echo substr("Hello world",1)."
";echo substr("Hello world",3)."
";echo substr("Hello world",7)."
";echo "
";

// Negative numbers:echo substr("Hello world",-1)."
";echo substr("Hello world",-10)."
";echo substr("Hello world",-8)."
";echo substr("Hello world",-4)."
";

dello worldlo worldorld

dello worldlo worldorld

// Positive numbers:echo substr("Hello world",0,10)."
";echo substr("Hello world",1,8)."
";echo substr("Hello world",0,5)."
";echo substr("Hello world",6,6)."
";echo "
";

// Negative numbers:echo substr("Hello world",0,-1)."
";echo substr("Hello world",-10,-2)."
";echo substr("Hello world",0,-6)."
";echo substr("Hello world",-2-3)."
";

Hello worlello worHelloworld

Hello worlello worHelloworld

8)Care dintre urmatoarele variante reprezinta solutia pentru a capitaliza prima litera a fiecarui cuvant dintr-un string?

a)ucfirst()

b)ucwords()

c)strtoupper()

d)strtolower()

a)-doar prima literab)correctc)tot stringul litera mared)tot stringul litera mica

9) $var32='abcbcedadaa'; echo str_ireplace('a','zzz',$var32,$elemente); echo $elemente;

a) zabcbcedadaa si 1b) zzzbcbcedzzzdzzzzzz si 12c) zzzbcbcedzzzdzzzzzz si 3d) zzzbcbcedzzzdzzzzzz si 4

10)str_ireplace(find,replace,string,count)(str_replace-case sensitive)findRequired. Specifies the value to find

replaceRequired. Specifies the value to replace the value infind

stringRequired. Specifies the string to be searched

countOptional. A variable that counts the number of replacements

11) $var32='abc def gfr rre //!!! ';echo $var32;a) abc def gfr rre //!!!b) abc def gfr rrec) 'abc def gfr rre d) 'abc def gfr rre //!!!

Corect a) Mai sunt ltrim() sir trim()-sterg la stanga si la dreapta

Hello World!llo Worl

12)Variabile booleane ,inPHP, sunt case-insensitive?a)trueb)FALSE

a)true

13)Care dintre urmatoarele variante este valabila ca sintaxa pentru IF?a) if(cond) statement;b) if(cond) {statement}c) if(cond) { statement }d) if(cond) statement

13)a,b si c

14) $var1=0;$var2= something;$var3= ;

Empty($var); Empty($var1); Empty($var2); Empty($var3);

a)true true true trueb)false true true truec)true true false trued)true false false truee)false false true fasle

Correct c)- daca exista ceva in variabila atunci afiseaza false, daca nu, afiseaza trueDaca variabila nu exista afiseaza true

15) $var1=0;$var2= something;$var3= ;

isset($var); isset ($var1); isset ($var2); isset ($var3);

a)true true true trueb)false false false falsec)true true false trued)true false false truee)false true true true

Correct e)false true true trueDaca variabila exista, atunci avem true ,else false

16) $var1=0;$var2= something;$var3= 342;

Is_numeric($var); is_numeric($var1); is_numeric($var2); is_numeric($var3);

a)true true true trueb)false false false falsec)true true false trued)true false false truee)false true false true

Corect e)doar ce sunt numere returneaza true, 0 si 342

17)Cati parametric poate lua functia ISSETa)1b)2c)Cati sunt nevoied)maxim 2

Correct a)b)c)- daca oricare dintre acestia este evaluat ca false atunci toate constructia va deveni false

18)Cum vor fi evaluate urmatoarele sintaxe:$var=false;If ($var))If (!$var))If (isset($var))If (!isset($var))If (!empty($var))

a)true true false true trueb)true false true false truec)true true true true falsed)true false true true true

Correct:b)true false true false true