SlideShare a Scribd company logo
1 of 16
Important MCQs
For
Online Exam
Session and cookies
User authentication
1. How many predefined variables does PHP use to authenticate a user?
a) 1
b) 2
c) 3
d) 4
Answer: b
Explanation: The variables PHP use to authenticate a user are
$_SERVER[‘PHP_AUTH_USER’] and $_SERVER[‘PHP_AUTH_PW’].
2. Which of the following variables does PHP use to authenticate a user?
i) $_SERVER['PHP_AUTH_USER'].
ii) $_SERVER['PHP_AUTH_USERS'].
iii) $_SERVER['PHP_AUTH_PU'].
iv) $_SERVER['PHP_AUTH_PW'].
a)i) and ii)
b) ii) and iv)
c) i) and iv)
d) ii) and iii)
Answer: c
Explanation: $_SERVER[‘PHP_AUTH_USER’] and $_SERVER[‘PHP_AUTH_PW’] store
the username and password values, respectively.
3. Which of the following PHP function is commonly used when handling
authentication via PHP?
i) header()
ii) footer()
iii) inset()
iv) isset()
a)i) and iv)
b) ii) and iv)
c) ii) and iii)
d) i) and iii)
Answer: a
Explanation: The function isset () is used to check whether a variable is
set or not and the function header() sends a raw HTTP header to a
client.
4. Which directive determines whether PHP scripts on the server can accept file
uploads?
a) file_uploads
b) file_upload
c) file_input
d) file_intake
Answer: a
Explanation: With PHP, it is easy to upload files to the server. We need to ensure
that PHP is configured to allow file uploads. In the “php.ini” file, search for the
file_uploads directive, and set it to On. By default, its value is on.
5. If you want to temporarily store uploaded files in the /tmp/phpuploads/
directory, which one of the following statement will you use?
a) upload_tmp_dir “/tmp/phpuploads/ directory”
b) upload_dir “/tmp/phpuploads/ directory”
c) upload_temp_dir “/tmp/phpuploads/ directory”
d) upload_temp_director “/tmp/phpuploads/ directory”
Answer: a
Explanation: Anyone can temporarily store uploaded files on the given directory.
One cannot change upload_tmp_dir at the runtime. By the time a script runs, the
upload process has already occurred.
6. Which function is used to determine whether a file was uploaded?
a) is_file_uploaded()
b) is_uploaded_file()
c) file_uploaded(“filename”)
d) uploaded_file(“filename”)
Answer: b
Explanation: The function is_uploaded_file() checks whether the specified file is
uploaded via HTTP POST. The syntax is is_uploaded_file(file).
7.Which one of the following is the very first task executed by a session enabled
page?
a) Delete the previous session
b) Start a new session
c) Check whether a valid session exists
d) Handle the session
Answer: c
Explanation: The session variables are set with the PHP global variable which is
$_SESSION. The very first task executed by a session enabled page is Check whether
a valid session exists.
8. Which function is used to verify whether a variable contains a value?
a) header()
b) footer()
c) inset()
d) isset()
Answer: d
Explanation: The isset() function determines whether a variable has been
assigned a value. Its prototype follows: boolean isset(mixed var [,mixed var
[,…]]).
9. Which function is used to split a string into a series of substrings, with each
string boundary is determined by a specific separator?
a) break()
b) divide()
c) explode()
d) md5()
Answer: c
Explanation: Although they are a similar function, you should use explode()
instead of split(). In fact split() function has been deprecated altogether.
10. Which one of the following is the default PHP session name?
a) PHPSESSID
b) PHPSESID
c) PHPSESSIONID
d) PHPIDSESS
Answer: a
Explanation: You can change this name by using the session.name directive.
11.Which function is used to erase all session variables stored in the current
session?
a) session_destroy()
b) session_change()
c) session_remove()
d) session_unset()
Answer: d
Explanation: The function session_unset() frees all session variables that is
currently registered. This will not completely remove the session from the
storage mechanism. If you want to completely destroy the session, you need to
use the function session_destroy().
12. Which one of the following statements should you use to set the session
username to Nachi?
a) $SESSION[‘username’] = “Nachi”;
b) $_SESSION[‘username’] = “Nachi”;
c) session_start(“nachi”);
d) $SESSION_START[“username”] = “Nachi”;
Answer: b
Explanation: You need to refer the session variable ‘username’ in the context of
the $_SESSION superglobal.
13. Which function effectively deletes all sessions that have expired?
a) session_delete()
b) session_destroy()
c) session_garbage_collect()
d) SessionHandler::gc
Answer: d
Explanation: SessionHandler::gc is used to clean up expired sessions. It is called
randomly by PHP internally when a session_start() is invoked.
14. The session_start() function must appear _________
a) after the html tag
b) after the body tag
c) before the body tag
d) before the html tag
Answer: d
Explanation: Like this: <?php session_start(); ?> <html>
15. Which one of the following function checks for the existence of DNS
records?
a) checkdns()
b) checkdnsr()
c) checkdnsrr()
d) checkdnsa()
Answer: c
Explanation: The function checkdnsrr() is used to check DNS records for
type corresponding to host. DNS records are checked based on the supplied
host value and optional DNS resource record type, returning TRUE if any
records are located and FALSE otherwise.
16.What is the full form of DNS?
a) Digital Network System
b) Domain Network System
c) Digital Name System
d) Domain Name System
Answer: d
Explanation: DNS stands for domain name system. It is the way that internet
domain names are located and translated into internet protocol (IP) addresses.
For example, if someone types abc.com into the web browser, a server behind
the scenes will map that name to the IP address 206.16.49.139.
17. What is the default port number of HTTPs?
a) 70
b) 80
c) 90
d) 100
Answer: b
Explanation: By default, The port number HTTP uses is port 80 and HTTPS uses
port 443, but a URL like http://www.abc.com:8080/path/ specifies that the web
browser connects instead to port 8080 of the HTTP servers.
18.When you use the $_GET variable to collect data, the data is visible to
___________
a) none
b) only you
c) everyone
d) selected few
Answer: c
Explanation: The information sent from a form with the method GET is visible to
everyone i.e. all variable names and values are displayed in the URL.
19. The attack which involves the insertion of malicious code into a page
frequented by other users is known as _______________
a) basic sql injection
b) advanced sql injection
c) cross-site scripting
d) scripting
Answer: c
Explanation: The cross-site scripting attack is among one of the top five security
attacks carried out across the Internet. It is also known as XSS, this attack is a type
of code injection attack which is made possible by incorrectly validating user data,
which usually gets inserted into the page through a web form or using an altered
hyperlink.
20. Which one of the following should not be used while sending passwords or
other sensitive information?
a) GET
b) POST
c) REQUEST
d) NEXT
Answer: a
Explanation: The information sent from a form with the method GET is visible to
everyone i.e. all variable names and values are displayed in the URL. So, it
should not be used while sending passwords or other sensitive information.
21. To validate an email address, which flag is to be passed to the function
filter_var()?
a) FILTER_VALIDATE_EMAIL
b) FILTER_VALIDATE_MAIL
c) VALIDATE_EMAIL
d) VALIDATE_MAIL
Answer: a
Explanation: The FILTER_VALIDATE_EMAIL is used to validates an e-mail address.
22. When you use the $_POST variable to collect data, the data is visible to
___________
a) none
b) only you
c) everyone
d) selected few
Answer: b
Explanation: The information sent from a form with the method POST is
invisible to others i.e. all names/values are embedded within the body of the
HTTP request.
23. Which variable is used to collect form data sent with both the GET and
POST methods?
a) $BOTH
b) $_BOTH
c) $REQUEST
d) $_REQUEST
Answer: d
Explanation: In PHP the global variable $_REQUEST is used to collect data
after submitting an HTML form.
24. The Cookie manipulation is done using which property?
a) cookie
b) cookies
c) manipulate
d) modify
Answer: a
Explanation: The cookie property sets or returns all name/value pairs of cookies
in the current document. There are no methods involved: cookies are queried,
set, and deleted by reading and writing the cookie property of the Document
object using specially formatted strings.
25. What is the constraint on the data per cookie?
a) 2 KB
b) 1 KB
c) 4 KB
d) 3 KB
Answer: c
Explanation: Each cookie can hold up to only 4 KB. In practice, browsers allow
many more than 300 cookies total, but the 4 KB size limit may still be enforced
by some. Whereas storage of session is around a minimum of 5mb
26.Cookies were originally designed for __________
a) Client-side programming
b) Server-side programming
c) Both Client-side & Server-side programming
d) Web programming
Answer: b
Explanation: Cookies are data, stored in small text files, on your
computer. Cookies were originally designed for server-side programming,
and at the lowest level, they are implemented as an extension to the
HTTP protocol.
Like Share and Subscribe
KEEP WATHCING…

