Modulus operator is costly. The modulus operator (%) in various languages is costly operation. Ultimately every operator/operation must result in processor instructions. Some processors won’t… Read More »
Every literal (constant) in C/C++ will have a type information associated with it.
In C, if an object that has static storage duration is not initialized explicitly, then:
const Behaviour in C and C++ In C, the const qualified identifiers will have external linkage, where as in C++ it will have internal linkage.… Read More »
In C switch statement, the expression of each case label must be an integer constant expression.
Like C++, Java automatically creates default constructor if there is no default or parameterized constructor written by user, and (like C++) the default constructor automatically… Read More »
In C, struct keyword must be used for declaring structure variables, but it is optional in C++.
In Java, when final keyword is used with a variable of primitive data types (int, float, .. etc), value of the variable cannot be changed.
Unlike C/C++, static local variables are not allowed in Java. For example, following Java program fails in compilation with error “Static local variables are not… Read More »
Predict the output of following C programs.
Question 1 Predict the output of following program.
In Java, all objects are dynamically allocated on Heap. This is different from C++ where objects can be allocated memory either on Stack or on… Read More »
See this for detailed description. In Java, parameters are always passed by value. For example, following program prints i = 10, j = 20.
In C/C++, initialization of a multidimensional arrays can have left most dimension as optional. Except the left most dimension, all other dimensions must be specified.
Default virtual behavior of methods is opposite in C++ and Java: