skip to main |
skip to sidebar
RSS Feeds
Technical interview questions for software engineers — languages, databases, cloud, DevOps, and CS fundamentals.
Technical interview questions for software engineers — languages, databases, cloud, DevOps, and CS fundamentals.
Technical interview questions for software engineers — languages, databases, web, cloud, DevOps, and fundamentals. Browse all topics.
Posted by Raj
Interviewers ask, "How does IAM policy inheritance work? Can a child remove a parent's grant?" because they want to know: Do you understand that allow policies are additive, and that you cannot 'override' a parent? This post gives you a ready 30-second answer, the concept in plain English, common mistakes and tips for different roles. It is question 2 of the top 10 GCP resource hierarchy and IAM interview questions.
Short answer (30 seconds): Allow policies are additive. The effective access on a resource is the combination of its own policy and every parent's policy. So if a user gets Viewer at folder level, I cannot take that away at the project level by simply not granting it there. If I need to block access, I use an IAM deny policy, or I fix the grant at the level where it was given. That is why I grant at the lowest level that still makes sense.
Do you understand that allow policies are additive, and that you cannot 'override' a parent?
Easy picture: A master key given at floor level opens every room on that floor. The room manager cannot take that key back. You must change it at the floor, or add an extra lock (a deny policy).
gcloud projects get-iam-policy PROJECT_ID
gcloud resource-manager folders get-iam-policy FOLDER_ID
# See all policies that apply to a resource
gcloud asset analyze-iam-policy --organization=ORG_ID --full-resource-name=//cloudresourcemanager.googleapis.com/projects/PROJECT_ID
Replace ORG_ID, FOLDER_ID and PROJECT_ID with your own values. Check gcloud help for current flags before you use a command.
| Role | What to emphasise |
|---|---|
| Architect | Decide at which level each persona gets access; document it as the access model. |
| Data Engineer | Grant dataset-level roles instead of project-wide BigQuery Admin. |
| DevOps Engineer | Manage bindings in Terraform at the right level; avoid per-project copies. |
| Platform Engineer | Bake group-based bindings into the project factory template. |
Mention deny policies. Many candidates only know 'additive' and stop there.
Disclaimer: This blog is independent and not affiliated with or endorsed by Google. Google Cloud features, limits and commands change, so always check the current documentation. Official references: Resource hierarchy, IAM policy types, IAM quotas and limits.
Posted by Raj
Interviewers ask, "Explain the GCP resource hierarchy. Why does it matter?" because they want to know: Do you understand the foundation, and do you know why it matters for security, cost and blast radius? This post gives you a ready 30-second answer, the concept in plain English, common mistakes and tips for different roles. It is question 1 of the top 10 GCP resource hierarchy and IAM interview questions.
Short answer (30 seconds): GCP has four levels: Organization at the top, then Folders, then Projects, then the actual resources like VMs and buckets. The Organization is tied to our Cloud Identity or Workspace domain. The hierarchy matters because IAM policies and Org Policies flow down from parent to child. So I set rules once at a high level and every project below gets them. It also decides who pays, who can do what, and how big the blast radius is when something goes wrong.
Do you understand the foundation, and do you know why it matters for security, cost and blast radius?
Easy picture: Think of a building. The company is the Organization, each floor is a Folder, each room is a Project, and the furniture is the Resources. A rule on the front door applies to every floor and room.
gcloud organizations list
gcloud resource-manager folders list --organization=ORG_ID
gcloud projects list --filter='parent.id=FOLDER_ID'
Replace ORG_ID, FOLDER_ID and PROJECT_ID with your own values. Check gcloud help for current flags before you use a command.
| Role | What to emphasise |
|---|---|
| Architect | Design folder layout by environment and risk, not by org chart. |
| Data Engineer | Separate raw, curated and sandbox projects so access and cost are clear. |
| DevOps Engineer | Automate project creation so every new project lands in the right folder. |
| Platform Engineer | Offer 'project factory' as a self-service product with guardrails built in. |
Say 'inheritance, billing and blast radius' - three words that show you think beyond the diagram.
Disclaimer: This blog is independent and not affiliated with or endorsed by Google. Google Cloud features, limits and commands change, so always check the current documentation. Official references: Resource hierarchy, IAM policy types, IAM quotas and limits.
Posted by Raj
<?php
ini_set("display_errors",1);
$dbhost = 'localhost'; // Datatbase host name.
$dbuser = 'root'; // Database user name
$dbpass = '123'; // database password
$dbname="testdb"; // database name;
system("cd c:\\wamp\\bin\\mysql\\mysql5.5.24\\bin & mysqldump --opt -h $dbhost -u$dbuser -p$dbpass $dbname>c:\\wamp\\backup\\backup.sql");
?>
cd c:\wamp\bin\mysql\mysql5.5.24\bin
@echo off
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set dt=%%c-%%a-%%b)
mysqldump --opt -h localhost -uroot -p123 testdb>c:\wamp\backup\testdb_%dt%.sql
Posted by Raj
| Departments Table : | |
| id | Name |
| 1 | Accounts |
| 2 | R&D |
| 3 | Sales |
| Employees Table : | |||
| id | Name | Salary | Department Id |
| 1 | Rajesh | 50000 | 2 |
| 2 | Sachin | 80000 | 2 |
| 3 | Rahul | 20000 | 1 |
Update employees
inner join departments ON empoyees.department_id=departments.id
SET employees.salary=40000
WHERE employees.salary>50000 and department.name='R&D'
DELETE employees
inner join departments ON empoyees.department_id=departments.id
WHERE employees.salary>50000 and department.name='R&D'
<?php
$host = 'localhost:3036';
$user = 'root';
$pass = 'rootpassword';
$conn = mysql_connect($host, $user, $pass);
mysql_select_db('sampledb');
$sql = "Update employees
join departments ON empoyees.department_id=departments.id
SET employees.salary=40000
WHERE employees.salary>50000 and department.name='R&D'";
$result = mysql_query( $sql, $conn );
echo "data updated successfully\n";
mysql_close($conn);
?>
Posted by Raj
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
function initialize() {
map = new google.maps.Map(document.getElementById("gmap"), {
zoom:13,
center: new google.maps.LatLng(18.520430, 73.856744),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
p = new google.maps.Polygon({
strokeWeight: 3,
fillColor: '#5555FF'
});
p.setMap(map);
p.setPaths(new google.maps.MVCArray([path]));
google.maps.event.addListener(map, 'click', addMarker);
}
/** * Handles click events on a map, and adds a new point to the Polyline.*/
function addMarker(event) {
path.insertAt(path.length, event.latLng); //The path element used to draw polygon and polylines.
var marker = new google.maps.Marker({
position: event.latLng,
map: map,
draggable: true
});
markers.push(marker);
google.maps.event.addListener(marker, 'click', function() {
marker.setMap(null);
for (var i = 0, I = markers.length; i < I && markers[i] != marker; ++i);
markers.splice(i, 1);
path.removeAt(i);
}
);
google.maps.event.addListener(marker, 'dragend', function() {
for (var i = 0, I = markers.length; i < I && markers[i] != marker; ++i);
path.setAt(i, marker.getPosition());
}
);
}
function findAddress(address) {
if (!address)
var address=document.getElementById("address").value;
if ((address != '') && geocoder) {
geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {
if (results && results[0] && results[0].geometry && results[0].geometry.viewport)
map.fitBounds(results[0].geometry.viewport);
} else {
alert("No results found");
}
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
}
<html>
<title>Create Complex polygon on Gmap using Google Maps API v3</title>
<head>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
var poly, map;
var markers = [];
var path = new google.maps.MVCArray;
var geocoder = new google.maps.Geocoder();
function initialize() {
map = new google.maps.Map(document.getElementById("gmap"), {
zoom:13,
center: new google.maps.LatLng(18.520430, 73.856744),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
p = new google.maps.Polygon({
strokeWeight: 3,
fillColor: '#5555FF'
});
p.setMap(map);
p.setPaths(new google.maps.MVCArray([path]));
google.maps.event.addListener(map, 'click', addMarker);
}
function addMarker(event) {
path.insertAt(path.length, event.latLng); //The path element used to draw polygon and polylines.
var marker = new google.maps.Marker({
position: event.latLng,
map: map,
draggable: true
});
markers.push(marker);
google.maps.event.addListener(marker, 'click', function() {
marker.setMap(null);
for (var i = 0, I = markers.length; i < I && markers[i] != marker; ++i);
markers.splice(i, 1);
path.removeAt(i);
}
);
google.maps.event.addListener(marker, 'dragend', function() {
for (var i = 0, I = markers.length; i < I && markers[i] != marker; ++i);
path.setAt(i, marker.getPosition());
}
);
}
function findAddress(address) {
if (!address)
var address=document.getElementById("address").value;
if ((address != '') && geocoder) {
geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {
if (results && results[0] && results[0].geometry && results[0].geometry.viewport)
map.fitBounds(results[0].geometry.viewport);
} else {
alert("No results found");
}
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
}
}
</script>
</head>
<body style="margin:0px; padding:0px;" onLoad="initialize()">
Find Place: <input type="text" id="address"/><input type="button" value="Go" onClick="findAddress()">
<div id="gmap" style="width:100%; height: 580;"></div>
</body>
</html>