WP - Viva Questions
WP - Viva Questions
CodeIgniter
CakePHP
Symfony
Zend Framework
Yii 2
10. Name the popular Content Management Systems (CMS) in PHP.
WordPress
Joomla
Magento
Drupal
11. What is PEAR in PHP?
PEAR stands for PHP Extension and Application Repository and is an online
repository of free, open-source PHP software packages. It was created as a
centralized platform to manage, develop and distribute reusable PHP
components. PEAR provides various packages and functions, from database and
networking to file system access and remote process control. It also includes
robust tools to help developers quickly and easily create web-based applications
and services.
15. What are the rules to determine the "truth" of any value not already of the
Boolean type?
In PHP, the "truth" of any value is determined by the following rules: a value is
considered "true" if it is a non-zero number or a non-empty string. Any other
matters, such as an empty string or zero value, are considered false.
Additionally, an array is considered accurate if it contains at least one element
and false if it is open. Null is also regarded as wrong.
19. What are the differences between PHP constants and variables?
One of the most significant differences between PHP constants and variables is
their scope. In PHP, constants are global, meaning they are accessible in all
parts of an application, while variables are generally only accessible in the area
where they were declared. Additionally, constants must be explicitly defined
before they can be used, while variables can be said without initializing them.
Integers: these are whole numbers without a decimal point, like 4195.
Doubles: are floating-point numbers, like 3.14159 or 49.1.
Booleans: come with only possible values of either true or false.
NULL: is a special type with only one value: NULL.
Strings: are sequences of characters.
Arrays: are named and indexed set of other values.
Objects: are f programmer-defined classes, which can include both other kinds
of values and functions that are specific to the class.
Resources: are special variables that refer to resources external to PHP (such as
database connections).
30. List the main types of errors in PHP and explain their differences.
There are three main error types in PHP:
Notices. These are non-critical errors that can occur during the script execution.
These are not visible to users. Accessing an undefined variable is an example of
a 'Notice'.
Warnings. These are more critical than Notices, but just like them, Warnings
don't interrupt the script execution. However, these are visible to the user by
default. Example: include() a file that doesn't exist.
Fatal. This is the most critical error type which, when occurs, immediately
terminates the script execution. Accessing a property of a non-existent object or
require() a non-existent file is an example of this error type
31. What are 'Traits'?
A mechanism that lets you create reusable code in PHP and similar languages
where multiple inheritances are not supported is called Traits. It's not possible to
instantiate it on its own.
32. Can the value of a constant change during the script’s execution?
No, the value of a constant cannot be changed once it’s declared during the PHP
execution.
33. Name and define the three scope levels available in PHP.
Private – Detectable only in its own class
Public – Can be seen by any other code accessing the class
Protected – Can be seen by classes parent(s) and classes that extend the current
class
34. What do we mean by ‘escaping to PHP’?
The PHP parsing engine must be able to distinguish PHP code from other page
elements. The mechanism to achieve this is called ‘escaping to PHP’.
36. What are the two most common ways to start and finish a PHP code block?
When writing a PHP block of code, the two most common ways to start and
finish it are by using the opening tag.
JAVASCRIPT
1. What are the differences between Java and JavaScript?
Java is an object Oriented Programming language while JavaScript is a client-
side scripting language. Both of them are totally different from each other.
13. Explain the working of timers in JavaScript. Also explain the drawbacks of
using the timer, if any.
The timer executes some specific code at a specific time or any small amount of
code in repetition to do that you need to use the functions setTimout,
setInterval, and clearInterval. If the JavaScript code sets the timer to 2 minutes
and when the times are up then the page displays an alert message “times up”.
The setTimeout() method calls a function or evaluates an expression after a
specified number of milliseconds.
Geeks = 42;
Geeks = "ST.ANNES";
18. How to convert the string of any base to integer in JavaScript?
In JavaScript, parseInt() function is used to convert the string to an integer. This
function returns an integer of base which is specified in second argument of
parseInt() function. The parseInt() function returns Nan (not a number) when
the string doesn’t contain number.
19. Explain how to detect the operating system on the client machine?
To detect the operating system on the client machine, one can simply use
navigator.appVersion or navigator.userAgent property. The Navigator
appVersion property is a read-only property and it returns the string that
represents the version information of the browser.
Alert
Confirm
Prompt
21. What is the difference between an alert box and a confirmation box?
An alert box will display only one button which is the OK button. It is used to
inform the user about the agreement has to agree. But a Confirmation box
displays two buttons OK and cancel, where the user can decide to agree or not.