Consider the following C programs. filter_none edit close play_arrow link brightness_4 code // PROGRAM 1 #include<stdio.h> int main(void) { int a = 1, 2,… Read More »
Predict the output of following C++ program. filter_none edit close play_arrow link brightness_4 code #include <iostream> using namespace std; int main() { try {… Read More »
Question: How to deallocate dynamically allocate memory without using “free()” function. Solution: Standard library function realloc() can be used to deallocate previously allocated memory. Below… Read More »
Predict the output of following C++ program. filter_none edit close play_arrow link brightness_4 code #include <iostream> using namespace std; class Test { public: Test()… Read More »
A function is called pure function if it always returns the same result for same argument values and it has no side effects like modifying… Read More »
Consider the following Java program: filter_none edit close play_arrow link brightness_4 code class Complex { private double re, im; public Complex(double re, double im)… 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… Read More »
Directly accessing Grandparent’s member in Java: Predict the output of following Java program. filter_none edit close play_arrow link brightness_4 code // filename Main.java class Grandparent… Read More »
Given two numbers represented by two lists, write a function that returns the sum list. The sum list is list representation of the addition of… Read More »
Predict the output of following Java programs. Question 1 filter_none edit close play_arrow link brightness_4 code package main; class Base { public void Print()… Read More »
Difficulty Level: Rookie Predict the output of following Java Programs. Program 1 filter_none edit close play_arrow link brightness_4 code // filename Main.java class Test {… 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,… 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… Read More »
Predict the output of following C++ programs. Question 1 filter_none edit close play_arrow link brightness_4 code template <class S, class T> class Pair { private:… 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… Read More »
The qualifier const can be applied to the declaration of any variable to specify that its value will not be changed ( Which depends upon… Read More »
With GCC family of C compilers, we can mark some functions to execute before and after main(). So some startup code can be executed before… 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… Read More »
Predict the output of following C programs. Question 1 filter_none edit close play_arrow link brightness_4 code #include<stdio.h> #define fun (x) (x)*10 int main() {… Read More »
Question: Design a Data Structure SpecialStack that supports all the stack operations like push(), pop(), isEmpty(), isFull() and an additional operation getMin() which should return… Read More »