News Ticker

Menu

Browsing "Older Posts"

Browsing Category "General-Programming"

UpWork (oDesk) & Elance Visual Basic 6 Test Question & Answers

July 03, 2015 / No Comments
UpWork (oDesk) & Elance Visual Basic 6 Test Question & Answers are really very important to pass UpWork & Elance test. You will get top score at this skill test exam. If you found any problem or wrong answer please inform me via contact or comments. We will try to solve it in short. This test is extremely valuable to acquire knowledge of Visual Basic 6. Lets Start test.


Ques : Which of the following cannot be included in the Open method of the recordset?
Ans  : Cursor Type

Ques : You are creating a client application that calls ActiveX DLLs. Which of the following properties of the Err object provides the name of a component that sends an error back to the client application?
Ans  : Number

Ques :  Which event should you use to store property values into the PropertyBag?
Ans  : Terminate

Ques : Which event should be used to resize an ActiveX control as the user modifies the size of the control implementation on a form?
Ans  :  Resize

Ques : The ______ function can be used to run any .com, .exe, .bat or .pif file from a Visual Basic program.
Ans  : Shell

Ques : Consider the following program code:

(i) Dim FileName as String
Open FileName For Input As #FreeFile

(ii) Dim FileName as String
FileNum = FreeFile
Open FileName For Input As #FileNum
Ans  : Both (i) and (ii) are correct

Ques : What data type is the HelpContextID?
Ans  : String

Ques : To store pictures in an array, Visual Basic provides the _____ control.
Ans  : PictureClip

Ques : What is the sequence of events when a form is unloaded?
Ans  : QueryUnload, Unload and Terminate

Ques : What is the default value for the scalemode property of the form?
Ans  : Twip

Ques : Visual Basic displays information depending upon the current value of two properties of the form, called:
Ans  : CurrentX and CurrentY

Ques : Which of the following statements is capable of abandoning a series of modifications made to a recordset locked with a BatchOptimistic lock?
Ans  :  CancelUpdate

Ques : What is the purpose of the Image List Control?
Ans  : To display images to the user

Ques : A __________ control defaults to displaying the files in the current directory:
Ans  : File List Box

Ques : Which property procedure is used to retrieve the value of a property?
Ans  : Retrieve

Ques : Which method will you use to remove a form from the Screen but retain it in memory?
Ans  : Show method

Ques : Which events allow you to determine if a Control or Shift key was pressed by the user?
Ans  : Click and KeyPress

Ques : In order to overlap the controls (say a command button) during design time, we use the 'Send To Back' or 'Bring To Front' option from the Edit menu. To change it dynamically (i.e. during program execution) we need to change:
Ans  : Background color property

Ques : The ____ function returns the numeric value from a string expression:
Ans  : Val

Ques : What do CurrentX and CurrentY return?
Ans  : Current X and Y co-ordinates of mousepointer

Ques :  Variables that allow sharing of values across event procedures are called:
Ans  : Form level variable

Ques : Which of the following approaches to data modifications is the least efficient?
Ans  :  Updating through a cursor using a recordse

Ques : The interval property of the Timer control specifies the time in:
Ans  : Milliseconds

Ques : Which parameter of the WriteProperty method can be omitted but should be included to increase the efficiency of the control?
Ans  : Name

Ques : A project group is a Project which:
Ans  : Consists of several Projects

Ques : What is the purpose of the Class Builder add-in in Visual Basic:
Ans  : To add classes to the current project

Ques : An ADO dynamic property is:
Ans  : A property that changes value at runtime

Ques :   In order to provide a transparent background to the Form, you must change the _________ property to _______.
Ans  : BackStyle, Opaque

Ques : What does the controls collection contain?
Ans  : A list of all controls on a form

Ques : Global Procedures and Global Variables are declared in:
Ans  : Form Modules

Ques : Given the following code segment, how many instances of the form are created and displayed ?

      dim frmvar1 as frmperson,frmvar2 as frmperson
      set frmvar1 = new frmperson
      set frmvar2 = frmvar1
      load frmvar1
      frmvar2.show
Ans  : None

Ques :  Only Controls with a ________ property such as Picturebox, Toolbox, Statusbar etc. can be placed on an MDI form:
Ans  : Showtips

Ques : Whenever the current record is about to change, Visual Basic generates the ______ event:
Ans  : Validate

Ques : Which of the following will provide the best aggregate performance for a query that is not executed repeatedly?
Ans  : Direct execution

Ques : The _______ property enables Visual Basic to draw complete images in memory before displaying them on the Screen.
Ans  : AutoRedraw = True

Ques : Which event of an ActiveX control data provider runs every time a bound control extracts data through the provider?
Ans  : GetDataMember

Ques : One can convert a Visual Basic Application into ActiveX Document using:
Ans  : Visual Database Manager

Ques :  Which function or method will you use to get a count of the maximum index limit of an array?
Ans  :  UBound function

Ques : Which property of the ProgressBar determines how much of the bar is filled?
Ans  : Min

Ques : In order to change the mouse pointer shape from glass to watch-glass, the property to be used is:
Ans  : MousePointer

Ques : The caption and the name properties of the command button:
Ans  : Are one and the same

Ques : In order to access a file in Non-textual format, you have to open file in:
Ans  : Ascii Format

Ques : What is the extension of the Visual Basic project file that stores the design of a user control.
Ans  : .ctx

Ques : After a Dynaset type recordset has been created and opened, further searching is possible using the:
Ans  : FindNext method

Ques : Which method of the Recordset object should you use to navigate multiple recordsets returned by a stored procedure?
Ans  : NewRecordset

Ques :  Which event procedure is called only if AutoRedraw property is set to false:
Ans  : Form_GotFocus

Ques : Which events enable you to determine which key was pressed by the user?
Ans  :  Click and KeyPress

Ques : The Kill command in Visual Basic is used for:
Ans  : Stopping the current process

Ques : Which method would you use to get a free or unused File identifier while opening any file:
Ans  : FreeFile

Ques : Which event is fired when a text box loses focus?
Ans  : LostFocus

Ques :  Message Boxes can hold a maximum of _______ characters.
Ans  : 256

Ques : Which of the following is the only valid Resume statement in an error handler?
Ans  : Resume prior

Ques : Which is the only event of the timer control?
Ans  : Timer

Ques : Consider the following subprogram:

        Sub ChangeText(ByVal X as String,Y as String)
          Y = X
        End Sub


If you are calling it using the following code:

            Call ChangeText(Form1.Caption,Y$)
Ans  : The Caption of Form1 will change to the value contained in Y$

Ques : If one needs to use an ampersand(&) in a Label but does not want it to be an Access Key, the _______ property of the label must be set to False.
Ans  : Caption

Ques : Which property of the Err object returns the numeric value associated with the most recent runtime error?
Ans  : Description

Ques : The event Lost_Focus of one object results in _____ of the other object:
Ans  : Got_Focus

Ques : Which of the following ADO recordset types provides the greatest degree of concurrency?
Ans  : Static

