Skip to content
All Basic Articles
#include <stdio.h> // Assume base address of "GeeksQuiz" to be 1000 int main() {    printf(5 + "GeeksQuiz");    return 0; } (A) GeeksQuiz (B) Quiz (C)… Read More
Following is C like pseudo code of a function that takes a number as an argument, and uses a stack S to do processing. void… Read More
#include <stdio.h> int main() {     int i;        i = 1, 2, 3;     printf("%d", i);          return 0; } (A)… Read More
#include "stdio.h" int main() { int x, y = 5, z = 5; x = y == z; printf("%d", x); getchar(); return 0; } (A)… Read More
Predict the output of following program? #include "stdio.h" int main() {     char arr[100];     printf("%d", scanf("%s", arr));     /* Suppose that input value given         for above scanf… 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
Given a linked list of 0s, 1s and 2s, sort it. Examples: Input: 1 -> 1 -> 2 -> 0 -> 2 -> 0 ->… Read More
This post is similar to Overriding equals method in Java. Consider the following Java program: // file name: Main.java    class Complex {     private double… Read More
We know the Pascal’s Identity very well, i.e. ncr = n-1cr + n-1cr-1 A curious reader might have observed that Pascal’s Identity is instrumental in… Read More
Given two signed integers, write a function that returns true if the signs of given integers are different, otherwise false. For example, the function should… Read More
Given an array of integers, replace every element with the next greatest element (greatest element on the right side) in the array. Since there is… Read More
Prerequisite: Bool Data Type in C++The C99 standard for C language supports bool variables. Unlike C++, where no header file is needed to use bool,… Read More
Given a number n, print all primes smaller than or equal to n. It is also given that n is a small number. For example, if… Read More
Following questions have been asked in GATE 2006 CS exam. 1) Consider the following log sequence of two transactions on a bank account, with initial… Read More
scanf family functions support scanset specifiers which are represented by %[]. Inside scanset, we can specify single character or range of characters. While processing scanset,… Read More
The C99 standard allows variable sized arrays (see this). But, unlike the normal arrays, variable sized arrays cannot be initialized. For example, the following program… Read More
  Write a function to check whether two given strings are anagram of each other or not. An anagram of a string is another string… Read More
Create a data structure twoStacks that represents two stacks. Implementation of twoStacks should use only one array, i.e., both stacks should use the same array… Read More
You are given n activities with their start and finish times. Select the maximum number of activities that can be performed by a single person,… Read More
Following questions have been asked in GATE 2012 exam. 1) The recurrence relation capturing the optimal time of the Tower of Hanoi problem with n… Read More