| Other C++ Code Interview Questions |
|| Asked @
Its result is Rose Lotus Lotus.. How? Explain it?
|Write a program that takes a 3 digit number n and finds out
the number 2^n + 1 is prime, or if it is not prime find out its
Write a linear-time algorithm that sorts n distinct
integers, each of which is between 1 and 500.
Hint: Use a 500-element array. (Linear-time means your
algorithm runs in time c*n + b, where c and b are any
constants that do not depend on n.
For example, your algorithm can run in time n, or time 2n +
1, or time 5n + 10, or time 100n + 6, but not time c*n*n =
|using repetition structure. Write a c program that will
accept five numbers. The program should count and output the
total count of even numbers and total count of add numbers.
|Deriving time complexity of Binary tree and AVL tree, step
|PROBLEM #8 The cashier at the counter of a Super Store, Mr.
Khazaanchi has the following
bundles of rupee cash notes with him:
Rs. 1, 2, 5, 10, 50, 100, 500, 1000
A customer comes at his counter with various items that he
has shopped. Mr. Khazaanchi totals
the item prices and tells the customer his total amount
payable. The customer gives Mr. Khazanchi
some amount of cash. Find the total number of rupee notes of
each denomination (i.e. 1, 2, 5, 10,
50, 100, 500, 1000) Mr. Khazaanchi will have to give to the
withdrawer ensuring that the total
number of rupee notes are minimum.
Write an algorithm that finds both the smallest and
largest numbers in a list of n numbers and with complexity
T(n) is at most about (1.5)n comparisons.
|write a program that can locate elements in array.
|A string of charaters were given. Find the highest
occurance of a character and display that character.
eg.: INPUT: AEGBCNAVNEETGUPTAEDAGPE
|Write a function- oriented to convert the input dollar(s)
into its equivalent peso. Assume that one dollar is
equivalent to 51.60
|A research student is given a singly-linked list. Each node
of the list has a color, which is either “Black”
or “White”. He must find if there are more black nodes than
white nodes, or vice versa. His advisor
gives him 5,000Rs to buy a computer to do the work. He goes
to the computer store and finds a
slightly defective computer which costs a mere 3,000Rs. This
computer has the small problem of not
being able to do arithmetic. This means that he cannot use a
counter to count the nodes in the list to
determine the majority color. The computer is otherwise
fully functional. He has the evil idea that he
could buy the defective computer and somehow use it to do
his work, so that he can use the rest of
the money on enjoyment. Show how he can accomplish this
amazing task. Write code for an algorithm
called ‘findMajorityColor’ which takes a singly-linked list,
L, with n nodes and returns the majority color
among nodes of L. This algorithm should have the same
asymptotic running time as counting the
nodes (O(n)). Note: No arithmetic is allowed.
|what is virtual constroctor ? give an exam for it?-(parimal
|For more C++ Code Interview Questions Click Here |