Ques : The ______ property is used to show Tool Tips or Help Balloons when the mouse rests on the object:
Ans  : ToolTipText

Ques :  Which of the following can be shown to the user using the Common Dialog control in VB?
Ans  : Common messages passed to Windows

Ques :  Which property of the form changes the form's title?
Ans  : Name

Ques : In order to enable the DBGridControl or the MSFlexGrid Control to display the contents of a table or query, you need to set only the ______ property:
Ans  : DataSource

Ques : In Visual Basic, which method can you use to send key strokes to other Window applications?
Ans  : AppActivate

Ques :  The _______ property changes the tab order at runtime:
Ans  : Tab stop

Ques : You want the code of the close command button to execute upon pressing the ESC key, even though the focus may be on another control in the form. Which property of the command button would you set to true?
Ans  : Cancel

Ques : Which collection of an ActiveX control enumerates all of the properties that can be bound to a data source?
Ans  : DataFields

Ques : You can create menus by the ________ and _________.
Ans  : Menu Editor, Application Wizard

Ques :   What is the sequence in which the following events are triggered when a form is loaded?
Ans  : Initialize, Load, Resize and Paint

Ques : Procedures declared in a _____ are local whereas procedures declared in a ______ are  available to the whole application.
Ans  : Form window, standard or code module

Ques : Which property of the ListView control determines which field a sort is based on?
Ans  : Sorted

Ques :  The method used to search for records from within a table type recordset object is:
Ans  : LookUp

Ques : Which event is triggered when the user moves to another open form?
Ans  : Unload

Ques : Which of the following is an event of the Shape control?
Ans  : GotFocus

Ques :  Which line of code listed here can be used to create a string of fixed length:
Ans  : Dim strFirstName as String

Ques : Which of the following statements is incorrect regarding toolbars?
Ans  : There can be only one toolbar on a form

Ques : The settings for the Color properties in Visual Basic are indicated by:
Ans  : Decimal Coding

Ques : What does the forms collection contain?
Ans  : A list of all forms in a project

Ques : Which of the following will perform a direct execution of a Command object?
Ans  : The Execute method

Ques : The _______ function enables a VB application to make use of the idle time and to respond periodically to events.
Ans  :  GetTime()

Ques : The Load & Activate events are associated with:
Ans  : All controls

Ques : What you must do before making calls to an ActiveX DLL project in the same Project Group?
Ans  : Compile the DLL

Ques : Name the only property supported by a collection?
Ans  : Name

Ques : Which event of a text box would you use for validating the data entered by the user?
Ans  : Validate

Ques : Which event occurs only once in the entire life cycle of an ActiveX control?
Ans  : Initialize

Ques : How can you keep the user from exiting a form by clicking the Close button?
Ans  : Place code in the Terminate event

Ques : Which of the following debug tools would you use to locate your current position in a series of embedded procedure calls?
Ans  :  Locals window

Ques : You are creating an ActiveX component that raises user-defined errors. Which of the following statements correctly raises an error to the client with error number 20000?
Ans  : Err.Raise vbObjectError + 20000

Ques :  A prepared statement is:
Ans  : Query text cached on the server

Ques : The _______ method loads the form named 'Form1' in to memory and also displays it.
Ans  :  Load Form1

Ques : You want to display the code and the description of an error. What would be the correct syntax?
Ans  : Msgbox err.no & err.text

Ques : If the CancelError Property of the CommonDialog Box is set to true then which of the following statement is true:
Ans  : A runtime error can result if the user clicks the cancel button

Ques : How do you create a read only property in a form?
Ans  : Create only a Property Set procedure

Ques : Which three methods does the collection object support?
Ans  : Let, Get, Set

Ques : Labels do not respond to _____ and ______ events.
Ans  : Got_Focus , Lost_Focus

Ques : The _______ method resets the contents of bound controls to their original values when the user clicks on the cancel button.
Ans  : UpdateControls

Ques : Which of the following is the only drag related event?
Ans  : DragEnter

Ques : You are creating an ActiveX component that raises user-defined errors. What is the valid range of error numbers that you can use for user-defined errors?
Ans  : 1-1000

Ques : Which of the following procedure types will execute when you assign a value to a property of an object?
Ans  : Property Get

Thanks for watching this test Question & Answers. Please don't forget to leave a comment about this post. You can also find some more effective test question & answers, information, techniques, technology news, tutorials, online earning information, recent news, results, job news, job exam results, admission details & another related services on the following sites below. Happy Working!
News For Todays ARSBD oEtab ARSBD-JOBS DesignerTab

UpWork (oDesk) & Elance C Programming Test Question & Answers

/ No Comments
UpWork (oDesk) & Elance C Programming Test Question & Answers are really very important to pass UpWork & Elance test. You will get top score at this skill test exam. If you found any problem or wrong answer please inform me via contact or comments. We will try to solve it in short. This test is extremely valuable to acquire knowledge of C Programming. Lets Start test.


Ques : Which of the following statements will result in a compilation error?
Ans  :  int n=5, x; x= ++n++;
        int n=5, x; x= (n+1)++;
        int n=5, x=6; x= (n+x)++;


Ques : Which of the following statements are correct for the keyword register?
Ans  : It requests that the variable be kept in the CPU register for maximum speed
       It does not guarantee that the variable value is kept in CPU register for maximum speed

Ques : Which is/are the type/s of memory allocation that needs/need the programmer to take care of memory management?
Ans  : Dynamic memory allocation
       Memory allocation on stack

Ques : Given the array:

int num[3][4]= {
                    {3,6,9,12},
                    {15,25,30,35},
                    {66,77,88,99}
                    };
what would be the output of *(*(num+1)+1)+1?
Ans  : 26

Ques : Given the array:

int num[3][4]=
{
{3,6,9,12},
{15,25,30,35},
{66,77,88,99}
};

what would be the output of *(*(num+1))?
Ans  : 15

Ques : What would be printed on the standard output as a result of the following code snippet?

main()
{
        int i=5;
        char option = 5;
        switch(option)
        {
                case '5':
                                printf("case : 1 \n");
                                break;
                case i:
                                printf("case : 2 \n");
                                break;
                default:
                                printf("case : 3 \n");
                                break;
        }
        return 0;
}
Ans  : Result in compilation error

Ques : What is the return value in case a file is not opened successfully by using fopen()?
Ans  : NULL

Ques : What will be the output of following code?

int main()
   {
      int i;
      i = 0;
      for (i = 1; i <2 b="" i="">
      {
          i++;
          printf( "%d", i );
          continue;
          printf( "%d", i );
      }
      return 0;
   }
Ans  : 2

Ques : What would be printed on the standard output as a result of the following code snippet?

char *str1 = "Hello World";
strcat(str1, '!');
printf("%s", str1);
Ans  : The code snippet will throw a compilation error

Ques : Given the following array:

int a[8] = {1,2,3,4,5,6,7,0};
what would be the output of
        printf("%d",a[4]); ?
Ans  : 5

Ques : In order to read structures/records from a file, which function will you use?
Ans  :  fscanf()

Ques :  An array is defined with the following statement in a file, file1.c

        int a[ ] = { 1, 2, 3, 4, 5, 6 };

In another file, file2.c, the following code snippet is written to use the array a:

extern int a[];
int size = sizeof(a);

What is wrong with the above code snippet?
Ans  : An extern array of unspecified size is an incomplete type. The size of the operator during compile time is unable to learn the size of an array that is defined in another file

Ques : What would be printed on the standard output as a result of the following code snippet?

main()
{
        char *s="Hello World";
        char s1[20], s2[20];
        int len = sscanf(s,"%s",s1);
        printf("%s : %d", s1, len);
}
Ans  : Hello : 1

Ques :  Suppose there is a file a.dat which has to be opened in the read mode using the FILE pointer ptr1, what will be the correct syntax?
Ans  :  ptr1 = fopen("a.dat","r");

Ques : Given the following array:
     
char books[][40]={
                         "The Little World of Don Camillo",
                         "To Kill a Mockingbird",
                         "My Family and Other Animals",
                         "Birds, Beasts and Relatives"
                         };
what would be the output of printf("%s",books[3]);?
Ans  : Birds, Beasts and Relatives

Ques : What would be printed on the standard output as a result of the following code snippet?

void main()
{
    unsigned char a=25;
    a = ~a;
    signed char b = 25;
    b = ~b;
    printf("%d %d ", a, b);
}
Ans  : 230 -26

Ques : What will be printed on the standard output as a result of the following code snippet?

void main()
{
        int num1 = 30, num2 = 4;
        float result;
        result = (float)(num1/num2);
        printf("%.2f", result);
        return 0;
}
Ans  : 7.00

Ques : Which of the following is/are the correct signature/s of main with command line arguments?
Ans  :  int main(int argc, char *argv[])

Ques : From which of the following loop or conditional constructs, is "break" used for an early exit?
Ans  :  All of the above

Ques : Given the operators:

1) *
2) /
3) %

What would be the order of precedence?
Ans  : 1 and 2 have the same precedence, 3 is of lower precedence

Ques : Which of the following declarations of structures is/are valid?

        1)
                struct node {
                int count;
                char *word;
                struct node next;
                }Node;
        2)
                struct node {
                int count;
                char *word;
                struct node *next;
                }Node;
        3)
                struct node {
                int count;
                char *word;
                union u1 {
                        int n1;
                        float f1;
                }U;
                }Node;
Ans  : 1,2,3

Ques : What would be printed on the standard output as a result of the following code snippet?

main()
{
        int n=5, x;
        x = n++;
        printf("%d ", x);
        x = ++n;
        printf("%d ", x++);
        printf("%d", x);
        return 0;
}
Ans  : 5 7 8

Ques : In which area of memory are static variables allocated?
Ans  :   heap

Ques : Read the statement below:

extern int a;

Which of the following statement/s pertaining to the above statement is/are correct?
Ans  :  Brings the scope of the variable defined outside the file to this file

Ques : What would be printed on the standard output as a result of the following code snippet?

main()
{
char *pmessage = "asdfgh";
*pmessage++;
printf("%s", pmessage);
return 0;
}
Ans  : sdfgh

Ques :  Which function returns the current pointer position within a file?
Ans  : ftell()

Ques : Which of the following is a function for formatting data in memory?
Ans  : sprintf()

Ques : Which function allocates memory and initializes elements to 0?
Ans  :   calloc()

Ques : Is the following statement correct? If not, why not? If yes, what is the size of the array?

int array[][3] = { {1,2}, {2,3}, {3,4,2} };
Ans  : Yes, the size is three columns by two rows

Ques : Which of the following sets of conversion statements may result in the loss of data?
Ans  :    int i; float f; i=f; f=i;

Ques : Consider the following code.

int i = 4, *j, *k;

Which one of the following statements will result in Compilation error?
Ans  : j = j * 2;

Ques : By which file function you can position the file pointer in accordance with the current position?
Ans  : fseek()

Ques : What will be printed on the standard output as a result of the following code snippet?

void main()
{
        int arr[][2] = {1,2,3,4,5,6};
        printf("%d",arr[2][1]);
}
Ans  : 6

Ques : Which function will you use to position the file pointer at the beginning of the file?
Ans  : rewind()

Ques : Which header file are methods(or macros) isalpha(), islower() a part of?
Ans  :  ctype.h

Ques : What will be printed on the standard output as a result of the following code snippet?

void main()
{
    int i,j,k;
    i=4;
    j=30;
    k=0;
    k=j++/i++;
    ++k;
    printf("%d %d %d",i,j,k);
}
Ans  :  5 31 8

Ques :  What would be printed on the standard output as a result of the following code snippet?

main()
{
enum {red, green, blue = 6, white};
printf("%d %d %d %d", red, green, blue, white);
return 0;
}
Ans  :  0 1 6 7

Ques : What would be printed on the standard output as a result of the following code snippet?

main()
{
    int a[5] = {1,4,5,6,9};
    printf("%d\t", *a);    //Line 1
    printf("%d", *++a);    //Line 2
return 0;
}
Ans  : Compilation Error in "Line 2"

Ques : Which of the following standard functions is used to close a file?
Ans  :  fclose()

Ques : Identify the incorrect statement.
Ans  : Memory is reserved when a structure label is defined

Ques : Which of the following comparison statements will be true if an integer is 16 bits and a long is 32 bits on a machine?
Ans  : -1L > 1U

Ques :  Which of the following is the correct way of initializing a two-dimensional array?
Ans  :  char str[2][4]={ {'a','b','c','\0'}, {'d','e','f','\0'} };

Ques :   Which function will you use to write a formatted output to the file?
Ans  :  fprintf()

Ques : What would be printed on the standard output as a result of the following code snippet?

main()
{
        char option = 5;
        switch(option)
        {
                case '5':
                                printf("case : 1 \n");
                                break;
                case 5:
                                printf("case : 2 \n");
                                break;
                default:
                                printf("case : 3 \n");
                                break;
        }
        return 0;
}
Ans  : case : 2

Ques : What would be printed on the standard output as a result of the following code snippet?

#define func(t, a, b) { t temp; temp=a; a=b; b=temp; }
main()
{
        int a=3, b=4;
        float c=4.5, d = 5.99;
        func(int, a, b);
        func(float, c, d);
        printf("%d %d ", a, b);
        printf("%.2f %.2f\n", c, d);
}
Ans  : 4 3 5.99 4.50

Ques : What would be printed on the standard output as a result of the following code snippet?

main()
{
        void addup (int b);
                addup(b);
        return 0;
}
int b = 5;
void addup (int b)
{
        static int v1;
        v1 = v1+b;
        printf("%d ", v1);
}
Ans  : Will result in Compilation Error

Ques : Given the following array declaration:

       int a[2][3][4];
what would be the number of elements in array a?
Ans  : 24

Ques : Which file header is to be included for file handling in a C program?
Ans  : stdio.h

Ques : What is the return type of the following function declaration?

func(char c);
Ans  : undefined

Ques : What is the function to concatenate two strings?
Ans  :      strcat()

Ques : Which of the following statements is valid and correct?
Ans  : char amessage[] = "lmnop"; amessage++;

Ques : Which of the following is not a valid mode for opening a file?
Ans  : i

Ques : Given the following array:

        char books[][40]={
                         "The Little World of Don Camillo",
                         "To Kill a Mockingbird",
                         "My Family and Other Animals",
                         "Birds, Beasts and Relatives"
                          };
what would be the output of printf("%c",books[2][5]);?
Ans  : m

Ques : What will be printed on the standard output as a result of the following code snippet?

void main()
{
        char arr[] = {'R','A','M','\0'};
        printf("%d",strlen(arr));
}
Ans  : 3

Ques : Which function will convert a string into a double precision quantity?
Ans  : atof()

Ques : Which of the following is not a type of operator ?

Ans  : Ternary

Ques : The declaration int *(*p)[10] indicates:
Ans  :  p is a pointer to an array of integer pointers

Ques : What is the output of the following program ?

main()
{

int u = 1, v = 3;
printf("%d %d",u,v);
funct1(&u,&v);
printf(" %d %d\n",u,v);
}

void funct1(int *pu, int *pv)
{
*pu=0;
*pv=0;
return;
}
Ans  :  1 3 0 0

Ques : What would be printed on the standard output as a result of the following code snippet?

main( )
{
char *str[ ] = {
"Manish"
"Kumar"
"Choudhary"
};
printf ( "\nstring1 = %s", str[0] );
printf ( "\nstring2 = %s", str[1] );
printf ( "\nstring3 = %s", str[2] );
}
Ans  : string1 = ManishKumarChoudhary string2 = (null) string3 = (null)

Ques : Which standard function is used to deallocate memory allocated by the malloc() function?
Ans  : free

Ques : The declaration int (*p[5])() means:
Ans  : p is an array of pointers to functions the return type of which is an integer

Ques :What will be printed on the standard output as a result of the following code snippet?

void main()
{
        int arr[5]={1,2,3,4,5};
        printf("%d\n", *(arr+4));
}
Ans  : 5

Ques : What does the argv[0] represent?
Ans  :  The program name

Ques : What will happen when the following code is executed?

void main()
{
    char arr1[] = "REGALINT";
    char arr2[10] = "REGALINT";
    printf("%d,",sizeof(arr1));
    printf("%d",sizeof(arr2));
}
Ans  :   9,10

Ques : What would be printed on the standard output as a result of the following  code snippet?

main()
{
        enum {red, green, blue = 0, white};
        printf("%d %d %d %d", red, green, blue, white);
        return 0;
}
Ans  : 0 1 0 1

Ques : What is wrong with the following function prototype statement?

int func();
Ans  : While calling a function, the type int is not needed

Ques : What will be printed on the standard output as a result of the following code snippet?

void main()
{
        char arr[] = {'R','A','M'};
        printf("%d",strlen(arr));
}
Ans  : Cannot be determined

Ques : Which of the following is not a storage type?
Ans  :  auto

Ques :If a two dimensional array arr[4][10](an array with 4 rows and 10 columns) is to be passed in a function, which of the following would be the valid parameters in the function definition?
Ans  :  fn(int arr[4][10])

Ques : Which of the following is not a string function?
Ans  : strcomp()

Ques : What would be printed on the standard output as a result of the following code snippet?

char i = 'A';
char *j;
j = & i;
*j = *j + 32;
printf("%c",i);
Ans  : a

Ques : What will be printed on the standard output as a result of the following code snippet?

void main()
{
        char arr1[] = "REGALINT";
        printf("%d,",strlen(arr1));
        printf("%d",sizeof(arr1));
}
Ans  : 8,9

Ques : What will be printed on the standard output as a result of the following code snippet?

int funr(int x, int y)
{
        if(x <= 0)
        {
                   return y;
        }
        else
        {
                return (1+funr(x-1,y));
        }
}

void main()
{
    printf("%d",funr(2,3));
}
Ans  : 5

Ques : What would be printed on the standard output as a result of the following code snippet?

#define Name Manish
main()
{
printf("My name""Name");
}
Ans  : My nameName

Ques : What will be printed on the standard output as a result of the following code snippet?

main()
{
        int num = 425;
        printf("%d", printf("%d", num));
}
Ans  : 4253

Ques : What would be printed on the standard output as a result of the following code snippet?

main()

{

        signed char i = 1;

        for (; i<=255; i++)

        printf ("%d ",i);

        return 0;

}
Ans  : 1 2 3 . . . 127 -128 -127 ... 0 1 2 3 . . . (infinite times)

Ques :   What would be printed on the standard output as a result of the following code snippet?

#define max(a, b) ((a) > (b)?(a):(b))
main()
{
        int a=4;
        float b=4.5;
        printf("%.2f\n",max(a, b));
}
Ans  : 4.50

Ques :  Which of the following is not a file related function?
Ans  : puts()

Ques : What would be printed on the standard output as a result of the following code snippet?

#define max(a, b)((a) > (b)?(a):(b))
main()
{
int a=4, c = 5;
printf("%d ", max(a++, c++));
printf("%d %d\n", a,c);
}
Ans  : 6 5 7

Ques : Which of the following file modes would mean read + append?
Ans  : a+

Ques : What would be printed on the standard output as a result of the following code snippet?

int Recur(int num)
{
if(num==1 || num==0)
return 1;
if(num%2==0)
return Recur(num/2)+2;
else
return Recur(num-1)+3;
}

int main()
{
        int a=9;
        printf("%d\n", Recur(a));
        return 0;
}
Ans  : 10

Ques : What will happen when the following code is executed?

{
int num;
num =0;
do {-- num;
printf("%d\n", num);
num++;
} while (num >=0);
}
Ans  : The loop will run infinitely

Ques : Which of the following functions is used to extract formatted input from a file?
Ans  :  fscanf()

Ques : What does the following function do?

int fn(unsigned int x)
{
        int count = 0;
        for(; x!=0; x&=(x-1))
                count++;
        return count;
}
Ans  : Returns the number of 1 bits(bits having one) in the number x

Thanks for watching this test Question & Answers. Please don't forget to leave a comment about this post. You can also find some more effective test question & answers, information, techniques, technology news, tutorials, online earning information, recent news, results, job news, job exam results, admission details & another related services on the following sites below. Happy Working!
News For Todays ARSBD oEtab ARSBD-JOBS DesignerTab

UpWork (oDesk) & Elance Objective-C Test Question & Answers

/ No Comments
UpWork (oDesk) & Elance Objective-C Test Question & Answers are really very important to pass UpWork & Elance test. You will get top score at this skill test exam. If you found any problem or wrong answer please inform me via contact or comments. We will try to solve it in short. This test is extremely valuable to acquire knowledge of Objective-C. Lets Start test.


Ques : Which of the following is the fastest?
Ans  : Mutex implicit locking

Ques : How do you free an object?
Ans  :  [obj release]

Ques :  What is the isa variable in objects?
Ans  : Object class identification

