GeekInterview.com
Series: Subject: Topic:

C++ Faqs

Showing Questions 1 - 20 of 69 Questions
First | Prev | | Next | Last Page
Sort by: 
 | 

What is dangling pointer

Asked By: vijaymca | Asked On: Jun 17th, 2008

Answered by: SURESH KUMAR KOLLIMALLA on: May 10th, 2013

By using dangling pointer we can access the values at the deallocated memory here, in the below code the memory allocated for variable n will be dealloeated as and when the control transfers from func...

Answered by: ishwar on: Oct 18th, 2011

Dangling pointers arise when an object is deleted or deallocated, without modifying the value of the pointer, so that the pointer still points to the memory location of the deallocated memory.

Binary

Asked By: dhairaybablani | Asked On: Jan 24th, 2013

Write a program that continues to ask the user to enter any decimal number and calculate it’s binary,octal and hexadecimal equivalent.

Number in words

Asked By: dhairaybablani | Asked On: Jan 24th, 2013

Write a program that takes an integer and displays the words number of that value. For example, 10->ten 121->one hundred twenty one

Permutations

Asked By: dhairaybablani | Asked On: Jan 24th, 2013

Write a program to display all possible permutations of a given input string--if the string contains duplicate characters, you may have multiple repeated results. Here is a sample for the input cat cat,cta,act,atc,tac,tca

C++ conversion program

Asked By: salom | Asked On: Nov 24th, 2012

How can I write a program that convert a given number of millimeters into the equivalent length in meters and meters into the equivalent length in millimeters?Also draw flowchart,algorithm,output.

Why C++ does not have virtual constructors?

Asked By: someshwar_goli | Asked On: Oct 25th, 2006

Answered by: manoj kumar on: Sep 26th, 2012

when we write a function virtual, a virtual table is created and to point to that virtual table we need virtual pointers so as we have not created the pointers for the constructor we cant make the con...

Answered by: surendrap on: Nov 21st, 2011

since we know that name of constructor and name of class is always same . and in c++ the name of class always unique, so the concept of overriding can not be apply on constructor.

C++ type conversion

Asked By: cutegal4u | Asked On: Jul 14th, 2010

Why does 'float' accept 'int' but not 'char'?

Answered by: Appar on: Sep 24th, 2012

Float variable can hold both of the variables either char or int.

Answered by: Anugya Singh on: Sep 4th, 2012

There is nothing wrong in this coding because character c will accept the value a and due to swapping the floar k will accept the ASCII code of the letter a which is 97.......So the value of k is 97.

C coding question on running time program

Asked By: Joanne Tan | Asked On: Jun 26th, 2011

/*assume contents are sorted*/public static intbinarysearch(int x,int a[]){int low=0; 0(1)int high=a.Length-1; 0(1)int mid; 0(1)while(low>x;while(x!=99){n++; 0(1)sum+=x; 0( n/x)cin>>x;}mean - sum/n;what is the running time?Please help me understand it. The websites are not that helpful to me. Please....

Answered by: Sereche on: Jul 9th, 2012

This seems to be a question about time complexity / big-O notation. Time complexity basically tells you how the program running time scales, as a function of one of the variables of input (in most cas...

Dead code

Asked By: krishnareddy.pelleti | Asked On: Jul 17th, 2010

What is dead code? Explain in programmatic way?

Answered by: mfsi_chinmayb on: Feb 20th, 2012

Hi Dead code (a.k.a Unreachable code),as the name suggests is the portion of the code which is never executed. Point out the word NEVER , as the code above that made the break before that and the exec...

Answered by: surendrap on: Nov 21st, 2011

dead code is such a collection of lines of code or code which executes but it its result does not have any significance or affect on output.

Pointers datatype

Asked By: michudeepu | Asked On: Sep 28th, 2010

What is the datatype of pointer?

Answered by: jbode on: Nov 19th, 2011

There is no single "pointer" data type; you have many pointer data types. A pointer to int may have a different size and representation from a pointer to char, which may have a different size and rep...

Answered by: niharricky27 on: Oct 10th, 2010

Pointer datatypes are actually the datatype of the variables whose address the pointer is going to store or point to.

i.e. to point an integer value, the pointer should of the same datatype i.e. int type.

Empty class size

Asked By: MURALIR | Asked On: Jul 17th, 2009

What is the size of an empty class?

Answered by: deep on: Oct 13th, 2011

what is the output for the below example?

Code
  1. #include iostream
  2. using namespace std;
  3. class A
  4. {
  5. };
  6. int main()
  7. {
  8. coutsizeof(A)endl;
  9. system(pause);
  10. return 0;
  11. }?

Answered by: cpfeed on: Oct 29th, 2009

class A{
}

most of time sizeof(A) = 1, however, it is a small integer regarding to the complier.

C++ programming function help

Asked By: mailoher89 | Asked On: Apr 13th, 2011

I'm having some trouble trying to program these problems and putting them into the main function. Please help me by giving some advice or website that offer good information for me.1. Write a function that accepts a string of characters from a user and displays the string one word per line.2. Write a...

Use of C++ in daily life

Asked By: ayaan ali | Asked On: Jan 27th, 2011

Do you agree or not that "object oriented programming basic paradigms like abstraction, encapsulation, aggregation, composition, inheritance, polymorphism, templates etc are based and works in a same way as human thinks and behave in our daily life? Justify your answer with very precise and to the point...

Function linkage mechanism

Asked By: Mann2920 | Asked On: Jan 24th, 2011

What is function linkage mechanism? Can inline function be used at run time? Why or why not?

Stl - vector

Asked By: makan007 | Asked On: Dec 2nd, 2010

What is the context of one and two after the following frsgment of code is executed?Vector one(7, string("one"));vector two(one.Begin() + 2, one.End()-3);

Diff betweeen static and local

Asked By: jayanthnasika | Asked On: Oct 13th, 2010

In the below prog,node * q is local to a function add() but it acts as static .How?#includeusing namespace std;class ll{public: struct node{ int data; node *link; }*p;ll(){p=null;}int add(int x){ node *q,*r;if(p==null){ r=new node; r->data=x; r->link=null;q=r; p=q;}else{r=new node;r->data=x;r->link=null;q->link=r;q=q->link;}return...

Plz explain following program

Asked By: jayanthnasika | Asked On: Oct 13th, 2010

In the below program ,in function add() node * q is local but it acts as static ie I mean it works correctly how is it possible?#includeusing namespace std;class ll{public: struct node{ int data; node *link; }*p;ll(){p=null;}int add(int x){ node *q,*r;if(p==null){ r=new node; r->data=x; ...

Using templates

Asked By: timyan128 | Asked On: Feb 5th, 2009

What is the disadvantage of using too many templates?

Answered by: vijay.badola on: Sep 25th, 2010

It may reduce programs readability.

PriVATe members

Asked By: Pankaj07 | Asked On: Aug 22nd, 2010

How can we access priVATe members of classs?

Static polymorphism

Asked By: saima_khan | Asked On: Jul 29th, 2010

What is static polymorphism? Give its syntax and simple example.

Answered by: mn.balakumar on: Aug 21st, 2010

I hope you know the concept of polymorphism.
Compile time polymorphism is called static polymorphism.
 Ex. overloading and overriding member functions. But they should not be virtual functions.

 

 

First | Prev | | Next | Last Page

 

 

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Ads

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.