Browsing the topic GFacts
Directly accessing Grandparent’s member in Java: Predict the output of following Java program.
Read More »Default parameters for templates in C++: Like function default arguments, templates can also have default arguments. For example, in the following program, the second parameter U has the default value as char.
Read More »In C++, if a derived class redefines base class member method then all the base class methods with sane name become hidden in derived class.
Read More »Consider the following prototype of free() function which is used to free memory allocated using malloc() or calloc() or realloc().
Read More »Spaghetti stack A spaghetti stack is an N-ary tree data structure in which child nodes have pointers to the parent nodes (but not vice-versa)
Read More »Space Complexity: The term Space Complexity is misused for Auxiliary Space at many places.
Read More »Consider the following algorithm for building a Heap of an input array A.
Read More »Interpolation search works better than Binary Search for a sorted and uniformly distributed array.
Read More »Following two algorithms are generally taught for Minimum Spanning Tree (MST) problem.
Read More »In C, fseek() should be preferred over rewind().
Read More »Access specifiers for classes or interfaces in Java: In Java, methods and data members of a class/interface can have one of the following four access specifiers. The access specifiers are listed according to their restrictiveness order.
Read More »Initialization of static variables in C: In C, static variables can only be initialized using constant literals. For example, following program fails in compilation.
Read More »Static blocks in Java Unlike C++, Java supports a special block, called static block (also called static clause) which can be used for static initializations of a class.
Read More »Result of comma operator as l-value: Using result of comma operator as l-value is not valid in C. But in C++, result of comma operator can be used as l-value if the right operand of the comma operator is l-value.
Read More »In C++, this pointer is passed as a hidden argument to all non-static member function calls. The type of this depends upon function declaration. If the member function of a class X is declared const, the type of this is const X* (see code 1 below),
Read More »In C++, a structure is same as class except the following differences:
Read More »In C++ and Java, functions can not be overloaded if they differ only in the return type.
Read More »The order of operands of logical operators &&, || are important in C/C++.
Read More »In Java, all methods in an interface are public even if we do not specify public with method names. Also, data fields are public static final even if we do not mention it with fields names. Therefore, data fields must be initialized.
Read More »ASCII NUL, ASCII 0 (’0′) and Numeric literal 0.
Read More »Endian order and binary files While working with binary files, how do you measure their endianness?
Read More »Critical Section: In simple terms a critical section is group of instructions/statements or region of code that need to be executed atomically (read this post for atomicity), such as accessing a resource (file, input or output port, global data, etc.).
Read More »In Java, it is compiler error to give more restrictive access to a derived class function which overrides a base class function.
Read More »In C, the only operation that can be applied to struct variables is assignment. Any other operation (e.g. equality check) is not allowed on struct variables.
Read More »In Java, constructor of base class with no argument gets automatically called in derived class constructor. For example, output of following program is:
Read More »