Login Register
  • Greater Noida (Near Delhi), Uttar Pradesh
  • +91-8377803450
Ritambhara Technologies – Coding Interview Preparations
  • Books
  • Crack Coding Interview
  • Videos
  • About Us
    • Contact Us
  • Books
  • Crack Coding Interview
  • Videos
  • About Us
    • Contact Us
14
Nov
Sort in C++ standard template library

Two elements of complex data types are not directly comparable. Consider the student structure defined as below struct Student { int rollNo; char name[25]; char grade; }; Student arr[MAX_NUM_STUDENTS]; Objects of Student type are not directly comparable. To sort array arr, we need to specify how one student compares with another student. If there are […]

Posted in: Algorithms, C++,
Tags: Sorting,
08
May
Find minimum of 3 numbers without using comparator operator

How will you find minimum of three integers without using any comparison operator ?

Posted in: C, C++,
Tags: Bit twidling, Tricks,
25
Jul
Linked List Implementation of Stack in C++

Write a class which will implement the Stack data structure in C++. Give the declaration & definition of the class. Also define the Node. For simplicity, you may assume stack to hold integer data type.

Posted in: Algorithms, C++,
Tags: Linked List, Stack,
20
May
Printing something without modifying main

The below C++ code will print “Hello World”. #include <iostream> int main() { cout<<“Hello World”; } Without modifying main function, add code to print “Ritambhara” before “Hello World”. You cannot add/remove any statement to main function

Posted in: C++,
Tags: main,
07
May
2
Find the output of C++ Program

What will be the output of the below C++ program: // Template Function – Not taking class template <class T, int i> int myFun(){ T x = 10; i = 20; } int main(){ fun<int, 4>(); return 0; }

Posted in: C++,
Tags: template,
06
Feb
3
Which of the two comparison is better

While comparing a variable with a constant (literal) in C/C++ language, which of the two ways of comparison should we use ? if( x == 2 ) … if( ptr == NULL ) … Or if( 2 == x ) … if( NULL == ptr ) … In the first comparison we are writing variable […]

Posted in: C, C++, Java,
Tags: Coding Practice,
05
Feb
Disallowing object creation on heap

Object of a class can be created dynamically on heap or statically on Stack or Data Area. If we have a class MyClass, then the below objects will be created on heap. // Operator: New MyClass *ptr1 = new MyClass(); // Crating object of MyClass on heap. // Operator: New-Array MyClass *ptr2 = new MyClass[10]; // […]

Posted in: C++,
Tags: memory, new,
05
Feb
Allowing only dynamic object creation on heap

Write a class, such that user can create its object on heap (using new) but user should not be able to create its object on stack or data area. i.e if the class is MyClass, then MyClass stackObj; // Should give compile time error. MyClass *heapobj = new MyClass; // This should be OK, & […]

Posted in: C++,
Tags: Objects, OOP,
29
Jan
using delete operator on this

Can we use delete operator on this inside a class member function in C++, something like below: class TestClass { public: void myFunc() { delete this; } };

Posted in: C++,
Tags: Operator,
14
Jan
2
Find size of a struct without using sizeof operator

How will you find the size of a structure in C/C++ language without using sizeof operator. (Note: sum of sizes of all fields of a structure may not be equal to the exact memory allocated to the structure. See, Method-1 in solution).

Posted in: C, C++,
Tags: sizeof, struct,
  • 1
  • 2
  • 3
  • …
  • 6
  • Next

Find Us on Facebook

Log In


Lost your password?
Register
Forgotten Password
Cancel

Register For This Site

A password will be e-mailed to you.

Tag Cloud

algorithm Array Array; Sorting Asymptotic Complexity Binary Search Tree Binary Tree Binary Tree; Algorithm Bit twidling C++11 Design Pattern Divide-n-Conquer Dynamic Programming function hashing Helper Function Interview Puzzle IP Address Linked List Logic main Matrix memory Merge new Number Series Operator Output Palindrome Permutation pointer Polish Notation Puzzle Quant Queue Recursion Searching sizeof Sorting Stack String struct swap template Traversal Trie
Footer logo
Copyright © 2012 Ritambhara Technologies
  • Articles
  • Language
  • Algorithms
  • Networking
  • Operating Systems
  • Design
  • DBMS
  • Logic
  • Videos
Search