More Related Content

What's hot

Gta v savegame
Gta v savegameGta v savegame
Gta v savegamehozayfa999
 
ZendCon2010 Doctrine MongoDB ODM
ZendCon2010 Doctrine MongoDB ODMZendCon2010 Doctrine MongoDB ODM
ZendCon2010 Doctrine MongoDB ODMJonathan Wage
 
Command Bus To Awesome Town
Command Bus To Awesome TownCommand Bus To Awesome Town
Command Bus To Awesome TownRoss Tuck
 
Marrow: A Meta-Framework for Python 2.6+ and 3.1+
Marrow: A Meta-Framework for Python 2.6+ and 3.1+Marrow: A Meta-Framework for Python 2.6+ and 3.1+
Marrow: A Meta-Framework for Python 2.6+ and 3.1+ConFoo
 
PHP for Adults: Clean Code and Object Calisthenics
PHP for Adults: Clean Code and Object CalisthenicsPHP for Adults: Clean Code and Object Calisthenics
PHP for Adults: Clean Code and Object CalisthenicsGuilherme Blanco
 
Object Calisthenics Applied to PHP
Object Calisthenics Applied to PHPObject Calisthenics Applied to PHP
Object Calisthenics Applied to PHPGuilherme Blanco
 
The Testing Games: Mocking, yay!
The Testing Games: Mocking, yay!The Testing Games: Mocking, yay!
The Testing Games: Mocking, yay!Donny Wals
 
