Category Archives: C++

Amazon interview questions

Given a Binary Search Tree, write a program to print the kth smallest element without using any static/global variable. You can’t pass the value k to any function also.
What are the 4 basics of OOP?
Define Data Abstraction. What is its importance?
Given an array of size n. It contains numbers in the range 1 to n. [...]

Also posted in Database, General | 12 Comments

C++ interview questions and answers

What is the most efficient way to reverse a linklist?
How to sort & search a single linklist?
Which is more convenient - single or double-linked linklist? Discuss the trade-offs? What about XOR-linked linklist?
How does indexing work?
char s[10];
What will be the output? Is there any error with this code?
What is the difference between
char s[]=”Hello”;
char *s=”Hello”;
Please give a [...]

Posted in C++ | 19 Comments

Some C++ interview questions

What is a void return type?
How is it possible for two String objects with identical values not to be equal under the == operator?
What is the difference between a while statement and a do statement?
Can a for statement loop indefinitely?
How do you link a C++ program to C functions?
How can you tell what shell you [...]

Posted in C++ | 28 Comments

Implement itoa

Implementing itoa function is a popular interview question. Here’s one implementation from SAP.

char *itoa(int value)
int count, /* number of characters in string */
i, [...]

Also posted in General | Leave a comment

Hardware architecture interview questions

Are you familiar with the term MESI?
Are you familiar with the term snooping?
Describe a finite state machine that will detect three consecutive coin tosses (of one coin) that results in heads.
In what cases do you need to double clock a signal before presenting it to a synchronous state machine?
You have a driver that drives a [...]

Also posted in Hardware | 22 Comments

Tricky C questions

How do you write a program which produces its own source code as its output?
How can I find the day of the week given the date?
Why doesn’t C have nested functions?
What is the most efficient way to count the number of bits which are set in a value?
How can I convert integers to binary or [...]

Posted in C++ | 71 Comments

C++ developer interview

Will the following program execute?void main()
void *vptr = (void *) malloc(sizeof(void));
How about this one?
void main()
char *cptr = 0?2000;
long *lptr = 0?2000;
printf(” %x %x”, cptr, lptr);
}Will it execute or not?
When the processor wakes up after power on, it goes to a particular memory location. What is that memory location called?
What is the difference between Mutex and [...]

Posted in C++ | 22 Comments

C questions for a hardware engineer

What are the total number of lines written in C/C++? What is the most complicated/valuable program written in C/C++?
What compiler was used?
Have you studied buses? What types?
Have you studied pipelining? List the 5 stages of a 5 stage pipeline. Assuming 1 clock per stage, what is the latency of an instruction in a 5 stage [...]

Also posted in Hardware | 12 Comments

C++ interview questions and answers

This set of C++ interview questions was sent to TechInterviews from Australia:

What is the difference between an ARRAY and a LIST?
What is faster : access the element in an ARRAY or in a LIST?
Define a constructor - what it is and how it might be called (2 methods).
Describe PRIVATE, PROTECTED and PUBLIC – the differences [...]

Posted in C++ | 11 Comments

C++ notes for discussion

This is not really a set of interview questions, a reader sent what looks like a copy of his notes from C++ class that describes various tricks and code for C++.

What is the output of printf(“%d”)?

%d helps to read integer data type of a given variable
when we write (“%d”, X) compiler will print [...]

Posted in C++ | 21 Comments

Some general quickies

How did you first get interested in Computer Science?
What do you like to do best related to computers now (programming, administration, testing, manage projects, etc)? What is it about that area that you specifically enjoy?
What is your strongest programming language (Java, ASP, C, C++, VB, HTML,C#, etc.)?
When is the last time you [...]

Also posted in General | 1 Comment

Embedded firmware interview questions

Write function in C that gets array of chars, and search for the longest sequence of repeatedly 1 bits. It returns the the first bit place in the sequence and the number of 1 bits in the sequence. - (a) loop of 2^0, 2^1, … , 2^7 is done with 1<<j when 0<=j<=7. (b) Take [...]

Also posted in Hardware | 2 Comments