Skip to content
Gblog First Step to DSA – Scholarship Test For 9 to 12 Class Students
“Start Early even if your destination is quite far away” – this success mantra always works for everyone whether it be a student, a sportsperson,… Read More
In Java, when final keyword is used with a variable of primitive data types (int, float, .. etc), value of the variable cannot be changed.… Read More
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 #include<stdio.h> int fun() {   static int num = 40;   return num--; }    int main() {… Read More
Question 1 Predict the output of the following program.  C++ #include <iostream> using namespace std;   void fun(int x) {     if(x > 0)     {         fun(--x);         cout… Read More
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. // … Read More
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. For… Read More
Default virtual behavior of methods is opposite in C++ and Java: In C++, class member methods are non-virtual by default. They can be made virtual… Read More
Following relationship holds in any n-ary tree in which every node has either 0 or n children. L = (n-1)*I + 1 Where L is… Read More
In C and C++, comma is the last operator in precedence table. So comma should be carefully used on right side of an assignment expression.… Read More
In C++, pre-increment (or pre-decrement) can be used as l-value, but post-increment (or post-decrement) can not be used as l-value. For example, following program prints… Read More
In C++, following are the general rules for operator overloading. 1) Only built-in operators can be overloaded. New operators can not be created. 2) Arity… Read More
In C++, assignment operator should be overloaded with self assignment check. For example, consider the following class Array and overloaded assignment operator function without self… Read More
Deleting a derived class object using a pointer of base class type that has a non-virtual destructor results in undefined behavior. To correct this situation,… Read More
Predict the output of below C++ programs. Question 1 #include<iostream> using namespace std;   class A {   public:     A(int ii = 0) : i(ii) {}… Read More