Symfony Day 2010 Doctrine MongoDB ODM
Symfony Day 2010 Doctrine MongoDB ODMSymfony Day 2010 Doctrine MongoDB ODM
Symfony Day 2010 Doctrine MongoDB ODMJonathan Wage
 
Design Patterns Reconsidered
Design Patterns ReconsideredDesign Patterns Reconsidered
Design Patterns ReconsideredAlex Miller
 
Decouple Your Code For Reusability (International PHP Conference / IPC 2008)
Decouple Your Code For Reusability (International PHP Conference / IPC 2008)Decouple Your Code For Reusability (International PHP Conference / IPC 2008)
Decouple Your Code For Reusability (International PHP Conference / IPC 2008)Fabien Potencier
 
Singletons in PHP - Why they are bad and how you can eliminate them from your...
Singletons in PHP - Why they are bad and how you can eliminate them from your...Singletons in PHP - Why they are bad and how you can eliminate them from your...
Singletons in PHP - Why they are bad and how you can eliminate them from your...go_oh
 
Security 202 - Are you sure your site is secure?
Security 202 - Are you sure your site is secure?Security 202 - Are you sure your site is secure?
Security 202 - Are you sure your site is secure?ConFoo
 
Обзор фреймворка Twisted
Обзор фреймворка TwistedОбзор фреймворка Twisted
Обзор фреймворка TwistedMaxim Kulsha
 
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011Masahiro Nagano
 
Object Calisthenics Adapted for PHP
Object Calisthenics Adapted for PHPObject Calisthenics Adapted for PHP
Object Calisthenics Adapted for PHPChad Gray
 
Nine Ways to Use Network-Side Scripting
Nine Ways to Use Network-Side ScriptingNine Ways to Use Network-Side Scripting
Nine Ways to Use Network-Side ScriptingLori MacVittie
 
You code sucks, let's fix it
You code sucks, let's fix itYou code sucks, let's fix it
You code sucks, let's fix itRafael Dohms
 
Python client api
Python client apiPython client api
Python client apidreampuf
 
Dependency injection-zendcon-2010
Dependency injection-zendcon-2010Dependency injection-zendcon-2010
Dependency injection-zendcon-2010Fabien Potencier
 
Topological indices (t is) of the graphs to seek qsar models of proteins com...
Topological indices (t is) of the graphs  to seek qsar models of proteins com...Topological indices (t is) of the graphs  to seek qsar models of proteins com...
Topological indices (t is) of the graphs to seek qsar models of proteins com...Jitendra Kumar Gupta
 

What's hot (20)

Gta v savegame
Gta v savegameGta v savegame
Gta v savegame
 
ZendCon2010 Doctrine MongoDB ODM
ZendCon2010 Doctrine MongoDB ODMZendCon2010 Doctrine MongoDB ODM
ZendCon2010 Doctrine MongoDB ODM
 
Command Bus To Awesome Town
Command Bus To Awesome TownCommand Bus To Awesome Town
Command Bus To Awesome Town
 
Marrow: A Meta-Framework for Python 2.6+ and 3.1+
Marrow: A Meta-Framework for Python 2.6+ and 3.1+Marrow: A Meta-Framework for Python 2.6+ and 3.1+
Marrow: A Meta-Framework for Python 2.6+ and 3.1+
 
PHP for Adults: Clean Code and Object Calisthenics
PHP for Adults: Clean Code and Object CalisthenicsPHP for Adults: Clean Code and Object Calisthenics
PHP for Adults: Clean Code and Object Calisthenics
 
Object Calisthenics Applied to PHP
Object Calisthenics Applied to PHPObject Calisthenics Applied to PHP
Object Calisthenics Applied to PHP
 
The Testing Games: Mocking, yay!
The Testing Games: Mocking, yay!The Testing Games: Mocking, yay!
The Testing Games: Mocking, yay!
 
Symfony Day 2010 Doctrine MongoDB ODM
Symfony Day 2010 Doctrine MongoDB ODMSymfony Day 2010 Doctrine MongoDB ODM
Symfony Day 2010 Doctrine MongoDB ODM
 
Design Patterns Reconsidered
Design Patterns ReconsideredDesign Patterns Reconsidered
Design Patterns Reconsidered
 
Decouple Your Code For Reusability (International PHP Conference / IPC 2008)
Decouple Your Code For Reusability (International PHP Conference / IPC 2008)Decouple Your Code For Reusability (International PHP Conference / IPC 2008)
Decouple Your Code For Reusability (International PHP Conference / IPC 2008)
 
Singletons in PHP - Why they are bad and how you can eliminate them from your...
Singletons in PHP - Why they are bad and how you can eliminate them from your...Singletons in PHP - Why they are bad and how you can eliminate them from your...
Singletons in PHP - Why they are bad and how you can eliminate them from your...
 
Security 202 - Are you sure your site is secure?
Security 202 - Are you sure your site is secure?Security 202 - Are you sure your site is secure?
Security 202 - Are you sure your site is secure?
 
Обзор фреймворка Twisted
Обзор фреймворка TwistedОбзор фреймворка Twisted
Обзор фреймворка Twisted
 
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
 
Object Calisthenics Adapted for PHP
Object Calisthenics Adapted for PHPObject Calisthenics Adapted for PHP
Object Calisthenics Adapted for PHP
 
Nine Ways to Use Network-Side Scripting
Nine Ways to Use Network-Side ScriptingNine Ways to Use Network-Side Scripting
Nine Ways to Use Network-Side Scripting
 
You code sucks, let's fix it
You code sucks, let's fix itYou code sucks, let's fix it
You code sucks, let's fix it
 
Python client api
Python client apiPython client api
Python client api
 
Dependency injection-zendcon-2010
Dependency injection-zendcon-2010Dependency injection-zendcon-2010
Dependency injection-zendcon-2010
 
Topological indices (t is) of the graphs to seek qsar models of proteins com...
Topological indices (t is) of the graphs  to seek qsar models of proteins com...Topological indices (t is) of the graphs  to seek qsar models of proteins com...
Topological indices (t is) of the graphs to seek qsar models of proteins com...
 

Similar to PHP Session - Mcq ppt

Php questions and answers
Php questions and answersPhp questions and answers
Php questions and answersDeepika joshi
 
Let's read code: the python-requests library
Let's read code: the python-requests libraryLet's read code: the python-requests library
Let's read code: the python-requests librarySusan Tan
 
Fnt Software Solutions Pvt Ltd Placement Papers - PHP Technology
Fnt Software Solutions Pvt Ltd Placement Papers - PHP TechnologyFnt Software Solutions Pvt Ltd Placement Papers - PHP Technology
Fnt Software Solutions Pvt Ltd Placement Papers - PHP Technologyfntsofttech
 
Top 100-php-interview-questions-and-answers-are-below-120816023558-phpapp01
Top 100-php-interview-questions-and-answers-are-below-120816023558-phpapp01Top 100-php-interview-questions-and-answers-are-below-120816023558-phpapp01
Top 100-php-interview-questions-and-answers-are-below-120816023558-phpapp01Tekblink Jeeten
 
Php5 certification mock exams
Php5 certification mock examsPhp5 certification mock exams
Php5 certification mock examsecho liu
 
Prueba de conociemientos Fullsctack NET v2.docx
Prueba de conociemientos  Fullsctack NET v2.docxPrueba de conociemientos  Fullsctack NET v2.docx
Prueba de conociemientos Fullsctack NET v2.docxjairatuesta
 
Designing CakePHP plugins for consuming APIs
Designing CakePHP plugins for consuming APIsDesigning CakePHP plugins for consuming APIs
Designing CakePHP plugins for consuming APIsNeil Crookes
 
Web Server and Web Technology Exam paper
Web Server and Web Technology Exam paperWeb Server and Web Technology Exam paper
Web Server and Web Technology Exam paperZairul Nizam
 
Zend Certification PHP 5 Sample Questions
Zend Certification PHP 5 Sample QuestionsZend Certification PHP 5 Sample Questions
Zend Certification PHP 5 Sample QuestionsJagat Kothari
 
Built-in query caching for all PHP MySQL extensions/APIs
Built-in query caching for all PHP MySQL extensions/APIsBuilt-in query caching for all PHP MySQL extensions/APIs
Built-in query caching for all PHP MySQL extensions/APIsUlf Wendel
 
Php interview questions
Php interview questionsPhp interview questions
Php interview questionssekar c
 
Php interview-questions and answers
Php interview-questions and answersPhp interview-questions and answers
Php interview-questions and answerssheibansari
 
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2Knowledge Center Computer
 
Php interview questions
Php interview questionsPhp interview questions
Php interview questionssubash01
 
501 - PHP MYSQL.pdf
501 - PHP MYSQL.pdf501 - PHP MYSQL.pdf
501 - PHP MYSQL.pdfAkashGohil10
 
Top 100 PHP Interview Questions and Answers
Top 100 PHP Interview Questions and AnswersTop 100 PHP Interview Questions and Answers
Top 100 PHP Interview Questions and AnswersVineet Kumar Saini
 

Similar to PHP Session - Mcq ppt (20)

Php questions and answers
Php questions and answersPhp questions and answers
Php questions and answers
 
PHP Quiz
PHP QuizPHP Quiz
PHP Quiz
 
Let's read code: the python-requests library
Let's read code: the python-requests libraryLet's read code: the python-requests library
Let's read code: the python-requests library
 
PHP Technical Question
PHP Technical QuestionPHP Technical Question
PHP Technical Question
 
Fnt Software Solutions Pvt Ltd Placement Papers - PHP Technology
Fnt Software Solutions Pvt Ltd Placement Papers - PHP TechnologyFnt Software Solutions Pvt Ltd Placement Papers - PHP Technology
Fnt Software Solutions Pvt Ltd Placement Papers - PHP Technology
 
Top 100-php-interview-questions-and-answers-are-below-120816023558-phpapp01
Top 100-php-interview-questions-and-answers-are-below-120816023558-phpapp01Top 100-php-interview-questions-and-answers-are-below-120816023558-phpapp01
Top 100-php-interview-questions-and-answers-are-below-120816023558-phpapp01
 
Php5 certification mock exams
Php5 certification mock examsPhp5 certification mock exams
Php5 certification mock exams
 
Spring security
Spring securitySpring security
Spring security
 
Prueba de conociemientos Fullsctack NET v2.docx
Prueba de conociemientos  Fullsctack NET v2.docxPrueba de conociemientos  Fullsctack NET v2.docx
Prueba de conociemientos Fullsctack NET v2.docx
 
Designing CakePHP plugins for consuming APIs
Designing CakePHP plugins for consuming APIsDesigning CakePHP plugins for consuming APIs
Designing CakePHP plugins for consuming APIs
 