Ques : What is true regarding C functions inside .m files?
Ans  : They can contain Obj-C code

Ques : What does the following imply?

Worker *ceo = [[Worker alloc] init];
ceo->boss = nil;
Ans  : That the boss instance variable is declared @public

Ques : Can you send messages to nil?
Ans  : Yes

Ques :  In which version of Objective-C did the fast enumeration system appear?
Ans  : 2.0

Ques : What comments are supported in Obj-C?
Ans  :  // Line comments

Ques : What type of variable do you need to use to implement singletons?
Ans  : static

Ques : As categories can't have instance variables, what class could you use to implement a full class only with categories?
Ans  :  NSMutableDictionary

Ques : How do you throw an exception?
Ans  : @throw exception

Ques : What is true regarding strings?
Ans  : Obj-C strings are not of static storage

Ques : How do you include the root "Object" class?
Ans  : It depends on the compiler

Ques : What is true regarding @protected?
Ans  : The instance variable is accessible within the class that declares it and within classes that inherit it

Ques : What is a protocol?
Ans  :  An interface without an implementation

Ques :  Which of the following is incorrect?
Ans  : [AClass release]

Ques : How do you allocate an object?
Ans  : MyClass *obj = [MyClass alloc];

Ques : What will be the output of the following code?

static int
a (void)
{
printf ("a\n");
return 0;
}

static int
b (void)
{
printf ("b\n");
return 1;
}

static int
c (void)
{
printf ("c\n");
return 2;
}

int
main (int argc, const char *argv[])
{
printf ("%d %d %d", a (), b (), c ());
return 0;
}
Ans  : a b c 0 1 2

Ques : What is nil?
Ans  : The null object

Ques : Can an exception caught in @catch be re-thrown?
Ans  : Yes

Ques : What class specifiers are supported?
Ans  : There is no such thing as class specifiers

Ques : Which of the following declares a protocol?
Ans  : @protocol ProtocolName

Ques : What is the Obj-C runtime?
Ans  : A C library

Ques : What's the difference between copy and deepCopy?
Ans  : copy creates a copy at the first level, while deepCopy copies the instance variables

Ques : Which of the following can be inherited?
Ans  : Protocols

Ques : A method can be tagged to be called only by a specific class and its subclasses.
Ans  : False

Ques : Which of the following is not recommended?
Ans  : None of the above

Ques : A class can have two methods with the same name, but with different argument types.
Ans  : False

Ques : What are @try and @catch?
Ans  :  Exception keywords

Ques : A class can conform to only one protocol.
Ans  : False

Ques : Which of the following creates a class that conforms to a protocol?
Ans  : @interface ClassName

Ques : What is the id type?
Ans  :  A generic C type that Objective-C uses for an arbitrary object

Ques : What is a @finally block?
Ans  :  A block of code that is run whenever an exception is thrown or not

Ques : Is the following code a correct allocation?

MyClass myObj;
[&myObj aMessage];
Ans  : No

Ques : What is not supported in Obj-C?
Ans  : Method argument default value

Ques : Which of the following does not happen when you throw an exception in a @synchronized block?
Ans  : The object is deallocated

Ques : What can be linked to an Obj-C program without any particular process?
Ans  : C libraries

Ques : What is the C type used to work with objects in Obj-C?
Ans  : pointer

Ques : What is a category?
Ans  :  A category is a way to add methods to a class which already exists

Ques : Protocols are like classes; they can inherit.
Ans  : True

Ques : Which of the following is false?
Ans  : When a method is called, the send is automatically available as the sender variable, like self or super

Ques : What happens if two categories define methods with the same names for the same class?
Ans  :  At runtime, either method will be called

Ques : What can you do with categories?
Ans  : Add methods to a class without subclassing it

Ques : In which version of Objective-C did the properties system appear?
Ans  :  2.0

Ques : What is the default visibility for instance variables?
Ans  : @protected

Ques : What happens if you release an unretained object twice?
Ans  : MemoryException is raised

Ques : In Obj-C 2.0, what do the fast enumeration protocols rely on to provide fast Enumerations?
Ans  :  C arrays

Ques : What can you use to avoid the msgSend function overhead?
Ans  : SEL

Ques : Which C feature is not supported in Obj-C?
Ans  :  Support is compiler dependant

Ques : What does Obj-C not support?
Ans  : Automatic variables

Ques : When using the garbage collector, which method, that is normally called without the collector, is not called on your objects where they are collected?
Ans  : dealloc

Ques : What can be used as Object instance variables?
Ans  : pointers

Ques : What is a SEL?
Ans  : A pointer to a method

Ques : What is an IMP?
Ans  : The C type of a method implementation pointer

Ques : What is true regarding @public?
Ans  : It breaks encapsulation

Ques : What is an autoreleased object?
Ans  : An object that will be released when the current AutoreleasePool is deallocated.

Ques : If you need to allocate custom memory, in which method will you do so?
Ans  : None of the above

Ques : What is #import
Ans  :  C preprocessor construct to avoid multiple inclusions of the same file

Ques : What is true regarding messaging?
Ans  :  Messaging is fully dynamic, which means you can compile some code that sends a message to a class that doesn't implement it, and add a category later, in a dynamic library for example

Thanks for watching this test Question & Answers. Please don't forget to leave a comment about this post. You can also find some more effective test question & answers, information, techniques, technology news, tutorials, online earning information, recent news, results, job news, job exam results, admission details & another related services on the following sites below. Happy Working!
News For Todays ARSBD oEtab ARSBD-JOBS DesignerTab

UpWork (oDesk) & Elance iPhone Programming OS 2.1 Test Question & Answers

/ No Comments
UpWork (oDesk) & Elance iPhone Programming OS 2.1 Test Question & Answers are really very important to pass UpWork & Elance test. You will get top score at this skill test exam. If you found any problem or wrong answer please inform me via contact or comments. We will try to solve it in short. This test is extremely valuable to acquire knowledge of iPhone Programming OS 2.1. Lets Start test.


Ques : Which of the following languages can be used to write the code for Xcode projects?
Ans  : C + C++ Objective-C+ Objective-C++

Ques : Which of the following need to be modified while localizing an application?
Ans  :
 Nib files (windows, views, menus).
 Static text.
 Icons and graphics.
 Dynamic text generated by your program.

Ques : Which of the following statements regarding Objective-C are correct?
Ans  : In Objective-C, the keyword for NULL is nil.
In Objective-C, for the object-oriented constructs (such as method return values), id is the default data type.
The keyword nil has an id with a value of 0.

Ques : Which of the following directives are used to declare and define classes, categories, and protocols?
Ans  : @interface + @protocol + @end

Ques : Which of the following are valid touch attributes in a UITouch class object?
Ans  : timestamp + phase+tapCount

Ques : Which of the following statements comply with the fundamental rules of Memory Management in Objective-C?
Ans  : The ownership of the object is taken when it is created using a method the name of which begins with alloc or new or contains copy + The ownership of the objects is relinquished by using release or autorelease +  autorelease just means - send a release message later

Ques : The genstrings tool can parse _____.
Ans  :
 C files with .c filename extension.

 Objective-C files with .m filename extension.

 Java code files with .java filename extension.

Ques : Which of the following are the Derivative types defined in Objective-C?
Ans  :
 short

 long

 long long

Ques : Which of the following options regarding UIWindow and UIView classes are correct?
Ans  :  A UIWindow class object holds the contents of a UIView class object.

 Both UIWindow and UIView classes are required to display anything on the iPhone.

 UIWindow is the iPhone's base window class and the UIView class is primarily an abstract super-class.

Ques : Which of the following statements regarding Memory Management are correct?
Ans  : The alloc method creates a new object and returns it with a reference count of 1

 release decreases the receiver's reference count by 1

 autorelease decreases the receiver's reference count by 1 at some point in the future

Ques : Which of the following events occur when the retain count of the object drops to 0?
Ans  : The object is deallocated

      The dealloc method is invoked automatically

Ques : Which of the following SDK classes can be used to get the location of the movement of a finger on the iPhone screen?
Ans  :  UIEvent
        UITouch
 
Ques : You have added the following code lines in your @implementation block in your ControllerView file:

        @synthesize textField;
        @synthesize label;
        @synthesize string;

And in your dealloc method, you have added the following code lines:

        - (void)dealloc {
            [textField release];
            [label release];
            [string release];
            [super dealloc];
        }

What is the purpose of adding the above lines in your dealloc method?
Ans  : To release the instance variables

       To conform to the rules of memory management

Ques : Which of the following terms are related to Memory Management in Objective-C?
Ans  :  alloc
        release

Ques : Is NSMutableArray thread safe?
Ans  : No

Ques :  What is the purpose of active executable in an Xcode project?
Ans  : To specify which program is launched and how, when you run or debug from within Xcode.

Ques : State whether the following statement is true or false:

Interface Builder doesn't generate source code
Ans  : False

Ques : Locking all connections before editing the Nib files can be achieved by using:
Ans  : An option in the Preferences panel of Interface Builder.

Ques : What is the endianness of the network for IP communications?
Ans  : Big endian

Ques : In your iPhone application, you want that the user should be able to select the date in Month, Day and Year mode. You have a UIDatePicker class object named dateModePicker. Which of the following code snippets is correct in order to apply this mode?
Ans  : [ dateModePicker setDatePickerMode: 1 ];

Ques : Which of the following is the base class for all iPhone applications?
Ans  : UIApplication

Ques : Given the string "192.168.1.1", how can you get an integer address (to fill a sockaddr_in structure)?
Ans  : With inet_aton

Ques : Can you use POSIX sockets on the iPhone?
Ans  : Yes

Ques : If you want to know if a host is reachable via the network, what would you use in your application?
Ans  : SCNetworkReachabilityCreateWithName

Ques : What happens if Xcode is not able to find a file or folder at the path defined for it in the project?
Ans  :  Xcode displays the item in red in the project window.When the genstrings tool discovers a key string used more than once in a single strings file, it:

Ques : When the genstrings tool discovers a key string used more than once in a single strings file, it:
Ans  : merges the comments from the individual entries into one comment string and generates a warning.

Ques :  Which of the following classes is used to internalize an XML into a logical tree structure?
Ans  : NSPropertyListSerialization class

Ques : What is the CompressResources build step in an iPhone Xcode project?
Ans  : It resizes the png files in the project for displaying them in the iPhone.

Ques : Does ABPersonCreate function add the newly created record into the address book?
Ans  : No

Ques : How can you restrict the delivery of multi-touch events to their subviews
Ans  : By overriding hitTest:withEvent:

Ques :  Which of the following should be used to draw 3D content?
Ans  : OpenGL ES

Ques :  Which of the following is a feature of CAPropertyAnimation class in Core Animation?
Ans  :   It is an abstract subclass that provides support for animating a layer property specified by a key path

Ques : Is NSRunLoop thread safe?
Ans  : No

Ques : Which type of data is returned by the following function?

   CFDataRef CreateDataFromImage(UIImage *image)

{
    return CGDataProviderCopyData(CGImageGetDataProvider(image.CGImage));
}
Ans  : Raw pixel data.

Ques : How can you play video on the iPhone from your application?
Ans  : With the MediaPlayer framework

Ques : What is the default setting to refer to file locations in your Xcode project?
Ans  : Relative to Enclosing Group

Ques : How can you create an OpenGL ES texture with a .png image?
Ans  : Using CGContextDrawImage in a CGBitmapContext

Ques : Which of the following classes will be used to embbed web content in an iPhone application?
Ans  : UIWebView

Ques : In your iPhone application, you want to apply an action sheet style that will display white text with transparent black background whenever a confirmation is required from the user. You have a UIActionSheet class object named "actionuser". Which of the following code snippets is the right one for applying this style?
Ans  :  [ actionuser setActionSheetStyle: 2 ];

Ques : Which of the following samples returns the first name of a person listed under p in the address book?
Ans  :  ABRecordCopyValue(p, kABPersonFirstNameProperty);

Ques : In which file is the following function called in your application?
       
        int retVal = UIApplicationMain(argc, argv, nil, nil);
Ans  : main.m only

Ques : Can you place calls using the iPhone SDK?
Ans  : Yes

Ques : Can you use POSIX threads on the iPhone?
Ans  : Yes

Ques : Which of the following is the correct syntax for declaring a class in Objective-C?
Ans  : @interface ClassName : ItsSuperclass { instance variable declarations } method declarations @end

Ques : What is the screen resolution of the iPhone 3G?
Ans  : 480x320

Ques :Which of the following methods does the UIKit provide in order to draw a string at a specific point.
Ans  : drawAtPoint:

Ques : From which of the following classes does a UITextView class object inherit its features?
Ans  : UIView

Ques : Which of the following can be used to draw a tiled image?
Ans  : Quartz 2D function CGContextDrawTiledImage

Ques :  In the CALayer class, the property contentsGravity allows you to position and scale the layer's contents image within the layer bounds. What is the role of the kCAGravityLeft positioning constant in contentsGravity?
Ans  : It positions the content image vertically centered on the left edge of the layer.

Ques : Before editing the Nibs, one should:
Ans  : Lock all connections.

Ques : In which language is the address book framework written?
Ans  : c

Ques : Can CGGradientRef be used on the iPhone to draw gradients?
Ans  : Yes

Ques : While using an iPhone, a user switches from one application to another application or service on the device. What is the most important factor to be kept in mind to ensure that your application reflects the most recent changes made by the user the next time it starts?
Ans  : The application should be programmed to save any user changes as they are made as quickly as possible.

Ques : Which of the following debugging environments are provided by Xcode to find and squash bugs in your code?
Ans  : All of the above

Ques : On the iPhone, what are the types of Person entries and Group entries?
Ans  : ABRecordRef and ABRecordRef

Ques : How do you play a short sound on the iPhone?
Ans  :  With AudioServicesPlaySystemSound function

Ques : What is the function of the Code Sense feature in Xcode?
Ans  : Code Sense maintains an index that contains important information for your project.

