ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage   interview questions urls   External Links  Contact Us     Login  |  Sign Up                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C++  >>  C++ General
 
 


 

 
 STL interview questions  STL Interview Questions
 OOPS interview questions  OOPS Interview Questions
 C++ General interview questions  C++ General Interview Questions
Question
class X 
{ 
public: 
  int x; 	
  static void f(int z); 
}; 
void X::f(int y) {x=y;}  
What is the error in the sample code above?  
a) The class X does not have any protected members.  
b) The static member function f() accesses the non-static z.  
c) The static member function f() accesses the non-static x.  
d) The member function f() must return a value.  
e) The class X does not have any private members.  
 Question Submitted By :: Ramesh.chaluvadi
I also faced this Question!!     Rank Answer Posted By  
 
  Re: class X { public: int x; static void f(int z); }; void X::f(int y) {x=y;} What is the error in the sample code above? a) The class X does not have any protected members. b) The static member function f() accesses the non-static z. c) The static member function f() accesses the non-static x. d) The member function f() must return a value. e) The class X does not have any private members.
Answer
# 1
option 'c' is the answer
 
Is This Answer Correct ?    0 Yes 1 No
Guest
 

 
 
 
Other C++ General Interview Questions
 
  Question Asked @ Answers
 
Describe functional overloading? HP3
What are the techniques you use for debugging? Adtran1
what is importance of data sturture in a programming language? L&T10
Write the program form Armstrong no in c++?  3
How to change constant values? Symphony3
how to find the maximum of 10 numbers ?  2
What is the difference between public, private, protected inheritance? Wipro4
What is the difference between method and message? HP2
What is the difference between static global and global ? CA2
class Foo { int x; public: Foo(int I); }; If a class does not have a copy constructor explicitly defined one will be implicitly defined for it. Referring to the sample code above, which one of the following declarations is the implicitly created copy constructor? a) Foo(Foo *f); b) Foo(Foo &f); c) Foo(const Foo *f); d) Foo(const Foo &f); e) Foo(int); Quark3
What compiler was used? Intel3
what is data Abstraction? and give example TCS13
wrong statement about c++ a)code removably b)encapsulation of data and code c)program easy maintenance d)program runs faster  8
How do you test your code? Microsoft3
class Alpha { public: char data[10000]; Alpha(); ~Alpha(); }; class Beta { public: Beta() { n = 0; } void FillData(Alpha a); private: int n; }; How do you make the above sample code more efficient? a) If possible, make the constructor for Beta private to reduce the overhead of public constructors. b) Change the return type in FillData to int to negate the implicit return conversion from "int" to "void". c) Make the destructor for Alpha virtual. d) Make the constructor for Alpha virtual. e) Pass a const reference to Alpha in FillData Quark1
What are the differences between public, private, and protected access? Wipro3
How to avoid a class from instantiation? Symphony5
What are the different types of polymorphism?  2
What is the output of printf("%d")? HCL25
What is the difference between Pointer and a Reference? When you would use them? Wipro2
 
For more C++ General Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com