Web Server and Web Technology Exam paper
Web Server and Web Technology Exam paperWeb Server and Web Technology Exam paper
Web Server and Web Technology Exam paper
 
Zend Certification PHP 5 Sample Questions
Zend Certification PHP 5 Sample QuestionsZend Certification PHP 5 Sample Questions
Zend Certification PHP 5 Sample Questions
 
Built-in query caching for all PHP MySQL extensions/APIs
Built-in query caching for all PHP MySQL extensions/APIsBuilt-in query caching for all PHP MySQL extensions/APIs
Built-in query caching for all PHP MySQL extensions/APIs
 
Php interview questions
Php interview questionsPhp interview questions
Php interview questions
 
Php interview-questions and answers
Php interview-questions and answersPhp interview-questions and answers
Php interview-questions and answers
 
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2
 
Php interview questions
Php interview questionsPhp interview questions
Php interview questions
 
php questions
php questions php questions
php questions
 
501 - PHP MYSQL.pdf
501 - PHP MYSQL.pdf501 - PHP MYSQL.pdf
501 - PHP MYSQL.pdf
 
Top 100 PHP Interview Questions and Answers
Top 100 PHP Interview Questions and AnswersTop 100 PHP Interview Questions and Answers
Top 100 PHP Interview Questions and Answers
 

More from Shaheen Shaikh

Internet of things (IOT)
Internet of things (IOT)Internet of things (IOT)
Internet of things (IOT)Shaheen Shaikh
 
IOT MCQ part3- Internet of Things
IOT MCQ part3- Internet of ThingsIOT MCQ part3- Internet of Things
IOT MCQ part3- Internet of ThingsShaheen Shaikh
 
Css ppt - Cascading Style Sheets
Css ppt - Cascading Style SheetsCss ppt - Cascading Style Sheets
Css ppt - Cascading Style SheetsShaheen Shaikh
 
Introduction to web technologies
Introduction to web technologiesIntroduction to web technologies
Introduction to web technologiesShaheen Shaikh
 
Fuzzy System and fuzzy logic -MCQ
Fuzzy System and fuzzy logic -MCQFuzzy System and fuzzy logic -MCQ
Fuzzy System and fuzzy logic -MCQShaheen Shaikh
 
Mcq for Online Exam Soft Computing
Mcq for Online Exam Soft Computing Mcq for Online Exam Soft Computing
Mcq for Online Exam Soft Computing Shaheen Shaikh
 

More from Shaheen Shaikh (10)

Internet of things (IOT)
Internet of things (IOT)Internet of things (IOT)
Internet of things (IOT)
 
IOT MCQ part3- Internet of Things
IOT MCQ part3- Internet of ThingsIOT MCQ part3- Internet of Things
IOT MCQ part3- Internet of Things
 
Mcq ppt Php- array
Mcq ppt Php- array Mcq ppt Php- array
Mcq ppt Php- array
 
Xml ppt
Xml pptXml ppt
Xml ppt
 
Css ppt - Cascading Style Sheets
Css ppt - Cascading Style SheetsCss ppt - Cascading Style Sheets
Css ppt - Cascading Style Sheets
 
Javascript MCQ
Javascript MCQJavascript MCQ
Javascript MCQ
 
Introduction to web technologies
Introduction to web technologiesIntroduction to web technologies
Introduction to web technologies
 
Fuzzy System and fuzzy logic -MCQ
Fuzzy System and fuzzy logic -MCQFuzzy System and fuzzy logic -MCQ
Fuzzy System and fuzzy logic -MCQ
 
Mcq for Online Exam Soft Computing
Mcq for Online Exam Soft Computing Mcq for Online Exam Soft Computing
Mcq for Online Exam Soft Computing
 
Genetic Algorithm
Genetic Algorithm Genetic Algorithm
Genetic Algorithm
 

Recently uploaded

Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxUnboundStockton
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
MICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptxMICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptxabhijeetpadhi001
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 

Recently uploaded (20)

Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docx
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
MICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptxMICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 

