Skip to content

Category Archives: School Programming

Given an array of integers, find sum of its elements.Examples :  Input : arr[] = {1, 2, 3} Output : 6 1 + 2 +… Read More
  This article introduces the concept of polymorphism and virtual functions, and their use in inheritance. We’ll cover the following Definitions Without Virtual Functions Using… Read More
Predict the output of following Java program. class Test {     public static void main (String[] args)      {         int arr1[] = {1, 2, 3};         int arr2[]… Read More
One of the advantages of C++ over C is Exception Handling. Exceptions are run-time anomalies or abnormal conditions that a program encounters during its execution.… Read More
When we use final specifier with a method, the method cannot be overridden in any of the inheriting classes. Methods are made final due to… Read More
In C++, if a class has at least one pure virtual function, then the class becomes abstract. Unlike C++, in Java, a separate keyword abstract… Read More
Given a number, check if it is divisible by 7. You are not allowed to use modulo operator, floating point arithmetic is also not allowed. A… Read More
Multiple Inheritance is a feature of C++ where a class can inherit from more than one classes. The constructors of inherited classes are called in… Read More
To understand ‘this’ pointer, it is important to know how objects look at functions and data members of a class. Each object gets its own… Read More
When a variable is declared as a reference, it becomes an alternative name for an existing variable. A variable can be declared as a reference… Read More
Given a number n, write a function that returns count of numbers from 1 to n that don’t contain digit 3 in their decimal representation. Examples:  … Read More
Predict the output of following C++ program. C++ #include <iostream> using namespace std;   int main() {     try     {         throw 'x';     }     catch(int x)     {… Read More
Prerequisite – Constructors in Java Like C++, Java also supports copy constructor. But, unlike C++, Java doesn’t create a default copy constructor if you don’t write… Read More
A constructor without any arguments or with default value for every argument, is said to be default constructor. What is the significance of default constructor? Will… Read More