Common Q sets
Common Q sets
Describe traits.
RestFul APi?
• GET: This is used for fetching details from the server and is basically a read-only
operation.
• POST: This method is used for the creation of new resources on the server.
• PUT: This method is used to update the old/existing resource on the server or to
replace the resource.
• DELETE: This method is used to delete the resource on the server.
• PATCH: This is used for modifying the resource on the server.
• OPTIONS: This fetches the list of supported options of resources present on the
server.
What is API authentication?
API authentication verifies that a user is who they claim to be. There are
many types of API authentication.
1. API Key-value
2. Token
3. Oauth 2 SSO
4. Bearer Token
After you prove the user's identity, you can check which data that user is
allowed to access. That process is authorization. Authorization ensures
that the user is authorized to view or edit a specific set of data.
Synchronous:
Asynchronous:
Callbacks:
These are functions that are passed as arguments to other functions and
are executed when the asynchronous operation completes.
Promises:
Async/Await:
Employees table
Here is a question set based on the provided topics with answers. The
topics are categorized by their level of difficulty or expertise:
Jenkins - A
PHP 8 - A
GIT - PA (Proficiency/Advanced)
Cherry-pick - PA
Git Fork - PA
Profilers - NA
Composer - A
Named Arguments - A
Type Hinting - A
PSR - A
PHP Autoloading - A
Namespaces - A
Method Overloading - PA
Multiple Inheritance - A
Traits - A
Abstract Class/Interface - A
1. What are PHPCS, PHPMD, and PHPCPD, and how are they
useful in PHP development?
a. Answer:
i. PHPCS (PHP CodeSniffer): Ensures that PHP code
adheres to a coding standard.
ii. PHPMD (PHP Mess Detector): Detects potential issues
and design problems in PHP code.
iii. PHPCPD (PHP Copy Paste Detector): Identifies
duplicate code blocks in PHP codebases.
Sessions - A
GuzzleHTTP - A
Basic Auth - A
CURL - A
SOLID - A
OAuth - Basics
CI/CD Jenkins - PA
MySQL - Joins - A
the left table and matching rows from the right table. If there is no
match, NULL values are returned for the right table's columns.
Angular - A
JS - Event Loop
Jenkins
PHP 8
Cherry-pick
Git Fork
XDebug
PHPUnit
Composer
Named Arguments
PSR
PHP AutoLoading
Method Overloading
Traits
Abstract Class/Interface
GuzzleHTTP
1. Q: What is GuzzleHTTP?
a. A: GuzzleHTTP is a PHP HTTP client that allows you to send
HTTP requests, handle responses, and integrate with APIs. It
supports features like asynchronous requests and
middleware.
Basic Auth
CURL
Design Patterns
SOLID
OAuth
CI/CD Jenkins
Angular
1. Q: What is Angular?
a. A: Angular is a platform and framework for building single-
page web applications (SPAs) using TypeScript and other web
technologies. It provides tools for building efficient, scalable
web apps with features like two-way data binding and
dependency injection.
Interceptors
LazyLoading
JavaScript
Jenkins
PHP 8
GIT
Cherry-pick
XDebug
PHPUnit
Composer
PHP AutoLoading
Method Overloading
SOLID Principles
$singleton = Singleton::getInstance();
MySQL
1. Q: Write a query to retrieve all users who have made more than
5 purchases from the database.
a. A: SELECT users.name, COUNT(purchases.id) AS
purchase_count
FROM users
JOIN purchases ON users.id = purchases.user_id
GROUP BY users.id
HAVING purchase_count > 5;
Angular
JavaScript Promises
fetchData().then(data => {
console.log(data);
}).catch(error => {
console.log(error);
});
Event Propagation
CURL in PHP
OAuth
Jenkins
PHP 8
GIT
1. Q: How do you undo the last commit in Git without losing your
changes?
a. A: Use the git reset command with the --soft option: git reset -
-soft HEAD~1
2. Q: How can you list all branches, both local and remote, in Git?
a. A: Use the following command: git branch -a
PHPUnit
React JS
function Child(props) {
return <h1>{props.message}</h1>;
}
function increment() {
setCount(count + 1);
}
static getDerivedStateFromError(error) {
return { hasError: true };
}
componentDidCatch(error, info) {
console.log(error, info);
}
render() {
if (this.state.hasError) {
return <h1>Something went wrong.</h1>;
}
return this.props.children;
}
}
JavaScript Promises
OAuth
SOLID Principles
PHP AutoLoading
CURL in PHP
1. Q: How can you make a POST request with data in PHP using
cURL?
a. A: $ch = curl_init('https://api.example.com/submit');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, [
'name' => 'John',
'email' => '[email protected]'
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
Here’s another set of programming questions that covers various topics,
including React JS, PHP, Git, and more:
Jenkins
PHP 8
GIT
PHPUnit
React JS
return (
<form onSubmit={handleSubmit}>
<input
type="text"
value={name}
onChange={(e) => setName(e.target.value)}
/>
<button type="submit">Submit</button>
</form>
);
}
// useReducer example
const initialState = { count: 0 };
const reducer = (state, action) => {
switch (action.type) {
case 'increment':
return { count: state.count + 1 };
case 'decrement':
return { count: state.count - 1 };
default:
return state;
}
};
const [state, dispatch] = useReducer(reducer, initialState);
function MyComponent() {
const theme = useContext(ThemeContext);
return <div className={`theme-${theme}`}>Hello, world!</div>;
}
MySQL
SOLID Principles
$token = json_decode($response)->access_token;
Design Patterns
class AnimalFactory {
public static function create($animalType) {
switch ($animalType) {
case 'dog':
return new Dog();
case 'cat':
return new Cat();
default:
throw new Exception("Animal type not supported");
}
}
}
$animal = AnimalFactory::create('dog');
echo $animal->speak(); // Output: Bark