PHP Session - Mcq ppt

  • 1. Important MCQs For Online Exam Session and cookies User authentication
  • 2. 1. How many predefined variables does PHP use to authenticate a user? a) 1 b) 2 c) 3 d) 4 Answer: b Explanation: The variables PHP use to authenticate a user are $_SERVER[‘PHP_AUTH_USER’] and $_SERVER[‘PHP_AUTH_PW’]. 2. Which of the following variables does PHP use to authenticate a user? i) $_SERVER['PHP_AUTH_USER']. ii) $_SERVER['PHP_AUTH_USERS']. iii) $_SERVER['PHP_AUTH_PU']. iv) $_SERVER['PHP_AUTH_PW']. a)i) and ii) b) ii) and iv) c) i) and iv) d) ii) and iii) Answer: c Explanation: $_SERVER[‘PHP_AUTH_USER’] and $_SERVER[‘PHP_AUTH_PW’] store the username and password values, respectively.
  • 3. 3. Which of the following PHP function is commonly used when handling authentication via PHP? i) header() ii) footer() iii) inset() iv) isset() a)i) and iv) b) ii) and iv) c) ii) and iii) d) i) and iii) Answer: a Explanation: The function isset () is used to check whether a variable is set or not and the function header() sends a raw HTTP header to a client.
  • 4. 4. Which directive determines whether PHP scripts on the server can accept file uploads? a) file_uploads b) file_upload c) file_input d) file_intake Answer: a Explanation: With PHP, it is easy to upload files to the server. We need to ensure that PHP is configured to allow file uploads. In the “php.ini” file, search for the file_uploads directive, and set it to On. By default, its value is on. 5. If you want to temporarily store uploaded files in the /tmp/phpuploads/ directory, which one of the following statement will you use? a) upload_tmp_dir “/tmp/phpuploads/ directory” b) upload_dir “/tmp/phpuploads/ directory” c) upload_temp_dir “/tmp/phpuploads/ directory” d) upload_temp_director “/tmp/phpuploads/ directory” Answer: a Explanation: Anyone can temporarily store uploaded files on the given directory. One cannot change upload_tmp_dir at the runtime. By the time a script runs, the upload process has already occurred.
  • 5. 6. Which function is used to determine whether a file was uploaded? a) is_file_uploaded() b) is_uploaded_file() c) file_uploaded(“filename”) d) uploaded_file(“filename”) Answer: b Explanation: The function is_uploaded_file() checks whether the specified file is uploaded via HTTP POST. The syntax is is_uploaded_file(file). 7.Which one of the following is the very first task executed by a session enabled page? a) Delete the previous session b) Start a new session c) Check whether a valid session exists d) Handle the session Answer: c Explanation: The session variables are set with the PHP global variable which is $_SESSION. The very first task executed by a session enabled page is Check whether a valid session exists.
  • 6. 8. Which function is used to verify whether a variable contains a value? a) header() b) footer() c) inset() d) isset() Answer: d Explanation: The isset() function determines whether a variable has been assigned a value. Its prototype follows: boolean isset(mixed var [,mixed var [,…]]). 9. Which function is used to split a string into a series of substrings, with each string boundary is determined by a specific separator? a) break() b) divide() c) explode() d) md5() Answer: c Explanation: Although they are a similar function, you should use explode() instead of split(). In fact split() function has been deprecated altogether.
  • 7. 10. Which one of the following is the default PHP session name? a) PHPSESSID b) PHPSESID c) PHPSESSIONID d) PHPIDSESS Answer: a Explanation: You can change this name by using the session.name directive. 11.Which function is used to erase all session variables stored in the current session? a) session_destroy() b) session_change() c) session_remove() d) session_unset() Answer: d Explanation: The function session_unset() frees all session variables that is currently registered. This will not completely remove the session from the storage mechanism. If you want to completely destroy the session, you need to use the function session_destroy().
  • 8. 12. Which one of the following statements should you use to set the session username to Nachi? a) $SESSION[‘username’] = “Nachi”; b) $_SESSION[‘username’] = “Nachi”; c) session_start(“nachi”); d) $SESSION_START[“username”] = “Nachi”; Answer: b Explanation: You need to refer the session variable ‘username’ in the context of the $_SESSION superglobal. 13. Which function effectively deletes all sessions that have expired? a) session_delete() b) session_destroy() c) session_garbage_collect() d) SessionHandler::gc Answer: d Explanation: SessionHandler::gc is used to clean up expired sessions. It is called randomly by PHP internally when a session_start() is invoked.
  • 9. 14. The session_start() function must appear _________ a) after the html tag b) after the body tag c) before the body tag d) before the html tag Answer: d Explanation: Like this: <?php session_start(); ?> <html> 15. Which one of the following function checks for the existence of DNS records? a) checkdns() b) checkdnsr() c) checkdnsrr() d) checkdnsa() Answer: c Explanation: The function checkdnsrr() is used to check DNS records for type corresponding to host. DNS records are checked based on the supplied host value and optional DNS resource record type, returning TRUE if any records are located and FALSE otherwise.
  • 10. 16.What is the full form of DNS? a) Digital Network System b) Domain Network System c) Digital Name System d) Domain Name System Answer: d Explanation: DNS stands for domain name system. It is the way that internet domain names are located and translated into internet protocol (IP) addresses. For example, if someone types abc.com into the web browser, a server behind the scenes will map that name to the IP address 206.16.49.139. 17. What is the default port number of HTTPs? a) 70 b) 80 c) 90 d) 100 Answer: b Explanation: By default, The port number HTTP uses is port 80 and HTTPS uses port 443, but a URL like http://www.abc.com:8080/path/ specifies that the web browser connects instead to port 8080 of the HTTP servers.
  • 11. 18.When you use the $_GET variable to collect data, the data is visible to ___________ a) none b) only you c) everyone d) selected few Answer: c Explanation: The information sent from a form with the method GET is visible to everyone i.e. all variable names and values are displayed in the URL. 19. The attack which involves the insertion of malicious code into a page frequented by other users is known as _______________ a) basic sql injection b) advanced sql injection c) cross-site scripting d) scripting Answer: c Explanation: The cross-site scripting attack is among one of the top five security attacks carried out across the Internet. It is also known as XSS, this attack is a type of code injection attack which is made possible by incorrectly validating user data, which usually gets inserted into the page through a web form or using an altered hyperlink.
  • 12. 20. Which one of the following should not be used while sending passwords or other sensitive information? a) GET b) POST c) REQUEST d) NEXT Answer: a Explanation: The information sent from a form with the method GET is visible to everyone i.e. all variable names and values are displayed in the URL. So, it should not be used while sending passwords or other sensitive information. 21. To validate an email address, which flag is to be passed to the function filter_var()? a) FILTER_VALIDATE_EMAIL b) FILTER_VALIDATE_MAIL c) VALIDATE_EMAIL d) VALIDATE_MAIL Answer: a Explanation: The FILTER_VALIDATE_EMAIL is used to validates an e-mail address.
  • 13. 22. When you use the $_POST variable to collect data, the data is visible to ___________ a) none b) only you c) everyone d) selected few Answer: b Explanation: The information sent from a form with the method POST is invisible to others i.e. all names/values are embedded within the body of the HTTP request. 23. Which variable is used to collect form data sent with both the GET and POST methods? a) $BOTH b) $_BOTH c) $REQUEST d) $_REQUEST Answer: d Explanation: In PHP the global variable $_REQUEST is used to collect data after submitting an HTML form.
  • 14. 24. The Cookie manipulation is done using which property? a) cookie b) cookies c) manipulate d) modify Answer: a Explanation: The cookie property sets or returns all name/value pairs of cookies in the current document. There are no methods involved: cookies are queried, set, and deleted by reading and writing the cookie property of the Document object using specially formatted strings. 25. What is the constraint on the data per cookie? a) 2 KB b) 1 KB c) 4 KB d) 3 KB Answer: c Explanation: Each cookie can hold up to only 4 KB. In practice, browsers allow many more than 300 cookies total, but the 4 KB size limit may still be enforced by some. Whereas storage of session is around a minimum of 5mb
  • 15. 26.Cookies were originally designed for __________ a) Client-side programming b) Server-side programming c) Both Client-side & Server-side programming d) Web programming Answer: b Explanation: Cookies are data, stored in small text files, on your computer. Cookies were originally designed for server-side programming, and at the lowest level, they are implemented as an extension to the HTTP protocol.
  • 16. Like Share and Subscribe KEEP WATHCING…