Ques : Whenever the iPhone users switch to another application like answering the phone, or checking their email, the application they were previously using _____.
Ans  : resumes as soon as the other application is terminated

Ques : How can you prevent a view from receiving touch events?
Ans  : By setting userInteractionEnabled to false

Ques : Which of the following is true?
Ans  : Each thread maintains its own stack of NSAutoreleasePool objects

Ques : Refer to the given image:

Which of the above window panes will display Build system output when Xcode builds your target and shows the corresponding warnings and errors?
Ans  : A

Ques : Which of the following classes automatically manages transition
animation between Views?
Ans  : UINavigationController

Ques : Which of the following is not a touch event method?
Ans  :  - (void)touchesDragged:(NSSet *)touches withEvent:(UIEvent *)event;

Ques : How many windows does an iPhone application typically have?
Ans  : 1

Ques : Which of the following shapes is generated by Views in an iPhone?
Ans  : Rectangular

Ques : Using the following function, what will you get from the default database?

NSUserDefaults* defs = [NSUserDefaults standardUserDefaults];
NSArray* languages = [defs objectForKey:@"AppleLanguages"];
NSString* preferredLang = [languages objectAtIndex:0];
Ans  : The user's preferred language.

Ques : While recording a sound, how can you know if the source of the sound is from the built-in microphone or headphone microphone?
Ans  : Phone OS 2.1 version does not support sound recording.

Ques : Can non-main threads poll for events?
Ans  : Yes

Ques : What can trigger a call to touchesCancelled:withEvent: ?
Ans  : A system event, such as a phone call

Ques :  In which of the following classes are the addChild, insertChild, and removeChildAtIndex methods defined?
Ans  : NSXMLElement Class

Ques : While opening Nib files, which of the following should not be ignored?
Ans  : If Objects in a Nib file have broken connections, they should not be restored.

Ques :  What does CFSocketGetNative return?
Ans  :  A POSIX socket handle

Ques : Are instances of ABAddressBookRef thread safe?
Ans  : Yes

Ques : Which of the following best describes View Controllers?
Ans  : View Controllers provide the basic user interface logic for presenting numerous application views to the user.

Ques : What is the default value for the anchorPoint property in Layer Geometry?
Ans  :  (0.5,0.5)

Ques : Can the iPhone use Bonjour messaging?
Ans  : Yes

Ques : Which of the following debugging tasks are provided by Xcode to find and squash bugs in your code?
Ans  : All of the above

Ques : If the code is written using the Core Foundation and Foundation macros, the simplest way to create strings files is:
Ans  : By using the genstrings command-line tool.

Ques : If you try to run an application in the iPhone Simulator without having created the ControllerView Nib file, what will happen?
Ans  : If you set the Nib file name to nil using initWithNibName:nil, the application will run

Ques : Which design pattern for your application periodically sends messages to another object to ask for input or to notify that an event is occurring?
Ans  : Delegation

Ques : Choose the correct statement:
To "flip" your user interface:
Ans  : use the setAnimationTransition:forView:Cache: method of the UIView class, and provide the appropriate constant to specify the flip direction.

Ques : By which of the following methods can an NSAutoreleasePool object be created?
Ans  :  autorelease

Ques : Is OpenAL available on the iPhone?
Ans  : Yes

Ques : What are universal binaries in Xcode?
Ans  : These are executable files that can contain code and data for more than one architecture.

Ques : The most effective way to ensure that users have a positive application-switching experience is to _______.
Ans  : pare the launch time of the application to the minimum

Ques : Are multiple touches enabled by default?
Ans  : No

Ques : Can your application change the global sound volume?
Ans  : No

Ques : Which of the following statement is incorrect with regard to Object Ownership in Memory Management?
Ans  : If an object is copied, the retain count is returned as 0

Thanks for watching this test Question & Answers. Please don't forget to leave a comment about this post. You can also find some more effective test question & answers, information, techniques, technology news, tutorials, online earning information, recent news, results, job news, job exam results, admission details & another related services on the following sites below. Happy Working!
News For Todays ARSBD oEtab ARSBD-JOBS DesignerTab

UpWork (oDesk) & Elance C++ Programming Test Question & Answers

June 28, 2015 / No Comments
UpWork (oDesk) & Elance C++ Programming Test Question & Answers are really very important to pass UpWork & Elance test. You will get top score at this skill test exam. If you found any problem or wrong answer please inform me via contact or comments. We will try to solve it in short. This test is very valueable to acquire knowledge of this skill. Lets Start test.


Ques : 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:
Ans  :
 A::I A::f() { return 0; }
 A::I g(A::I p = A::x);
 A::I g(A::I p) { return 0; }

Ques : Consider the following class hierarchy:


class Base

{

}


class Derived : public Base

{

}


Which of the following are true?
Ans  :  Derived can access public and protected member functions of Base + The following line of code is valid: Base *object = new Derived();

Ques : What linkage specifier do you use in order to cause your C++ functions to have C linkage
Ans  :  extern "C"

Ques : 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?
Ans  : monthTable winter,spring={"March","April","May"};

Ques :  What access specifier allows only the class or a derived class to access a data membe
Ans  : protected

Ques : What is the output of the following code segment?

int n = 9;

int *p;

p=&n;

n++;

cout << *p+2 << "," << n;
Ans  : 12,10

Ques : What does ADT stand for?
Ans  : Abstract data type

Ques :  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?
Ans  : A compile time error will be generated because you cannot declare Shape objects

Ques : 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?
Ans  : To ensure that the destructors are called in proper orde

Ques : If input and output operations have to be performed on a file, an object of the _______ class should be created.
Ans  :  fstream

Ques : 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)

      {

      }

};
Ans  : Yes, it is valid

Ques : Consider the sample code given below and answer the question that follows.


template Run(T process);


Which one of the following is an example of the sample code given above?
Ans  : A template function declaration

Ques : Which of the following sets of functions do not qualify as overloaded functions?
Ans  : void x(int,char) int *x(int,char)

Ques : 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?
Ans  :  4

Ques : Which of the following statements about function overloading, is true?
Ans  :  Function overloading is possible in both C and C++

Ques : 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?
Ans  :  Protected

Ques : 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?
Ans  :  Person(const Person &p);

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

Ques : Which of the following are NOT valid C++ casts
Ans  :  void_cast

Ques : 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?
Ans  : font size=2>foo = new char*[200];

Ques : 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?
Ans  : The syntax is correct

Ques : Which of the following are true about class member functions and constructors?
Ans  : A member function can return values but a constructor cannot

Ques : Consider the following code:


#include


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?
Ans  : 11

Ques : Which of the following statements regarding functions are false?
Ans  :  You can create arrays of functions

Ques : Consider the following code:


#include

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?
Ans  : Constructor of A Constructor of B Destructor of B Destructor of A

Ques : Consider the following code:
template 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?
Ans  : Code will execute properly

Ques : 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
Ans  : Only 1 and 2 are true

Ques : 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();

}
Ans  :  Base Derived

Ques :  Consider the following code:


#include

using namespace std;


int main()
{

cout << "The value of __LINE__  is " <<__line__ span="">


return 0;

}


What will be the result when the above code is compiled and executed?
Ans  : The code will compile and run without errors

Ques : Which of the following STL classes is deprecated (i.e. should no longer be used)?
Ans  :  ostrstream

Thanks for watching this test Question & Answers. Please don't forget to leave a comment about this post. You can also find some more effective test question & answers, information, techtunes, technology news, tutorials, online earning information, recent news, results, job news, job exam results, admission details & another related services on the following sites below. Happy Working!
News For Todays ARSBD oEtab ARSBD-JOBS DesignerTab

UpWork (oDesk) & Elance Cocoa programming for Mac OS X 10.5 Test Question & Answers

/ No Comments
UpWork (oDesk) & Elance Cocoa programming for Mac OS X 10.5 Test Question & Answers are really very important to pass UpWork & Elance test. You will get top score at this skill test exam. If you found any problem or wrong answer please inform me via contact or comments. We will try to solve it in short. This test is very valueable to acquire knowledge of this skill. Lets Start test.


Ques : What is true regarding notifications?
Ans  : They can be dispatched to only one object + The object posting the notification does not even have to know whether the observer exists

Ques : What class should be used to load resources?
Ans  : NSBundle

Ques : What is a notification?
Ans  : A special message type used within the kernel

Ques :  What will be the output of the following code?

NSRect rect = NSMakeRect(0, 0, 10, 10);
NSRect *rect2 = malloc(sizeof(*rect2));
if(!rect2) {
    NSLog(@"Not enough memory.");
    exit(EXIT_FAILURE);
}

*rect2 = rect;

printf("%d\n", rect.size.width);
Ans  :  None of the above

Ques : Is the following code correct?

NSMutableArray *a = [NSMutableArray array];

// do something with a

[a release];
Ans  :  No

Ques : Is the following code valid?

NSSize s = NSMakeSize(10, 10);

int values[20];

values[s.height] = 5;
Ans  : Compile error

Ques : Which of the following platforms supports Cocoa?
Ans  : Mac OSX

Ques : Is there a double click event?
Ans  : Yes

Ques : Is the following code correct?

NSRect a = NSMakeRect(0, 1, 2, 3) + NSMakeRect(0, 1, 2, 3);
Ans  : No

Ques : Is the following code valid?

NSRect r;
 
r.size = NSMakeSize(10, 10);
r.origin = NSMakePoint(-5, -5);
Ans  : Yes

Ques : Is the following code correct?

NSMutableArray *a = [[NSMutableArray new] autorelease];

// do something with a

[a release];
Ans  : No

Ques : Which of the following retrieves the application main bundle?
Ans  : [NSBundle mainBundle]

Ques : Can you use NSLock on a POSIX mutex?
Ans  : Yes

Ques :  If you spawn a thread with POSIX thread api, will Cocoa be notified?
Ans  :  No

Ques : What method should be called before you are able to draw in the drawRect: method of a view?
Ans  :  None

Ques : Which of the following creates an autoreleased array?
Ans  : [NSMutableArray new];

Ques :  Can an object marked for autorelease be retained?
Ans  :  Yes

Ques : Fill the blank.
NSView : <> : NSObject
Ans  : NSResponder

Ques : If you call interpretKeyEvents:, which of the following method is likely to be called?
Ans  : insertText:

Ques : Where is the (0,0) coordinate located on the screen?
Ans  : bottom-left

Ques : What method should be called before you are able to draw outside the drawRect: method of a view?
Ans  : lockFocus

Ques : Can NSBundle be used to load Java code?
Ans  : No

Ques : Under Mac OS X 10.5, CGRect, CGSize and CGPoint have the same structure as NSRect, NSSize and NSPoint respectively. Is it true?
Ans  : Yes

Ques : What is an observer?
Ans  : An object registered with the notification center

Ques : Does Cocoa support 64bits?
Ans  : Yes

Ques : Fill the blank.

NSMutableArray : <> : NSObject
Ans  : NSArray

Ques : What is NSRect?
Ans  : A structure

Ques : Fill the blank.
NSCountedSet : <>  : NSObject
Ans  : NSMutableSet : NSSet

Ques : Can NSDistributedNotificationCenter be used to communicate between multiple machines?
Ans  : No

Ques : Is the following code correct?

NSMutableArray *a = [NSMutableArray new];

// do something with a

[a release];
Ans  : Yes

Ques : What threading API should be used in Cocoa?
Ans  : NSThread

Ques : How can you move a view?
Ans  : By changing the frame with setFrame:

Ques : Fill the blank.
NSButton : <> : NSObject
Ans  :  NSControl : NSView : NSResponder

Ques :  How is a GUI usually created in Cocoa?
Ans  : With interface builder

Ques : Is it possible to create events and dispatch them to the application?
Ans  : No

Ques : Can POSIX thread be used in Cocoa?
Ans  : Yes

Ques : Is it correct to have sibling views overlapping?
Ans  : No

Ques : In a typical Cocoa application, do you have to manage your runloop yourself?
Ans  : No

Ques :  Is NSString mutable?
Ans  : No

Ques : Can you use malloc/free in a Cocoa application?
Ans  : Yes, but only in a separate C library

Ques : What is NSViewHeightSizable constant used for?
Ans  : Autoresizing

Ques : Can poll() be used to fetch Cocoa events?
Ans  : Yes

Ques : What is a toll-free bridged class?
Ans  :  A class that can be interchanged with another class by casting

Ques : What is Cocoa?
Ans  : A framework

Ques : Is NSRunLoop thread safe?
Ans  :No

Ques : In which language is Cocoa written?
Ans  : Objective-C

Ques : Where should application resources be usually put?
Ans  : Within the application's bundle

Ques : Can an object be the delegate of multiple objects?
Ans  : No

Ques : Can an object be the delegate of multiple objects?
Ans  :  No

Ques : Is it mandatory to create an NSAutoreleasePool in a Cocoa application?
Ans  : No

Ques : What is the normal way of handling Cocoa events?
Ans  :  By implementing NSResponder methods in subclasses

Ques : Which of the following classes manages the computer's global notifications?
Ans  : NSDistributedNotificationCenter

Ques :  Can a notified object find out from where the notification is coming? (Sending object)
Ans  : Yes

Ques : How wide is unichar on a 32bit machine?
Ans  : 8bit

Ques : Fill the blank.

NSNotification : <> : NSObject
Ans  : Nothing is required to fill the blank

Ques : What kind of memory management mechanisms can Cocoa uses?
Ans  : Reference counting

Ques :  Can you detach threads in Cocoa?
Ans  : Yes

Ques : Which of the following is a valid Uniform Type Identifier?
Ans  : public.jpeg

Thanks for watching this test Question & Answers. Please don't forget to leave a comment about this post. You can also find some more effective test question & answers, information, techtunes, technology news, tutorials, online earning information, recent news, results, job news, job exam results, admission details & another related services on the following sites below. Happy Working!
News For Todays ARSBD oEtab ARSBD-JOBS DesignerTab