Sunday, July 21, 2013


Tuesday, July 9, 2013

Odesk Overview







SAMPLE OVERVIEW


Overview


I’m Badsha. I’m a SEO, SEM, SMM expert. Currently I’m working SHERF AND SOVMO COMPANY. I want to gain myself as a professional freelancer in odesk. I have a 3 years experience in on and off page SEO. I have a team so can take all kind of project. I want to give my best in my employer and make a long term relation whit him. My availability is 42 hour per week. Every day I’ll give you work report.

Overview


My objective is to provide 100% accurate service to my client and give client full satisfaction. I am hard worker, honest and very dedicate to my job. I always respect the deadline. So my aim is to deliver a good job in less estimated time. I want to build my career with ODESK freelancing site. I always ready to do your job with great confidence. I always try my best to produce high quality work for my clients

Overview


I have developed many websites using PHP, HTML, MySQL including companies,hospital and small businesses.


I have a great experience in SEO(Link building, Social-Bookmarking , Directory-Submission,Article submission,Forum Posting, Blog commenting etc)


I also have some experience in the following areas: Java(OOP), JavaScript , Word-press and software design and testing.


I am looking forward into having mutual benefits with my future clients.

I think a major key to success is to learn to enjoy challenging work AND to enjoy working hard at it

Overview


I have worked Data Entry , Adobe Photoshop, SMM,SEM . My core competency lies in complete end-end management of a new Data Entry Project project


I also have some experience in the following areas: Logo design, Newsletter making

Overview


Good Day and Amoritte. I am working SEO,SEM and SMM for around 3 years. And I am giving the best and satisfaction service for my client!


I introduce myself as a dedicated person of experienced professionals, helping you create business, by attracting quality traffic to your website by use of sophisticated SEO software’s and techniques. I am in a practice of adopting Google friendly, White hat technique.


I have 5 years experience in off page seo.


I am Very Expert in Link Building, Blog Comment, Forum Post, Social Post, Directory Submission, Article submission,


I will Provide You the Best and Comfortable Service, all Back links will be Manually Done. My true Skill will be Very Helpful for Your Project to Obtain Your Goal. If You Contact with Me, I Will Give You Required Service Regarding Your Project.100% Surety; your desire website will go to top PR with any keywords. Just waiting to give you the best service.

oDesk Call Center Skills Test Questions Answer





oDesk Call Center Skills Test Questions Answer


oDesk Answer Test (Call Center Skills Test Questions) 













































oDesk PHP 5 Test Answers


oDesk PHP 5 Test Answers

1. Question: What is true regarding this code?
Answer: setcookie will return true



2. Question: Which of the following is not a correct way of printing text in php5?
Answer: echo “Plain text”;
3. Question: Which of the following is not the correct way of starting a session?
Answer: session_initiate()


aaaaaaaaaa

aaaaaaaaa

aaaaaaaaaaaa

aaaaaaaaaa

