Skip to content
All Medium Articles
C supports variable numbers of arguments. But there is no language provided way for finding out total number of arguments passed. User has to handle… Read More
Predict the output of following program. #include <stdio.h> int main()  {    int x = 012;    printf("%d",  x);    getchar();    return 0; } The program prints 10.… Read More
What will be the output of the following program? #include<stdio.h> int main() {    int i = 10;    printf("%d", ++(-i));    return 0; } A) 11 B)… Read More
Predict the output of following C++ program. #include <iostream> using namespace std;    int main() {    int test = 0;    cout << "First  character "… Read More
Recursion:In programming terms a recursive function can be defined as a routine that calls itself directly or indirectly.Using recursive algorithm, certain problems can be solved… 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
Write a function to generate all possible n pairs of balanced parentheses.  Examples:  Input: n=1 Output: {} Explantaion: This the only sequence of balanced parenthesis… Read More
In C++, RTTI (Run-time type information) is a mechanism that exposes information about an object’s data type at runtime and is available only for the… Read More
Predict the output of following C programs. Question 1 #include<stdio.h>    #define R 10 #define C 20    int main() {    int (*p)[R][C];    printf("%d",  sizeof(*p));… Read More
Predict the output of below C programs. Question 1 #include <stdio.h>    char* fun() {   return "awake"; } int main() {   printf("%s",fun()+ printf("I see you"));… Read More
Write a program to add one to a given number. The use of operators like ‘+’, ‘-‘, ‘*’, ‘/’, ‘++’, ‘–‘ …etc are not allowed. Examples:  … Read More
exit() void exit ( int status );  exit() terminates the process normally. status: Status value returned to the parent process. Generally, a status value of… Read More
Given a linked list, write a function to reverse every k nodes (where k is an input to the function).  Example:  Input: 1->2->3->4->5->6->7->8->NULL, K =… Read More
It is compiler dependent in C. It is never safe to depend on the order of evaluation of side effects. For example, a function call… Read More
You are given an array of n+2 elements. All elements of the array are in range 1 to n. And all elements occur once except… Read More
  Merge sort is often preferred for sorting a linked list. The slow random-access performance of a linked list makes some other algorithms (such as… Read More
Total number of possible Binary Search Trees with n different keys (countBST(n)) = Catalan number Cn = (2n)! / ((n + 1)! * n!) For n… Read More
Predict the output of below C programs. Question 1 #include<stdio.h> int main() {    int a;    char *x;    x = (char *) &a;    a = 512;… Read More
“Pointer arithmetic and array indexing [that] are equivalent in C, pointers and arrays are different” – Wayne Throop References: http://c-faq.com/aryptr/aryptrequiv.html My Personal Notes arrow_drop_up Save
You can win three kinds of basketball points, 1 point, 2 points, and 3 points. Given a total score n, print out all the combination… Read More