The volatile keyword is intended to prevent the compiler from applying any optimizations on objects that can change in ways that cannot be determined by the compiler.
Read More »Given a Singly Linked List, write a function to delete a given node. Your function must follow following constraints:
Read More »How to write C functions that modify head pointer of a Linked List?
8 Comments | Filed under Linked ListsConsider simple representation (without any dummy node) of Linked List. Functions that operate on such Linked lists can be divided in two categories:
Read More »Consider the following Java program:
Read More »Like C++, Java also supports copy constructor. But, unlike C++, Java doesn’t create a default copy constructor if you don’t write your own.
Read More »Question 1 Predict the output of the following program. What does the following fun() do in general?
Read More »Predict the output of following C++ program.
Read More »The purpose of inheritance is same in C++ and Java. Inheritance is used in both languages for reusing code and/or creating is-a relationship. There are following differences in the way both languages provide support for inheritance.
Read More »Predict the output of following C Program.
Read More »Directly accessing Grandparent’s member in Java: Predict the output of following Java program.
Read More »Write a C program to find the smallest of three integers, without using any of the comparison operators.
Read More »Given two numbers represented by two lists, write a function that returns sum list. The sum list is list representation of addition of two input numbers.
Read More »Predict the output of following Java programs.
Read More »Difficulty Level: Rookie Predict the output of following Java Programs.
Read More »Given a cost matrix cost[][] and a position (m, n) in cost[][], write a function that returns cost of minimum cost path to reach (m, n) from (0, 0). Each cell of the matrix represents a cost to traverse through that cell.
Read More »In the virtual constructor idiom we have seen the way to construct an object whose type is not determined until runtime.
Read More »Given that integers are read from a data stream. Find median of elements read so for in efficient way. For simplicity assume there are no duplicates. For example, let us consider the stream 5, 15, 1, 3 … After reading 1st element of stream – 5 -> median – 5 After reading 2nd element of [...]
Read More »Can we make a class constructor virtual in C++ to create polymorphic objects?
Read More »Question 1 Consider the following recursive C function. Let len be the length of the string s and num be the number of characters printed on the screen
Read More »Predict the output of following C++ programs.
Read More »Given a boolean matrix mat[M][N] of size M X N, modify it such that if a matrix cell mat[i][j] is 1 (or true) then make all the cells of ith row and jth column as 1.
Read More »Predict the output of following C programs.
Read More »A class declared inside a function becomes local to that function and is called Local Class in C++. For example, in the following program, Test is a local class in fun().
Read More »Predict the output of following program?
Read More »Trie is an efficient information retrieval data structure. Using trie, search complexities can be brought to optimal limit (key length).
Read More »