4. Question: Which of the following functions do you need to implement HTTP Basic Authentication?
Answer: None of the above
5. Question: Which of the following Command Line Interface constant is not defined in the CLI SAPI?
Answer: STDPRT
6. Question: Which of the following statements is correct with regard to final and abstract?
Answer: a. An abstract class cannot have final methods
7. Question: Which composite data types are supported by php?
Answer: Array
8. Question: The default value of register_globals in PHP is:
Answer: Off
9. Question: Which of the following is not a valid PHP connection status?
Answer: open
10. Question: Choose the correct statement:
Answer: include() includes and evaluates a specific file
require_once() includes and evaluates a specific file only if it has not been included before
11. Question: If the session_cache_expire() is not set, then by default the session cache will expire after:
Answer: 3 hrs
12. Question: What will be the output of the following script?
$count=50;
Paamayim Nekudotayim operator allows access only to the static members of a class?
Paamayim Nekudotayim operator allows access only to the static members of a class?
Answer: function_exists
$i=4;
User Name:
Password:
class Manager{
Answer: 5+2 * 4+6
$var = 1 + “-1.3e3″;
function Argument()
{
$count++;
echo $count;
}
Argument();
?>
Answer: It will print 1
13. Question: State whether True or False
Answer: True
14. Question: Which of the following statements is true with regard to comparisons in PHP5?
Answer: With (===) operator, object variables are identical if and only if they refer to the same instance of the same class.
15. Question: What will be the output of the following code?
$a = 0.0;
for ($i = 0; $i < a ="="">
Answer: 1
16. Question: What will be the output of the following code?
$j=30;
$k=0;
$k=$j++/$i++;
echo $i . ” ” . $j . ” ” . $k . ” “;
Answer: 5 31 7.5
17. Question: Which of the following is a not a correct way of commenting in php?
Answer: /#PHP Comment
18. Question: Following is a php code block:
$m=9;
$n=99;
$z=8;
$z=$n++/$m++ + –$z;
echo $z;
what will be the output?
Answer: 18
19. Question: Which of the following is the correct way of specifying default value?
Answer: function GetDiscount($Type = “Special”) { . . . }
20. Question: With reference to the following php script:
print ‘Text Line1′
print ‘Text Line2′
?>
What will be the output on running the script?
Answer: Error message will be printed
21. Question: What will be the ouput of the following code?
for ($i = 0; $i < i ="="">
0134
Question: Late PHP versions support remote file accessing for the functions:
Answer: include_once()
require_once()
both of them
22. Question: You have designed a user login form as follows:
How can you access the username entered by the user in the ‘Validate.php’ webpage?
a. $var= $_POST['username'];
b. $var= $_REQUEST['username'];
c. import_request_variables(‘p’, ‘p_’);
$var= $p_username;
Answer: Both of them
23. Question: Which of the following does not represent logical AND operator in PHP?
Answer: &amp
24. Question: Which of the following is not true for a persistent connection?
Answer: These can’t be converted to non-persistent connections
25. Question: Which of the following are invalid data types in PHP?
Answer: char
26. Question: The Manager and Office classes are as follows:
function printName() {
echo “Manager”;
}
}
class Office{
function getManager() {
return new Manager();
}
}
$ofc = new Office();
???
?>
Which of the following should replace ‘???’ to obtain the value of printName() function?
Answer: $ofc->getManager()->printName();
27. Question: The classes are defined as follows:abstract class BaseCls{
protected abstract function getName();
}
class ChildCls extends BaseCls{
}
Which of the following implementations of getName() is invalid in ChildCls?
Answer: public function getName(){}
28. Question: Which of the following variable declarations within a class is invalid in PHP5?
Answer: var $term =3;
29. Question: What will be the output of following code?
$arr = “a”;
$arr[0]=”b”;
echo $arr;
echo $arr[0];
Answer: bb
30. Question: For the following code:
the output will be:
Answer: 171
31. Question: What is the result of the following expression?
Question: What will be the output of following code?
echo $var;
Answer: -1299
32. Question: What will be the output of following code?
$var1=”a”;
$$var1=”b”;
echo “$var1 $a”;
Answer: a b
33. Question:What is the output of the following code?
$a = 500;
$b = 200;
echo $a % 2
* $b;
?>
Answer: 0
34. Question: What will be the ouput of the following code?
if (-1)
print “true”;
else
print “false”;
?>
Answer: true
35. Question: What will be the output of the following code?
echo 12 . 6;
Answer: 126
36. Question: Consider the following sample code:
$x = 0xFFFE;
$y = 2;
$z = $x && $y;
What will be the value of $z?
Answer: 1

Odesk Test Photoshop cs3 Answer

Odesk Test Photoshop cs3 Answer
01. Question: Changing units on the Info Palette automatically changes the units on Rulers.
Answer: TRUE

02. Question: Which of the following Filters cannot be applied to a Smart Object?
Answer: Pattern Maker

03. Question: With which of the given options does the Signal Strength Meter appear?
Answer: It appears when you choose 'merge to hdr command'

04. Question: Channels can not be added to which of the following image modes?
Answer: Bitmap

05. Question: Which among the following Modes does not support layers?
Answer: All of the above

06. Question: Which of the following is not true about Filters?
Answer: None of the above

07. Question: Which of the following is not true about the Curves dialog box?
Answer: The Curves dialog box lets you adjust up to 14 different points throughout an image's tonal range

08. Question: Which of the following Slices is created with the Slice Tool?
Answer: User slices

09. Question: Which of the following features is supported by the EPS file format?
Answer: It supports the Grayscale and Bitmap color modes

10. Question: Which among the following blending modes is available only for the Apply Image and Calculations commands?
Answer: Both a and b

11. Question: What is the use of the Make Work Path command in the Paths palette ?
Answer: It can alter the shape of a selection

12. Question: Which type of information is not displayed by the Info Palette?
Answer: It does not display the opacity of the current layer

13. Question: Which among the following is not a right option for selecting a web-safe color from the Color Palette?
Answer: Choose Current Color from the Color Palette Menu

14. Question: Which keyboard shortcut (windows) will you choose to close a Path?
Answer: None of the above

15. Question: Anti-aliasing option is available for which of the given Tools?
Answer: All of the above

16. Question: Which of the following options displays the Spot Channels in the Channels palette?
Answer: B

17. Question: What happens when Use Legacy is selected as shown in the given picture?
Answer: It is used to apply proportionate (nonlinear) adjustments to image pixels

18. Question: Which option will you select to open the Levels dialog box?
Answer: Choose Image > Adjustments > Levels

19. Question: Which type of images are resolution-dependent?
Answer: Vector images

20. Question: Which Liquify Tool is used to reconstruct a part of a distorted image?
Answer: A

21. Question: In which Format will you save your file to preserve the Alpha channels?
Answer: All of the above

22. Question: Which of the following is not a kind of text type?
Answer: Line type

23. Question: Which option will you select to convert Types to Shapes?
Answer: Both b and c

24. Question: The mask created by the Replace Color command is permanent.
Answer: FALSE

25. Question: Which of the following Layer properties can be animated?
Answer: All of the above

26. Question: Which View will you choose to display a Histogram with no controls or statistics?
Answer: All of the above

27. Question: Which of the given options displays left indent in the Paragraph palette?
Answer: B

28. Question: Which keyboard shortcut (windows) will you choose to group Layers?
Answer: Control + G

29. Question: The Rotate Canvas command does not work on which of the following
Answer: All of the above

30. Question: Which of the Saving commands is available for an image that is managed by a Version Cue Workspace?
Answer: Check In

31. Question: When will the Dynamic shortcuts appear in the Character Palette Menu as shown in the picture?
Answer: All of the above

32. Question: Hanging Punctuation controls the alignment of the punctuation marks for a specific paragraph.
Answer: TRUE

33. Question: Which option will you choose to select all layers of a similar type?
Answer: All of the above

34. Question: Which of the following is not a Color Adjustment command?
Answer: Adjustment command

35. Question: By default, Masks applied to Smart objects are linked to Smart object layers. .
Answer: FALSE

36. Question: A working space is an intermediate color space used to define and edit color in Adobe applications.
Answer: FALSE

37. Question: Which option will you select to remove the existing profile from the document in the given image?
Answer: C

38. Question: You cannot change the order of the Vector masks or working paths in the Paths palette.
Answer: FALSE

39. Question: The Color Replacement Tool does not work in which of the following Image modes?
Answer: All of the above

40. Question: In which of the following Modes can you draw while working with the Shape or Pen tools?
Answer: All of the above

41. Question: The Out Of Gamut option works only on RGB and Lab images
Answer: TRUE

42. Question: Which among the following QuickTime Video formats is supported by Photoshop extended?
Answer: MOV

Monday, July 1, 2013

C++ Test Question Answers


C++ Test Question Answers 2013-2014

Q1.Which of the following STL classes is deprecated (ie should no longer be used)?
a.ostrstream
b.ostringstream
c.ostream
d.wostream
<script type=”text/javascript”><!–
google_ad_client = “ca-pub-5917511893914188″;
/* ad2 */
google_ad_slot = “7730500156″;
google_ad_width = 160;
google_ad_height = 600;
//–>
</script>
<script type=”text/javascript”
src=”http://pagead2.googlesyndication.com/pagead/show_ads.js”>
</script>
Q2.What access specifier allows only the class or a derived class to access a data member?
a. private
b. protected
c. default
d. virtual
e. public

Q3.Consider the following code:
class A {
typedef int I; // private member
I f();
friend I g(I);
static I x;
};
Which of the following are valid:
a. A::I A::f() { return 0; }
b. A::I g(A::I p = A::x);
c. A::I g(A::I p) { return 0; }
d. A::I A::x = 0;
Q4.In the given sample Code, is the constructor definition valid?
class someclass
{
int var1, var2;
public:
someclass(int num1, int num2) : var1(num1), var2(num2)
{
}
};
a. Yes, it is valid
b.Not Valid
Q5.Which of the following statements are true about C++ vector class?
a. vector::empty deletes all elements of the vector
b. vector::erase can be used to delete a single element and a range of elements of the vector
c. After calling, vector::erase causes some of the iterators referencing the vector to become invalid
d. vector::count returns the number of elements in the vector
e. vector::size returns the number of elements in the vector
f. vector::capacity returns the number of elements in the vector
Q6.Which of the following operators cannot be overloaded?
a. +=
b. >>
c. <
d. 
e. ::
f. &&
g. =
h. ?:
Q7.State which of the following is true.
a. Function templates in C++ are used to create a set of functions that apply the same algorithm to different data types
b. Classes in C++ are used to develop a set of type-safe classes
c. C++ is useful for developing collection classes
d. C++ is useful for developing smart pointers
e. All of the above
Q8.Which of the following are NOT valid C++ casts
a. dynamic_cast
b. reinterpret_cast
c. static_cast
d. const_cast
e. void_cast
Q9.Which of the following member functions can be used to add an element in an std::vector?
a. add
b. front
c. push
d. push_back
Q10.Which of the following is a predefined object in C++ and used to insert to the standard error output?
a. std::err
b. std::error
c. std::cerror
d. std::cerr
e. std::cin
f. std::clog
Q11.In C++, the keyword auto can be used for:
a. Automatic assignment of data to objects during instantiation
b. Automatic call of a function
c. Declaration of a local variable
d. Automatically erasing an object when it is no longer needed
e. Automatic handling of run-time errors in the program
f. Automatic termination of a program in case the user does not respond within a given time period
g. Automatic creation of variables
Q12.Which of the following statements regarding functions are false?
a. Functions can be overloaded
b. Functions can return the type void
c. Inline functions are expanded during compile time to avoid invocation overhead
d. You can create arrays of functions
e. You can pass values to functions by reference arguments
f. You can return values from functions by reference arguments
g. A function can return a pointer
Q13.Which of the following techniques should you use to handle a constructor that fails?
a. Return an error code from the constructor
b. Throw an exception from the constructor
c. Write the error to a log file
d. Use “delete this;” in the constructor
e. None of the above
Q14.Which of the following is NOT a standard sorting algorithm:
a. std::sort
b. std::qsort
c. std::stable_sort
d. std::partial_sort
Q15.How many arguments can be passed to an overloaded binary operator?
a. 4
b. 3
c. 2
d. 1
e. 0
Q16.Which of the following statements are true?
a. Inline functions should be preferred over macros because inline functions have better performance
b. Macro usage should be avoided because they are error prone
c. Normal functions should be preferred over macros because normal functions have better performance
d. Macro usage should be avoided because macros do no perform type checking
e. Inline functions should be preferred over macros because inline functions perform type checking
Q17.Which of the following statements are FALSE with regard to destructors
a. A derived class can call the destructor of the parent class explicitly
b. A class may have only one destructor
c. Destructors cannot be invoked directly
d. The return type for a destructor is void
e. Destructors cannot accept arguments
Q18.If a matching catch handler (or ellipsis catch handler) cannot be found for the current exception, then the following predefined runtime function is called ______.
a. abort
b. set_terminate
c. terminate
d. close
Q19.Which of the following techniques should you use to handle a destructor that fails?
a. Return an error code from the destructor
b. Throw an exception from the destructor
c. Write the error to a log file
d. Use “delete this;” in the destructor
e. None of the above
Q20.Which of the following are NOT valid C++ casts
a. dynamic_cast
b. reinterpret_cast
c. static_cast
d. const_cast
e. void_cast
Q21.Which of the following statements are true for operator overloading in C++?
a. The * operator can be overloaded to perform division
b. The * operator can be overloaded to perform assignment
c. ** can be overloaded to perform “to the power of”
d. Operators can be overloaded only in inside classes
e. Operators can be overloaded globally
Q22.State whether True or False.
Unary operator, overloaded by means of a friend function take one reference argument.
a. True
b.False
Q23.If input and output operations have to be performed on a file, an object of the _______ class should be created.
a. fstream
b. iostream
c. ostream
d. istream
e. None


Programming with C++ Test


Which of the following is a predefined object in C++ and used to insert to the standard error output?

a. std::err
b. std::error
c. std::cerror
d. std::cerr
e. std::cin
f. std::clog

If a matching catch handler (or ellipsis catch handler) cannot be found for the current exception, then the following predefined runtime function is called ______.

a. abort
b. set_terminate
c. terminate
d. close

Which of the following statements regarding functions are false?

a. Functions can be overloaded
b. Functions can return the type void
c. Inline functions are expanded during compile time to avoid invocation overhead
d. You can create arrays of functions
e. You can pass values to functions by reference arguments
f. You can return values from functions by reference arguments
g. A function can return a pointer

What access specifier allows only the class or a derived class to access a data member

a. private
b. protected
c. default
d. virtual
e. public

Consider two classes A and B:
class A
{
private:
    int x;
    float y;
public:
friend class B;
};
class B
{
};

Which of the following is true?

a. A can access all private data members of B
b. B can access all private data members of A
c. A cannot access the private members of B
d. B cannot access the private members of A
e. Both A and B can access each other's private data members

Consider the sample code given below and answer the question that follows:
char **foo;
/* Missing code goes here */
for(int i = 0; i < 200; i++)
{
foo[i] = new char[100];
}

Referring to the sample code above, what is the missing line of code?

a. foo = new *char[200];
b. foo = new char[200];
c. foo = new char[200]*;
d. foo = new char*[200];
e. foo = new char[][200];

Consider the sample code given below and answer the question that follows.
class Grandpa
{
} ;
class Ma : virtual public Grandpa
{
} ;
class Pa : virtual public Grandpa
{
} ;
class Me : public Ma, public Pa, virtual public Grandpa
{
} ; 
How many instances of Grandpa will each instance of Me contain?

a. 1
b. 2
c. 3
d. 4

Which of the following statements are true for operator overloading in C++?

a. The * operator can be overloaded to perform division
b. The * operator can be overloaded to perform assignment
c. ** can be overloaded to perform "to the power of"
d. Operators can be overloaded only in inside classes
e. Operators can be overloaded globally

Sample Code
typedef char *monthTable[3];
Referring to the code above, which of the following choices creates two monthTable arrays and initializes one of the two?

a. monthTable(winter,spring={"March","April","May"});
b. monthTable winter, spring;
c. monthTable, winter, spring;
d. monthTable, winter,spring={"March","April","May"};
e. monthTable winter,spring={"March","April","May"};

A pure virtual function can be declared by _______.

a. equating it to 1
b. equating it to 0
c. equating it to NULL
d. the 'pure' keyword
e. the 'abstract' keyword

State whether True or False.
Unary operator overloaded by means of a friend function takes one reference argument.

a. True
b. False

Consider the sample code given below and answer the question that follows.
template <class T> Run(T process);
Which one of the following is an example of the sample code given above?

a. A non-template member function
b. A template function definition
c. A template function declaration
d. A template class definition
e. A template class declaration

Consider the sample code given below and answer the question that follows.
class Person
{
    string name;
    int age;
    Person *spouse;
public:
    Person(string sName);
    Person(string sName, int nAge);
    Person(const Person& p);
    Copy(Person *p);
    Copy(const Person &p);
    SetSpouse(Person *s);
};

Which one of the following are declarations for a copy constructor?

a. Person(string sName);
b. Person(string sName, int nAge);
c. Copy(Person *p);
d. Person(const Person &p);
e. Copy(const Person &p)?

Suppose MyClass is a class that defines a copy constructor and overloads the assignment operator. In which of the following cases will the copy constructor of MyClass be called?

a. When an object of MyClass is passed by value to a function
b. When an object of MyClass is returned by value from a function
c. MyClass object1;   MyClass object2;   object2 = object1;
d. MyClass object1;   MyClass *object2  = new MyClass(object1);
e. MyClass object1;   MyClass object2 = object1;

Consider the sample code given below and answer the question that follows.
class Outer
{
  public:
    class Inner
      {
        int Count;
        public:
        Inner(){};
      };
};
int main()
  {
Inner innerObject;
Outer outObject;
return 0;
  }

What will be the result when the above code is compiled?

a. The code will compile fine
b. There will be errors because classes cannot be defined inside other classes
c. There will be an error because Outer does not define a constructor
d. There will be an error because in the declaration of innerObject the type Inner must be qualified by Outer
e. There will be no errors but a warning that Inner and Outer do not have destructors

Consider the line of code given below and answer the question that follows.
class screen; 
Which of the following statements are true about the class declaration above?

a. Incorrect syntax. The body of the class declaration is missing
b. Incorrect syntax. {}; is missing
c. The syntax is correct
d. Incorrect syntax. {} is missing
e. Incorrect syntax. Requires a *

In the given sample Code, is the constructor definition valid?
class someclass
{
   int var1, var2;
   public:
      someclass(int num1, int num2) : var1(num1), var2(num2)
      {
      }
};

a. Yes, it is valid
b. No, we cannot assign values like this
c. No, the parenthesis cannot be empty
d. No, var1 and var2 are not functions but are variables

Consider the sample code given below and answer the question that follows.
class Person
{
public:
   Person();
      virtual ~Person();
};
class Student : public Person
{
public:
   Student();
   ~Student();
};
main()
{
   Person *p = new Student();
   delete p;
}

Why is the keyword "virtual" added before the Person destructor?

a. To make it impossible for this particular destructor to be overloaded
b. To ensure that correct destructor is called when p is deleted
c. To ensure that the destructors are called in proper order
d. To improve the speed of class Person's destruction
e. To prevent the Person class from being instantiated directly making it an abstract base class

Consider the sample code given below and answer the question that follows.
class SomeClass
{
int x;
public:
SomeClass (int xx) : x(xx) {}
};
SomeClass x(10);
SomeClass y(x);

What is wrong with the sample code above?

a. SomeClass y(x); will generate an error because SomeClass has no copy constructor
b. SomeClass y(x); will generate an error because SomeClass has no default constructor
c. SomeClass y(x); will generate an error because SomeClass has no public copy constructor
d. x(xx) will generate an error because it is illegal to initialize an int with that syntax
e. The code will compile without errors

Which of the following member functions can be used to add an element in an std::vector?

a. add
b. front
c. push
d. push_back

Consider the sample code given below and answer the question that follows.
1 class Car
2 {
3 private:
4 int Wheels;
5
6 public:
7 Car(int wheels = 0)
8 : Wheels(wheels)
9 {
10 }
11
12 int GetWheels()
13 {
14 return Wheels;
15 }
16 };
17 main()
18 {
19 Car c(4);
20 cout << "No of wheels:" << c.GetWheels();
21 }

Which of the following lines from the sample code above are examples of data member definition?

a. 4
b. 7
c. 8
d. 14
e. 19

What is the output of the following code segment?
int n = 9;
int *p;
p=&n;
n++;
cout << *p+2 << "," << n;

a. 11,9
b. 9,10
c. 12,10
d. 11,10

Base class members are made accessible to a derived class and inaccessible to rest of the program by _____.

a. public access specifier
b. private access specifier
c. protected access specifier
d. friend access specifier

Consider the following statements relating to static member functions and choose the appropriate options:
1. They have external linkage
2. They do not have 'this' pointers
3. They can be declared as virtual
4. They can have the same name as a non-static function that has the same argument types

a. All are true
b. Only 1, 2 and 4 are true
c. Only 1 and 2 are true
d. Only 1,3 and 4 are true
e. All are false

Consider the following code:
template<class T> void Kill(T *& objPtr)
{
   delete objPtr;
   objPtr = NULL;
}
class MyClass
{
};
void Test()
{
   MyClass *ptr = new MyClass();
   Kill(ptr);
   Kill(ptr);
}

Invoking Test() will cause which of the following?

a. Code will Crash or Throw and Exception
b. Code will Execute, but there will be a memory leak
c. Code will execute properly
d. Code will exhibit undefined behavior

What linkage specifier do you use in order to cause your C++ functions to have C linkage

a. extern "C"
b. extern C
c. _stdcall
d. _cdecl
e. _fastcall?

Consider the sample code given below and answer the question that follows.
class X {
  int   i;
protected:
  float f;
public:
  char  c;
};
class Y : private X { };

Referring to the sample code above, which of the following data members of X are accessible from class Y   

a. c
b. f
c. i
d. None of the above

Consider the following code:
        class A {
              typedef int I;      // private member
              I f();
              friend I g(I);
              static I x;
          };

Which of the following are valid:

a. A::I A::f() { return 0; }
b. A::I g(A::I p = A::x);
c. A::I g(A::I p) { return 0; }
d. A::I A::x = 0;

Which of the following are true about class and struct in C++:

a. A class can have destructor but a struct cannot
b. A class can have inheritance but a struct cannot
c. In a class all members are public by default, whereas in struct all members are private by default
d. In a class all members are private by default, whereas in struct all members are public by default

Consider the following code:
#include<iostream>
using namespace std;
int main()
{
cout << "The value of __LINE__ is " <<__LINE__;
return 0;
}

What will be the result when the above code is compiled and executed?

a. The compilation will fail with the error - '__LINE__' : undeclared identifier
b. The compilation will fail with the error - '__LINE__' unresolved identifier
c. The code will compile and run without errors
d. The code will crash at runtime

Which of the following techniques should you use to handle a destructor that fails?

a. Return an error code from the destructor
b. Throw an exception from the destructor
c. Write the error to a log file
d. Use "delete this;" in the destructor
e. None of the above

Consider the following code:
class BaseException
{
public:
   virtual void Output()
   {
      cout << "Base Exception" << endl;
   }
};
class DerivedException : public BaseException
{
public:
   virtual void Output()
   {
      cout << "Derived Exception" << endl;
   }
};

void ExceptionTest()
 
{
   try
   {
      throw DerivedException();
   }
   catch (BaseException& ex)
   {
      ex.Output();
   }
   catch (...)
   {
      cout << "Unknown Exception Thrown!" << endl;
   }
}

Invoking Exception Test will result in which output?

a. Base Exception
b. Derived Exception
c. Unknown Exception Thrown
d. No Output will be generated

Which of the following statements about function overloading, is true?

a. C++ and namespaces should be used to replace occurrences of function overloading
b. Overloaded functions may not be declared as "inline"
c. Although the return types and parameter types of overloaded functions can be different, the actual number of parameters cannot change
d. Function overloading is possible in both C and C++
e. The parameter lists and const keyword are used to distinguish functions of the same name declared in the same scope

What will be the output of the following code?
#include<iostream>
using namespace std;
class b
{
int i;
public:
void vfoo()
{ cout <<"In Base "; }
};
class d : public b
{
int j;
public:
void vfoo()
{
cout<<"In Derived ";
}
};
void main()
{
b *p, ob;
d ob2;
p = &ob;
p->vfoo();
p = &ob2;
p->vfoo();
ob2.vfoo();
}

a. In Base In Base In Derived
b. In Base In Derived In Derived
c. In Derived In Derived In Derived
d. In Derived In Base In Derived
e. In Base In Base In Base

What does ADT stand for?

a. Accessible derived type
b. Access to derived type
c. Abstract data type
d. Abstract derived type
e. Accessible data type

Consider the following code:
class BaseException
{
public:
    virtual void Output()
    {
    cout << "Base Exception" << endl;
    }
};
class DerivedException : public BaseException
{
public:
    virtual void Output()
    {
    cout << "Derived Exception" << endl;
    }
};
void ExceptionTest()
{
    try
    {
          throw DerivedException();
    }
    catch (BaseException ex)
    {
          ex.Output();
    }
    catch (...)
    {
          cout << "Unknown Exception Thrown!" << endl;
    }
}

Invoking Exception Test will result in which output?

a. Base Exception
b. Derived Exception
c. Unknown Exception Thrown
d. No Output will be generated

Consider the following code:
#define SQ(a) (a*a)
int  answer = SQ(2 + 3);
What will be the value of answer after the above code executes?

a. 10
b. 11
c. 25
d. 13
e. None of the above

What will be the output of the following code?
class A
{
public:
      A():pData(0){}
      ~A(){}
      int operator ++()
      {
            pData++;
            cout << "In first ";
            return pData;
      }
      int operator ++(int)
      {
            pData++;
            cout << "In second ";
            return pData;
      }
private:
      int pData;
};
void main()
{
     A a;
     cout << a++;
     cout << ++a;
}

a. In first 1 In second 2
b. In second 1 In first 2
c. In first 0 In second 2
d. In second 0 In first 2

You want the data member of a class to be accessed only by itself and by the class derived from it. Which access specifier will you give to the data member?

a. Public
b. Private
c. Protected
d. Friend
e. Either Public or Friend

Consider the sample code given below and answer the question that follows.
class Shape
{
public:
virtual void draw() = 0;
};
class Rectangle: public Shape
{
public:
void draw()
{
// Code to draw rectangle
}
//Some more member functions.....
};
class Circle : public Shape
{
public:
void draw()
{
// Code to draw circle
}
//Some more member functions.....
};
int main()
{
Shape objShape;
objShape.draw();
}

What happens if the above program is compiled and executed?

a. Object objShape of Shape class will be created
b. A compile time error will be generated because you cannot declare Shape objects
c. A compile time error will be generated because you cannot call draw function of class 'Shape'
d. A compile time error will be generated because the derived class's draw() function cannot override the base class draw() function
e. None of the above

Which of the following is NOT a standard sorting algorithm:

a. std::sort
b. std::qsort
c. std::stable_sort
d. std::partial_sort

Which of the following statements are true?

a. Inline functions should be preferred over macros because inline functions have better performance
b. Macro usage should be avoided because they are error prone
c. Normal functions should be preferred over macros because normal functions have better performance
d. Macro usage should be avoided because macros do not perform type checking
e. Inline functions should be preferred over macros because inline functions perform type checking

In C++, the keyword auto can be used for:

a. Automatic assignment of data to objects during instantiation
b. Automatic call of a function
c. Declaration of a local variable
d. Automatically erasing an object when it is no longer needed
e. Automatic handling of run-time errors in the program
f. Automatic termination of a program in case the user does not respond within a given time period
g. Automatic creation of variables

Which of the following STL classes is deprecated (ie should no longer be used)

a. ostrstream
b. ostringstream
c. ostream
d. wostream

What will be the output of the following code?
class b
{
    int i;
    public:
    virtual void vfoo()
  {
    cout <<"Base ";
  }
};
class d1 : public b
{
    int j;
    public:
    void vfoo()
  {
    j++;
    cout <<"Derived";
  }
};
class d2 : public d1
{
    int k;
};
void main()
{
    b *p, ob;
    d2 ob2;
    p = &ob;
    p->vfoo();
    p = &ob2;
    p->vfoo();
}

a. Base Base
b. Base Derived
c. Derived Base
d. Derived Derived

Consider the following code:
class BaseException
{
   public:
   virtual void Output()
   {
      cout << "Base Exception" << endl;
   }
};
class DerivedException : public BaseException
{
   public:
   virtual void Output()
   {
      cout << "Derived Exception" << endl;
   }
};
void ExceptionTest()
{
   try
   {
      throw new DerivedException();
   }
   catch (DerivedException ex)
   {
      ex.Output();
   }
   catch (...)
   {
      cout << "Unknown Exception Thrown!" << endl;
   }
}

Invoking Exception Test will result in which output?

a. Base Exception
b. Derived Exception
c. Unknown Exception Thrown
d. No Output will be generated

Consider the sample code given below and answer the question that follows.
class A
{
public:
A() {}
~A()
{
cout << "in destructor" << endl;
}
};
void main()
{
A a;
a.~A();
}

How many times will "in destructor" be output when the above code is compiled and executed?

a. 0
b. 1
c. 2
d. A compile time error will be generated because destructors cannot be called directly

If input and output operations have to be performed on a file, an object of the __________ class should be created.

a. fstream
b. iostream
c. ostream
d. istream
e. None

Which of the following sets of functions do not qualify as overloaded functions?

a. void fun(int, char *)
    void fun(char *,int)
b. void x(int,char)
    int *x(int,char)
c. int get(int)
    int get(int,int)
d. void F(int *)
    void F(float *)
e. All of the above are overloaded functions

Which of the following statements are FALSE with regard to destructors

a. A derived class can call the destructor of the parent class explicitly
b. A class may have only one destructor
c. Destructors cannot be invoked directly
d. The return type for a destructor is void
e. Destructors cannot accept arguments

Consider the following code:
#include<iostream>
using namespace std;
class A
{
public :
        A()
        {
                cout << "Constructor of A\n";
        };
        ~A()
        {
                cout << "Destructor of A\n";
        };
};
class B : public A
{
public :
        B()
        {
                cout << "Constructor of B\n";
        };
        ~B()
        {
                cout << "Destructor of B\n";
        };
};

int main()
 
{
        B        *pB;
        pB = new B();
        delete pB;
        return 0;
}

What will be the printed output?

a. Constructor of B
    Constructor of A
    Destructor of A
    Destructor of B
b. Constructor of A
    Constructor of B
    Destructor of B
    Destructor of A
c. Constructor of B
    Constructor of A
    Destructor of B
    Destructor of A
d. Constructor of A
    Constructor of B
    Destructor of A
    Destructor of B
e. The sequence of construction and destruction of A and B will be compiler specific

Consider the sample code given below and answer the question that follows.
class Person
{
    string name;
    int age;
    Person *spouse;
public:
    Person(string sName);
    Person(string sName, int nAge);
    Person(const Person& p);
    Copy(Person *p);
    Copy(const Person &p);
    SetSpouse(Person *s);
};

Which one of the following are declarations for a copy constructor?

a. Person(string sName);
b. Person(string sName, int nAge);
c. Copy(Person *p);
d. Person(const Person &p);
e. Copy(const Person &p)?

Which of the following statements are true about C++ vector class?

a. vector::empty deletes all elements of the vector
b. vector::erase can be used to delete a single element and a range of elements of the vector
c. After calling, vector::erase causes some of the iterators referencing the vector to become invalid
d. vector::count returns the number of elements in the vector
e. vector::size returns the number of elements in the vector
f. vector::capacity returns the number of elements in the vector

How many arguments can be passed to an overloaded binary operator?

a. 4
b. 3
c. 2
d. 1
e. 0

Which of the following is not a standard STL header?

a. <array>
b. <deque>
c. <queue>
d. <list>

What will happen when the following code is compiled and executed?
#include<iostream>
using namespace std;
class myclass
{
private:
    int number;
public:
    myclass()
    {
        number = 2;
    }
    int &a()
    {
        return number;
    }
};

int main()
 
{
    myclass m1,m2;
    m1.a() = 5;
    m2.a() = m1.a();
    cout << m2.a();
    return 0;
}

a. Compile time errors will be generated because right hand side of expressions cannot be functions
b. The printed output will be 5
c. The printed output will be 2
d. The printed output will be undefined

Which of the following statements about constructors and destructors are true?

a. In a given class, constructors are always required to be defined, but destructors are not
b. Neither constructors nor destructors can take parameters
c. Constructors can take parameters, but destructors cannot
d. It is illegal to define a destructor as virtual
e. It is illegal to define a constructor as virtual
f. Both explicitly declared constructors and explicitly declared destructors are required in a class

Which of the following are NOT valid C++ casts

a. dynamic_cast
b. reinterpret_cast
c. static_cast
d. const_cast
e. void_cast

Suppose MyClass is a class that defines a copy constructor and overloads the assignment operator. In which of the following cases will the copy constructor of MyClass be called?

a. When an object of MyClass is passed by value to a function
b. When an object of MyClass is returned by value from a function
c. MyClass object1;
    MyClass object2;
    object2 = object1;
d. MyClass object1;
    MyClass *object2  = new MyClass(object1);
e. MyClass object1;
    MyClass object2 = object1;

Consider the following code:
class Animal
{
private:
    int weight;
public:
    Animal()
    {
    }
    virtual void Speak()
    {
        cout << "Animal speaking";
    }
};
class Snake : public Animal
{
private:
    int length;
public:
    Snake()
    {
    }
    void Speak()
    {
        cout << "Snake speaking\r\n";
    }
};
int main()
{
    Animal *array = new Snake[10];
    for (int index= 0; index < 10; index++)
    {
        array->Speak();
        array++;
    }
     return 0;
}
What happens when the above code is compiled and executed?

a. The code will generate compilation errors
b. The code will compile and run fine. "Animal speaking" will be printed to the output
c. The code will compile and run fine. "Snake speaking" will be printed to the output
d. The code will crash at runtime

Which of the following are true about class member functions and constructors?

a. A constructor can return values but a member function cannot
b. A member function can declare local variables but a constructor cannot
c. A member function can return values but a constructor cannot
d. A constructor can declare local variables but a member function cannot
e. A member function can throw exceptions but a constructor cannot

Which of the following techniques should you use to handle a constructor that fails?

a. Return an error code from the constructor
b. Throw an exception from the constructor
c. Write the error to a log file
d. Use "delete this;" in the constructor
e. None of the above

Consider the following code:
#include<iostream>
using namespace std;
class A
{
public:
  A()
  {
    cout << "Constructor of A\n";
  };
  ~A()
  {
    cout << "Destructor of A\n";
  };
};
class B
{
public:
  B()
  {
    cout << "Constructor of B\n";
  };
  ~B()
  {
    cout << "Destructor of B\n";
  };
};
class C
{
public:
  A objA;
  B objB;
};
int main()
{
  C *pC;
  pC = new C();
  delete pC;
  return 0;
}

What will be the printed output?

a. Constructor of B
    Constructor of A
    Destructor of A
    Destructor of B
b. Constructor of A
    Constructor of B
    Destructor of B
    Destructor of A
c. Constructor of B
    Constructor of A
    Destructor of B
    Destructor of A
d. Constructor of A
    Constructor of B
    Destructor of A
    Destructor of B
e. The sequence of construction and destruction of A and B will be compiler specific

Consider the following code:
#include<stdio.h>
int main(int argc, char* argv[])
{
        enum Colors
        {
                red,
                blue,
                white = 5,
                yellow,
                green,
                pink
        };
        Colors color = green;
        printf("%d", color);
        return 0;
}

What will be the output when the above code is compiled and executed?

a. 4
b. 5
c. 6
d. 7
e. 8
f. 9
g. The code will have compile time errors

Consider the following class hierarchy:
class Base
{
}
class Derived : private Base
{
}
Which of the following are true?

a. The relation between Base and Derived can be described as: Base is a Derived
b. The relation between Base and Derived can be described as: Base has a Derived
c. Derived can access private member functions of Base
d. Derived can access public and protected member functions of Base

Consider the following class hierarchy:
class Base
{
}

class Derived : public Base
 
{
}

Which of the following are true?

a. The relationship between the Base and Derived can be described as: Base is a Derived
b. The relationship between the Base and Derived can be described as: Base has a Derived
c. Derived can access only public member functions of Base
d. Derived can access public and protected member functions of Base
e. The following line of code is valid:

Which of the following operators cannot be overloaded?

a. +=
b. >>
c. <
d. .
e. ::
f. &&
g. =
h. ?: