Zaki Mirza’s Blog


… About software and beyond!

Late Night Bloggin’: Bentley and the ‘double’ trouble quiz

Working at Bentley has been a great experience for me. Partly because of the great enviornment but mostly because of the problems I faced during coding one of the new features in the Microstation PlantSpace Designer Series. The problems ranged from  creating quick documentation solution to document lots of vb6 codebase in python to dealing with a massive Microstation API to solving a series of problems that required inventing new data-structures, dealing with graphs and adjacency lists and developing algorithms to traverse the graph in a specific manner which wernt supported in the API. (i shall be writing about them soon).

Since i was dealing with 3d elements, handling points in 3d space was unavoidable. Engineering applications (such as the CAD/CAM category, in which PSDS lies as well) are designed to cater a divesture of standards in terms of metrics used. In the core of the software though a uniform format is used to represent values. For example a point in 3d space can be represented in many differnet formats (inches, feet, fractions etc). The format used to represent the same point in the underlying software architecture in PSDS is usually a ‘double’ (since we’re working in C – or a subset of C called MDL: microstation developer language, and yes i was creating my own adjacency lists in C and traversing them recursively). So basically the x,y and z coordinates of the point are representated as a structure of 3 doubles.

One way to compare two points (and well the most obvious way) is to calculate the distance between the two points using the distance formula. Thats all well and solved and thats not the quiz. The quiz is, given two double values, how do you compare the two to N decimal places? In other words how would you compare two points to see if they are “close enough”. (and that can be anything from being equal to 5 decimal places or being absolutely equal).


Filed under: Late Night Blog, quiz, , ,

quiz #4: My Contextual Switch!

Here’s really deep down dirty one. Even i havnt been able to answer this one as such, but nonetheless here it goes. (I’m taking up the responsibility of being the Teacher Assistant for the operating systems course for a telecommunications batch, i shall try to answer this completely in a short while. Have your shot! )

How do you go about calculating the time it takes to context switch in a unix enviornment?

I read this question somewhere as a question asked in a google interview. Its really intresting and requires a deep knowledge and concept of the core system. (or so i guess?)

Filed under: linux, programming, quiz, , ,

Quiz #3: What if there were no ‘if’?

Last monday i reached office pretty late since i had to attend my lectures at univ. There was a power fluctuation problem in the whole building and the MIS had requested everyone not to turn on their PCs. So most of the people were either chilling in their cabins chatting or had left. I hung out for a while with a bunch of senior FAST graduates discussing some tecchie gossip and then i moved to the break room. There were some other employees sitting there and were discussing a very thoughtful problem. The problem being my quiz number 3. Its goes something like this:

Given a language that does not have an IF construct, how do you go on about executing different code over a condition? For example call code-block A if condition C is true, and B is condition C is false.

The discussion was going on among some 4-5 employees and since they were pretty seniour to me, (me being just another intern) i was un-noticed. Anyways, have your say in it and ill answer this shortly from my own perspective. (maybe its one of those interview questions, but then again its intresting).

Filed under: programming, quiz, ,

Quiz #2 – Tree Problem (DS)

My brother put this question to me a couple of years ago. Then i found myself having to deal with it in my datastructures project. here it is: 

Suppose you have a tree. A binary tree (for something like simplicity :p). You are traversing it (using infix, postfix or prefix) to search for a node. You find your required node. You just realized that you need to know the path from this node back to the root node (and/or vice versa). Given the following description of the structure of the tree node that you “cant” change:

struct node{Data data; node *right,*left;};

what will you strategy be to tackle this problem.

To make it more intresting (or maybe just the application of the above problem) suppose you find the node A and a node B in consecutive searches. Now what will your strategy be to show a path from A to B. (not neccesarily from the root of the whole tree, but possibly).

 Dont peek in the comments please. Think about it. Rule of pinky: Be honest to yourself atleast :p

You can make any assumption, but dont forget to state it with your solution.

Filed under: programming, quiz

Quick C++ Quiz #1

Im starting a little section for C++ quizes. Im nowhere near a C++ wizard. Just something i learn from here and there and ill put em up as food for thought for all my readers. Part 2 ready as well lets c.

consider this :


 int main(int argc, char** argv){
int a();

Whats the problem with above code if any. Also, what do you think the above code does (or tries to do?) what is ‘a’?

Filed under: C++, programming, quiz

Blog Stats

  • 104,874 landed here so far...
February 2019
« Jan    


Error: Twitter did not respond. Please wait a few minutes and refresh this page.

RSS Google Shared Items

  • An error has occurred; the feed is probably down. Try again later.

RSS Google Reader Starred Items

  • An error has occurred; the feed is probably down. Try again later.

Top Clicks

  • None