UPWORK TEST » October 21, 2015

Daily Archives: October 21, 2015

Upwork General Programming

Visual Basic 6 Test 2016

Published by:

1. An ADO dynamic property is:

Answers:

  1. A property that changes value at runtime
  2. A value defined by the user
  3. A value defined by the operating system
  4. A property that dynamically resizes as needed to accommodate database parameters
  5. A property implemented by the OLE DB service provider

2. In order to provide a transparent background to the Form, you must change the _________ property to _______.

Answers:

  1. BackStyle, Opaque
  2. BackColor, White
  3. BackStyle, Transparent
  4. BackColor, Parent Window’s Color
  5. ZOrder, 0
  6. BackColor, Transparent

3. Which of the following cannot be included in the Open method of the recordset?

Answers:

  1. Cursor Type
  2. User Name
  3. Active Connection
  4. CursorLocation
  5. LockType
  6. Source

4. What does the controls collection contain?

Answers:

  1. A list of all controls on a form
  2. A list of all the controls used by your program
  3. A list of all text boxes on a form
  4. A list of all visible controls
  5. The names of all control arrays on the form

5. 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?

Answers:

  1. Number
  2. Description
  3. CompName
  4. Component
  5. Source
  6. Text
  7. Desc
  8. None of the above

6. Global Procedures and Global Variables are declared in:

Answers:

  1. Form Modules
  2. Standard (Code) Modules
  3. Class Modules
  4. Resource files
  5. ActiveX Controls
  6. Data Environment

7. 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

Answers:

  1. None
  2. 1
  3. 2
  4. 3
  5. 4
  6. 5
  7. 6
  8. 7

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

Answers:

  1. Showtips
  2. Negotiate
  3. Align
  4. BorderStyle = 0
  5. Visible
  6. Locked
  7. Enabled
  8. Tag

9. Whenever the current record is about to change, Visual Basic generates the ______ event:

Answers:

  1. Validate
  2. UpdateRecords
  3. UpdateControls
  4. BeginTrans
  5. BeginMove
  6. Update

10. Which of the following will provide the best aggregate performance for a query that is not executed repeatedly?

Answers:

  1. Direct execution
  2. Stored procedures
  3. Prepared statements
  4. Data Environment
  5. ADO Data Control

11. The _______ property enables Visual Basic to draw complete images in memory before displaying them on the Screen.

Answers:

  1. AutoRedraw = True
  2. AutoRedraw = False
  3. Refresh
  4. PaintPicture

12. Which event of an ActiveX control data provider runs every time a bound control extracts data through the provider?

Answers:

  1. GetDataMember
  2. GetDataField
  3. GetDataProperty
  4. GetDataRow
  5. GetData
  6. GetFields
  7. GetRows
  8. RetrieveData

13. Which event should you use to store property values into the PropertyBag?

Answers:

  1. Terminate
  2. ReadProperties
  3. StoreProperties
  4. WriteProperties
  5. SaveProperties
  6. CommitProperties

14. One can convert a Visual Basic Application into ActiveX Document using:

Answers:

  1. Visual Database Manager
  2. Application Wizard
  3. ActiveX Document Migration Wizard
  4. Package and Deployment Wizard

15. Which event should be used to resize an ActiveX control as the user modifies the size of the control implementation on a form?

Answers:

  1. Resize
  2. Paint
  3. Repaint
  4. Initialize
  5. Change
  6. ReDimension
  7. Dimension
  8. Any of the above

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

Answers:

  1. Shell
  2. Substr
  3. SetAttr
  4. CStr
  5. Exec
  6. Perform
  7. Do
  8. None of the above

17. 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

Answers:

  1. Both (i) and (ii) are correct
  2. Only (i) is correct
  3. Only (ii) is correct
  4. (i) contains a logical error
  5. (ii) contains an error
  6. Both (i) and (ii) contain errors

18. Which function or method will you use to get a count of the maximum index limit of an array?

Answers:

  1. UBound function
  2. LBound function
  3. Substr function
  4. Bound Control method
  5. Limit method
  6. UpperLimit method
  7. Upper method
  8. MaxArray function

19. Which property of the ProgressBar determines how much of the bar is filled?

Answers:

  1. Min
  2. Max
  3. Value
  4. CurrentVal
  5. FillValue
  6. Fill
  7. BarComplete

20. In order to change the mouse pointer shape from glass to watch-glass, the property to be used is:

Answers:

  1. MousePointer
  2. Picture
  3. Menu
  4. PointerStyle
  5. Pointer
  6. Cursor
  7. CursorStyle
  8. CursorShape

21. The caption and the name properties of the command button:

Answers:

  1. Are one and the same
  2. Can be different at times
  3. Are actually not properties

22. In order to access a file in Non-textual format, you have to open file in:

Answers:

  1. Ascii Format
  2. Binary Format
  3. Input Mode
  4. Output mode
  5. Append mode
  6. Read Mode

23. What is the extension of the Visual Basic project file that stores the design of a user control.

Answers:

  1. .ctx
  2. .ctl
  3. .ctr
  4. .ocx
  5. .vbp
  6. .dll
  7. .ucl
  8. .utl

24. After a Dynaset type recordset has been created and opened, further searching is possible using the:

Answers:

  1. LookUp method
  2. Seek method
  3. Locate method
  4. FindNext method
  5. Search method

25. Which method of the Recordset object should you use to navigate multiple recordsets returned by a stored procedure?

Answers:

  1. NewRecordset
  2. NavigateRecordset
  3. OpenNextRecordset
  4. NextRecordset
  5. SkipRecordset
  6. PreviousRecordset
  7. JumpRecordset
  8. GoTORecordset

26. Which event procedure is called only if AutoRedraw property is set to false:

Answers:

  1. Form_GotFocus
  2. Form_Paint
  3. Form_Activate

27. Which events enable you to determine which key was pressed by the user?

Answers:

  1. Click and KeyPress
  2. Click, KeyUp and KeyDown
  3. KeyUp and KeyDown
  4. KeyPress, KeyUp and KeyDown
  5. Click, KeyPress, KeyUp and KeyDown

28. The Kill command in Visual Basic is used for:

Answers:

  1. Stopping the current process
  2. Deleting files
  3. Terminating the application
  4. Stopping the current thread
  5. Debugging the application
  6. Error handling
  7. None of the above

29. Which method would you use to get a free or unused File identifier while opening any file:

Answers:

  1. FreeFile
  2. GetFileNum
  3. GetFile
  4. GetBytes
  5. NextFile
  6. File
  7. GetNextFile
  8. None of the above

30. What data type is the HelpContextID?

Answers:

  1. String
  2. Integer
  3. Single
  4. Double
  5. Long
  6. Char
  7. Float

31. Which event is fired when a text box loses focus?

Answers:

  1. LostFocus
  2. FocusLost
  3. RemoveFocus
  4. FocusAway
  5. NoFocus
  6. Leavefocus

32. Message Boxes can hold a maximum of _______ characters.

Answers:

  1. 256
  2. 512
  3. 1024
  4. 2046
  5. 4092
  6. 5000
  7. 10000
  8. No limit

33. Which of the following is the only valid Resume statement in an error handler?

Answers:

  1. Resume prior
  2. Resume previous
  3. Resume later
  4. Resume next
  5. Resume before
  6. Resume to
  7. Resume statement
  8. Resume application

34. To store pictures in an array, Visual Basic provides the _____ control.

Answers:

  1. PictureClip<
  2. ImageList
  3. PictureBox
  4. Image Box
  5. Timer Control
  6. ListView
  7. Common Dialog
  8. DataGrid

35. Which is the only event of the timer control?

Answers:

  1. Timer
  2. TimeElapsed
  3. TimeOver
  4. Reset
  5. TimeOut
  6. Restart
  7. Freeze
  8. Stop

36. 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$)

Answers:

  1. The Caption of Form1 will change to the value contained in Y$
  2. The Caption of Form1 will not change
  3. The Caption changes at random intervals after the function call
  4. The code is incorrect

37. 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.

Answers:

  1. Caption
  2. ClipControls
  3. UseMnemonic
  4. LinkMode
  5. Locked
  6. Label
  7. ZOrder
  8. Visible

38. What is the sequence of events when a form is unloaded?

Answers:

  1. QueryUnload, Unload and Terminate
  2. QueryUnload, Terminate and Unload
  3. QueryUnload and Unload
  4. Unload only
  5. Terminate, QueryUnload and Unload
  6. Terminate, Unload and QueryUnload
  7. Unload, QueryUnload and Terminate
  8. Unload, Terminate and QueryUnload

39. What is the default value for the scalemode property of the form?

Answers:

  1. Twip
  2. Point
  3. Pixel
  4. Character
  5. Centimeter
  6. Inches
  7. Millimeters

40. Which property of the Err object returns the numeric value associated with the most recent runtime error?

Answers:

  1. Description
  2. No
  3. Number
  4. Source
  5. Errorcode
  6. Num
  7. Code

41. The event Lost_Focus of one object results in _____ of the other object:

Answers:

  1. Got_Focus
  2. Lost_Focus
  3. Mouse_click
  4. Refresh
  5. Validate
  6. Load
  7. Activate
  8. Initialize

42. Which of the following ADO recordset types provides the greatest degree of concurrency?

Answers:

  1. Static
  2. Forward-only
  3. Dynamic
  4. Keyset
  5. Read only
  6. Keyset and Dynamic

43. The ______ property is used to show Tool Tips or Help Balloons when the mouse rests on the object:

Answers:

  1. ToolTipText
  2. Tag
  3. Dragmode
  4. ShowTips
  5. Help
  6. Tip
  7. ShowHelp
  8. Tab

44. Which of the following can be shown to the user using the Common Dialog control in VB?

Answers:

  1. Common messages passed to Windows
  2. Open dialog box
  3. Windows explorer
  4. Input box
  5. Message box
  6. Error messages
  7. Help
  8. None of the above

45. Which property of the form changes the form’s title?

Answers:

  1. Name
  2. Heading
  3. Caption
  4. Text
  5. Title

46. 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:

Answers:

  1. DataSource
  2. Connection
  3. RecordSource
  4. TableType
  5. RecordType
  6. DataType

47. In Visual Basic, which method can you use to send key strokes to other Window applications?

Answers:

  1. AppActivate
  2. SendKeys
  3. Copying the contents from the ClipBoard & pasting
  4. Manually typing in the other application’s Window

48. The _______ property changes the tab order at runtime:

Answers:

  1. Tab stop
  2. Tab key
  3. Tab order
  4. Tab index

49. Which of the following tools can be used to change the value of a variable or property during break mode of an application?

Answers:

  1. Watch window
  2. Immediate window
  3. Callstack
  4. Locals window
  5. Debug object

50. 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?

Answers:

  1. Cancel
  2. Escape
  3. Exit
  4. Focus
  5. Default
  6. Losefocus
  7. ExecEvent
  8. FireEvent

51. Which collection of an ActiveX control enumerates all of the properties that can be bound to a data source?

Answers:

  1. DataFields
  2. DataMembers
  3. DataBindings
  4. DataProperties
  5. DataBase
  6. DataColumns

52. Which of the following situations would not cause the Initialize event of an ActiveX control to occur?

Answers:

  1. When a control is placed on a form at design time
  2. When a form designer containing a control is closed
  3. When a form is run
  4. When a compiled application containing a control executes
  5. When an application terminates and re-enters design-time for the host application

53. You can create menus by the ________ and _________.

Answers:

  1. Menu Editor, Application Wizard
  2. Menu Editor, Win32 API
  3. Win32 API, Application Wizard
  4. Class Builder, New Application Wizard

54. What is the sequence in which the following events are triggered when a form is loaded?

Answers:

  1. Initialize, Load, Resize and Paint
  2. Initialize, Load, Paint and Resize
  3. Load, Initialize, Resize and Paint
  4. Load, Initialize, Paint and Resize
  5. Initialize, Resize, Paint and Load
  6. Load, Paint,Initialize and Resize
  7. Initialize, Paint, Load and Resize
  8. Paint, Resize, Initialize and Load

55. Visual Basic displays information depending upon the current value of two properties of the form, called:

Answers:

  1. CurrentX and CurrentY
  2. ScaleLeft and ScaleTop
  3. ScaleHeight and ScaleTop
  4. x and y
  5. TopX and TopY
  6. LeftX and LeftY

56. Which of the following statements is capable of abandoning a series of modifications made to a recordset locked with a BatchOptimistic lock?

Answers:

  1. CancelUpdate
  2. CancelBatch
  3. CancelBatchUpdate
  4. AbandonBatch
  5. AbandonBatchUpdate
  6. Rollbackupdate
  7. Rollbackbatch
  8. None of the above

57. Which of the following is the valid stepping option?

Answers:

  1. Step Around
  2. Step Beyond
  3. Step Over
  4. Step Behind
  5. Step forward
  6. Step Into
  7. Step Out

58. Procedures declared in a _____ are local whereas procedures declared in a ______ are available to the whole application.

Answers:

  1. Form window, standard or code module
  2. Project window, view code window
  3. Class module, code module

59. Which property of the ListView control determines which field a sort is based on?

Answers:

  1. Sorted
  2. SortKey
  3. SortOrder
  4. SortField
  5. Sort
  6. Key
  7. ListKey
  8. None of the above

60. The method used to search for records from within a table type recordset object is:

Answers:

  1. LookUp
  2. Seek
  3. Locate
  4. FindNext
  5. Search

61. Which of the following methods is used to inform an ActiveX control’s container that one of its properties has been modified?

Answers:

  1. PropertyChanged
  2. CanPropertyChange
  3. ModifyProperty
  4. PropertyModify
  5. PropertyChange
  6. PropertyModified
  7. ChangeProperty

62. Which event is triggered when the user moves to another open form?

Answers:

  1. Unload
  2. QueryUnload
  3. Deactivate
  4. Terminate
  5. Load
  6. Initialize
  7. Repaint
  8. Resize

63. Which of the following is an event of the Shape control?

Answers:

  1. GotFocus
  2. LostFocus
  3. Validate
  4. KeyPress
  5. A shape control does not have events

64. What is the purpose of the Image List Control?

Answers:

  1. To display images to the user
  2. To help in creating a ToolBar
  3. To allow the editing of icons
  4. To provide a repository for images used by other controls
  5. To provide images to the listbox control
  6. To provide images for the splash screen
  7. To provide icons for error messages

65. Which line of code listed here can be used to create a string of fixed length:

Answers:

  1. Dim strFirstName as String
  2. strFirstName * 255
  3. strFirstName = 255
  4. Dim strFirstName as String(255)
  5. None of the above

66. Which of the following statements is incorrect regarding toolbars?

Answers:

  1. There can be only one toolbar on a form
  2. Toolbars can be positioned anywhere on the form
  3. Toolbars can be customized by the user
  4. Toolbar buttons can display images
  5. Toolbar buttons can display text
  6. Toolbars can have both images and buttons

67. Which of the following statements should you write to cause the component to fire an event?

Answers:

  1. RaiseEvent
  2. DeclareEvent
  3. FireEvent
  4. DoEvents
  5. ExecuteEvents
  6. Execute
  7. TriggerEvent

68. A __________ control defaults to displaying the files in the current directory:

Answers:

  1. File List Box
  2. Dir List Box
  3. Drive List Box
  4. Combo Box
  5. Picture Box
  6. List Box
  7. Combo Box
  8. DataGrid

69. The settings for the Color properties in Visual Basic are indicated by:

Answers:

  1. Decimal Coding
  2. Octal Coding
  3. Hexadecimal Coding
  4. Binary Coding

70. What does the forms collection contain?

Answers:

  1. A list of all forms in a project
  2. A list of all hidden forms
  3. A list of all currently loaded forms
  4. A list of all visible forms
  5. All the child forms of an MDI application.

71. Which of the following will perform a direct execution of a Command object?

Answers:

  1. The Execute method
  2. The Prepare method
  3. The ExecDirect method
  4. The Open method
  5. The Exec method
  6. The ExecProcedure method
  7. None of the above

72. The _______ function enables a VB application to make use of the idle time and to respond periodically to events.

Answers:

  1. GetTime()
  2. TrapEvents()
  3. GetDate()
  4. DoEvents
  5. Kill
  6. Idle
  7. Events
  8. Call

73. Which property procedure is used to retrieve the value of a property?

Answers:

  1. Retrieve
  2. Get
  3. GetProperty
  4. Value
  5. RetrieveValue

74. Which method will you use to remove a form from the Screen but retain it in memory?

Answers:

  1. Show method
  2. Unload method
  3. Hide method
  4. CLS method
  5. Deactivate method

75. The Load & Activate events are associated with:

Answers:

  1. All controls
  2. Form
  3. Command button
  4. Image box
  5. TreeView control
  6. ListView control
  7. DataGrid
  8. ComboBox

76. Which events allow you to determine if a Control or Shift key was pressed by the user?

Answers:

  1. Click and KeyPress
  2. Click, KeyUp and KeyDown
  3. KeyUp and KeyDown
  4. KeyPress, KeyUp and KeyDown
  5. Click, KeyPress, KeyUp and KeyDown
  6. KeyPress and KeyUp

77. What you must do before making calls to an ActiveX DLL project in the same Project Group?

Answers:

  1. Compile the DLL
  2. Check the DLL is off in your project’s Reference List
  3. Make sure the DLL is the Startup Project
  4. Ensure that a Standard Exe form is included and is made the Startup Form.

78. 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:

Answers:

  1. Background color property
  2. Caption property
  3. ZOrder property
  4. AutoRedraw property
  5. SendtoBack property
  6. BringtoFront property
  7. Hide property
  8. Show property

79. The ____ function returns the numeric value from a string expression:

Answers:

  1. Val
  2. CStr
  3. Round
  4. Int
  5. Num

80. Name the only property supported by a collection?

Answers:

  1. Name
  2. Index
  3. Count
  4. Type
  5. Value
  6. None of the above

81. What do CurrentX and CurrentY return?

Answers:

  1. Current X and Y co-ordinates of mousepointer
  2. Current X and Y co-ordinates of cursor
  3. A String of X & Y
  4. Current x and y co-ordinates of the control

82. Variables that allow sharing of values across event procedures are called:

Answers:

  1. Form level variable
  2. Object variable
  3. Module level variable

83. Which event of a text box would you use for validating the data entered by the user?

Answers:

  1. Validate
  2. Validation
  3. Check
  4. Audit
  5. GotFocus
  6. Checkdata
  7. ValidateDate

84. Which of the following approaches to data modifications is the least efficient?

Answers:

  1. Updating through a cursor using a recordset
  2. A stored procedure
  3. An update statement prepared and executed
  4. An update statement executed directly
  5. Updating through a data control

85. The interval property of the Timer control specifies the time in:

Answers:

  1. Milliseconds
  2. Seconds
  3. Minutes
  4. Hours
  5. Either milliseconds or seconds

86. Which event occurs only once in the entire life cycle of an ActiveX control?

Answers:

  1. Initialize
  2. Resize
  3. Terminate
  4. WriteProperties
  5. InitProperties
  6. Activate
  7. None of the above

87. How can you keep the user from exiting a form by clicking the Close button?

Answers:

  1. Place code in the Terminate event
  2. Place code in the Unload event
  3. Place code in the QueryUnload event
  4. This can only be done by using the Windows API
  5. Place code in the Load event
  6. Place code in the Deactivate event
  7. None of the above

88. Which of the following are not properties of Command Button:

Answers:

  1. Caption
  2. Visible
  3. Multi-Line
  4. Font
  5. Tag
  6. Bold
  7. Enabled

89. Which of the following debug tools would you use to locate your current position in a series of embedded procedure calls?

Answers:

  1. Locals window
  2. Immediate window
  3. Watch window
  4. Callstack
  5. Debug object

90. 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?

Answers:

  1. Err.Raise vbObjectError + 20000
  2. Err.Number = 20000
  3. Err.Raise 20000
  4. Err.Raise vbObjectError,20000
  5. Err.Number 20000
  6. Error.Raise vbObjectError + 20000
  7. Error.Number 20000
  8. Error.Raise 20000

91. A prepared statement is:

Answers:

  1. Query text cached on the client
  2. Query text cached on the server
  3. Compiled query cached on the client
  4. Compiled query cached on the server
  5. A stored procedure
  6. None of the above

92. Which parameter of the WriteProperty method can be omitted but should be included to increase the efficiency of the control?

Answers:

  1. Name
  2. Value
  3. Caption
  4. PropBag
  5. DefaultValue
  6. Title
  7. Tag
  8. None of the above

93. A project group is a Project which:

Answers:

  1. Consists of several Programs
  2. Consists of several Applications
  3. Consists of Various Forms And Code Modules
  4. Consists of several Projects

94. The _______ method loads the form named ‘Form1’ in to memory and also displays it.

Answers:

  1. Load Form1
  2. Form1.Show
  3. Form1.Visible = True
  4. Unload Form1
  5. Form1.activate

95. You want to display the code and the description of an error. What would be the correct syntax?

Answers:

  1. Msgbox err.no & err.text
  2. Msgbox err.number & err.text
  3. Msgbox error.number & error.text
  4. Msgbox error.number & error.description
  5. Msgbox err.number & err.description
  6. Msgbox err.num & err.description
  7. Msgbox err.num & err.text
  8. None of the above

96. If the CancelError Property of the CommonDialog Box is set to true then which of the following statement is true:

Answers:

  1. A runtime error can result if the user clicks the cancel button
  2. A compile time error occurs
  3. The program executes without any error
  4. You need to carry out conditional compilation
  5. None of the above

97. How do you create a read only property in a form?

Answers:

  1. Create only a Property Set procedure
  2. Create only a Property Get procedure
  3. Create only a Property Let procedure
  4. Create both a Property Get and Property Let procedure
  5. Declare a public variable in the Declarations section of the form
  6. Declare a private variable in the Declarations section of the form
  7. Create both a Property Get and Property Set procedure

98. What is the purpose of the Class Builder add-in in Visual Basic:

Answers:

  1. To add classes to the current project
  2. To change the current project to a class based project
  3. To create new classes and define their properties, methods & events
  4. To draw out how the application model will look

99. Which three methods does the collection object support?

Answers:

  1. Let, Get, Set
  2. Load, Unload, Count
  3. Add, Remove, Item
  4. Add, Delete, Index
  5. Add, Remove, Sort
  6. Add, Remove, Count
  7. Add, Delete, Count
  8. Add, Set, Count

100. Labels do not respond to _____ and ______ events.

Answers:

  1. Got_Focus , Lost_Focus
  2. Click , DblClick
  3. Dragdrop , OLECompleteDrag
  4. Change, Link Error

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

Answers:

  1. UpdateControls
  2. PaintPicture
  3. Refresh
  4. Resize
  5. Resync
  6. Restore
  7. Cancel
  8. Update

102. Which of the following is the only drag related event?

Answers:

  1. DragEnter
  2. DragLeave
  3. DragStart
  4. DragStop
  5. DragDrop
  6. BeginDrag
  7. EndDrag

103. 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?

Answers:

  1. 1-1000
  2. 0-255
  3. 1-65535
  4. 0-1000
  5. 513-65535
  6. 1000-2000
  7. 10000-20000
  8. None of the above

104. Which of the following procedure types will execute when you assign a value to a property of an object?

Answers:

  1. Property Get
  2. Property Assign
  3. Property Let
  4. Property Set
  5. Public Sub

105. Which parameter of the Execute method of the Connection object returns the number of records that the operation affected?

Answers:

  1. RecordsAffected
  2. RowsAffected
  3. RecordsUpdated
  4. RowsOperated
  5. RecordsOperated

106. Which of the following statements forces inline error handling?

Answers:

  1. On Error GoTo linelabel
  2. On Error GoTo Inline
  3. On Error Stop
  4. On Error Resume Next
  5. On Error GoTo 0
  6. On Error Resume
  7. None of the above

107. Which of the following compiled elements does not run in process?

Answers:

  1. ActiveX EXE
  2. ActiveX DLL
  3. ActiveX Control
  4. MTS Component
  5. Standard DLL
  6. Standard Exe

108. Which of the following locking types will lock a recordset only during an Update process and not immediately when the data modifications are requested?

Answers:

  1. Pessimistic
  2. Update
  3. Optimistic
  4. Batch optimistic
  5. Read only
  6. Delayed locking

109. Which form event would you use to activate a pop-up menu when the user clicks the right mouse button?

Answers:

  1. Click
  2. MouseMove
  3. DragOver
  4. DragDrop
  5. MouseUp
  6. Mouse-popup
  7. ShowMenu

982 total views, 3 views today

Upwork General Programming

System Programming Test 2016

Published by:

1. Which of the following system calls can be used to send a message via a connected socket?

Answers:

  1. send
  2. sendto
  3. sendmsg
  4. write

2. Which of the following methods can be used as a communication mechanism between two unrelated processes?

Answers:

  1. A pipe using the pipe system call.
  2. A named pipe using the mknod system call.
  3. Named sockets.
  4. Signals.

3. Which of the following are true of Unix system calls?

Answers:

  1. System calls are executed in “User” context.
  2. The routine “malloc” which is used for allocating memory is a system call.
  3. A new file can be created using the “open” system call.
  4. If two processes are executing the “write” system call simultaneously, they are serialized by the operating system.
  5. The “read” system call will never be blocked.

4. Which of the following Linux commands can be used to identify the processes consuming maximum resources (CPU, Memory)?

Answers:

  1. ps
  2. top
  3. lsof
  4. vmstat

5. Which of the following signals are used by the Unix shell to implement job control?

Answers:

  1. SIGHUP
  2. SIGSTOP
  3. SIGCONT
  4. SIGINT

6. Which of the following environment variables specifies the shared library search path?

Answers:

  1. SHARED_LIBRARIES
  2. SHLIB_PATH
  3. LD_LIBRARY_PATH
  4. LIBRARIES

7. Which of the following statements are true?

Answers:

  1. “wc -l” can be used to count the number of lines in the input.
  2. “find . -name ‘*.txt’ -exec rm {} ;” removes all “.txt” files in the current directory hierarchy.
  3. “cc -x ” can be used to generate the assembler listing of the C program file.
  4. “set -x” can be used within a ksh shell script to generate listing of shell commands while they are being executed.

8. Which of the following utilities would you use on a standard Linux system to debug a running application?

Answers:

  1. gdb.
  2. ltrace.
  3. strace.
  4. ptrace.

9. Which of the following can be used to inspect the system call arguments of a Linux process?

Answers:

  1. strace
  2. gdb
  3. adb
  4. mdb

10. Which of the following methods can be used to allocate and use memory on a Unix system?

Answers:

  1. brk
  2. sbrk
  3. malloc
  4. calloc

11. Which of the following utilities is used to generate a core file of a process on Linux?

Answers:

  1. gdb
  2. strace
  3. gcore
  4. objdump

12. Which of the following can be used to debug the process “123” and program “test” on a Linux system?

Answers:

  1. adb test 123
  2. gdb test 123
  3. strace 123
  4. strace -f -p 123

13. If a process has locked a System V Semaphore and receives a SIGKILL signal, which of the following is true?

Answers:

  1. The process can catch the signal and drop the semaphore before terminating.
  2. The process terminates without releasing the semaphore.
  3. The semaphore is released if the process had specified SEM_UNDO during creation.
  4. The signal is deferred until the semaphore is released.

14. Which of the following gdb commands can be used to obtain the stack

trace of all the threads of a multi threaded program running on Linux?

Answers:

  1. bt
  2. ::stack
  3. $C
  4. thread apply all bt

15. Which of the following shell commands is useful in single stepping through a shell script?

Answers:

  1. set -x
  2. echo
  3. trap
  4. DEBUG

16. Which of the following utilities is used to search out regular expressions in the input?

Answers:

  1. cat
  2. grep
  3. head
  4. tail

17. What does the command “mknod temp p” do?

Answers:

  1. It creates a named pipe.
  2. It creates directory nodes “temp” and “p”.
  3. It creates pipes “temp” and “p”

18. Threads created via pthread_create need to first set up shared memory
using shmop before they can share data.

Answers:

  1. True
  2. False

19. What does the “open” system call return to the caller?

Answers:

  1. 0 on success and -1 on error.
  2. File descriptor.
  3. An integer greater than or equal to 0 on success and -1 on error.
  4. Always 0.

20. What is the effect of a process executing an unlink system call while another process has opened the same file?

Answers:

  1. The unlink system call will fail.
  2. The unlink system call will succeed and the other process will be terminated.
  3. The unlink system call will be blocked until the other process has closed all references to the file.
  4. The unlink system call will succeed.

21. Which of the following signals cannot be ignored by a process?

Answers:

  1. SIGHUP
  2. SIGINT
  3. SIGTERM
  4. SIGKILL

22. Ignoring the setup cost for each of the System V IPC mechanisms, which of the following is the most efficient?

Answers:

  1. System V, Messages.
  2. System V, Shared Memory
  3. System V, Semaphores
  4. Sockets

23. What command is used to list the shared libraries used by an executable?

Answers:

  1. ldconfig
  2. ld
  3. ldd
  4. ls

24. What does the following command do to the process with pid 12345?
“kill -9 12345”.

Answers:

  1. It sends the INT signal causing the process to be interrupted.
  2. It sends the STOP signal causing the process to be stopped.
  3. It sends the KILL signal causing the process to be killed.
  4. It sends the HUP singal causing the process to hangup.

25. Which of the following system calls is the most memory efficient method of reading a file?

Answers:

  1. readv
  2. read
  3. mmap
  4. fcntl

26. Which of the following commands generates a listing of the system calls being executed by a program on Solaris?

Answers:

  1. ltrace
  2. tusc
  3. strace
  4. truss

27. What is the effect of issuing a “$c” command at the adb prompt during a debugging session on a Solaris 9 system?

Answers:

  1. It generates a listing of the stack trace.
  2. It causes the debugger to continue.
  3. It drops to the shell.
  4. It prints the register contents.

28. Which of the following sequences prints all the second column fields of an input file “values.txt”?

Answers:

  1. awk “print $2” values.txt
  2. awk ‘{print $2}’ values.txt
  3. awk ‘{print #2}’ values.txt
  4. cut -2 values.txt

29. Which of the following system calls increases the process priority?

Answers:

  1. priority
  2. nice
  3. ulimit
  4. fcntl

30. Which of the following is true of Unix system calls?

Answers:

  1. System calls cannot be executed by regular users.
  2. System calls are executed in the user context.
  3. System calls are executed in the kernel context.
  4. System calls cause a process switch.

31. If a process is hung in the kernel context, sending it a SIGKILL will _____.

Answers:

  1. kill the process immediately.
  2. be ignored by the Operating System.
  3. be delivered when the process switches back to the user context.

32. The library routine printf does not use any system calls.

Answers:

  1. True.
  2. False.

33. Which of the following gcc compiler options turns on optimization?

Answers:

  1. optimize
  2. O
  3. Opt
  4. -S

34. Which of the following options of the compiler is turned on to generate additional debug information (like the source code) for debugging an application?

Answers:

  1. O
  2. S
  3. E
  4. g

35. Which of the following options specifies a non standard library path during linking?

Answers:

  1. -l
  2. -L
  3. -o
  4. -g

36. Which of the following shell operators redirects the standard input of the command being executed?

Answers:

  1. <
  2. >
  3. %
  4. @

37. Which library routine is used to translate the numeric system call error code to a human readable text error message?

Answers:

  1. sprintf
  2. exit
  3. error
  4. perror

38. Which of the following IPC message operations is performed to setup communication between arbitrary processes?

Answers:

  1. msgctl
  2. msgsnd
  3. msgrcv
  4. msgget

39. What is the effect of executing the following system call on the file “test.txt”?
open(“test.txt”, O_TRUNC)

Answers:

  1. The file is truncated to the nearest block size before returning.
  2. The file is created before returning.
  3. The file is opened.
  4. If test.txt exists, the file is truncated to 0 bytes before returning.

40. How does a programmer distinguish a child from its parent process following a fork system call?

Answers:

  1. The system call returns 0 to the child and 1 to the parent.
  2. The system call returns 0 to the parent and the pid of the parent to the child.
  3. The system call returns 0 to the child and the pid of the child to the parent.
  4. There is no way to distinguish a child from its parent.

41. Which of the following libraries provides the POSIX thread implementation on Solaris?

Answers:

  1. libpthread
  2. libthread
  3. libnptl
  4. libc

42. Which of the following IPC shared memory sequences is correct?

Answers:

  1. shmctl, shmat, shmdt
  2. shmget, shmat, shmdt
  3. shmctl, shmget, shmat, shmdt
  4. shmat, shmdt

43. How is the value of the shell environment variable IFS changed to comma (‘,’)?

Answers:

  1. IFS=’,’; export IFS
  2. $IFS=’,’; export IFS
  3. IFS=’,’; export $IFS
  4. $IFS=’,’

44. Which of the compiler options generates an assembler output file?

Answers:

  1. -O
  2. -a
  3. -S
  4. -g

45. What does the ‘-pg’ option of the Unix compiler do?

Answers:

  1. It turns on the profiling of the executable code.
  2. It generates an assembler listing of the code.
  3. It turns on the generation of the optimized code.
  4. It prints the different function call graphs.

46. Shared libraries increase an application’s disk size?

Answers:

  1. True.
  2. False.

47. Which of the following redirects the standard error output of a command to the log file “error.log”?

Answers:

  1. “2>error.log”
  2. “2
  3. “>error.log”
  4. “|error.log”

48. What are the typical system calls the Unix shell invokes when it
has to execute a new command?

Answers:

  1. open, read, close.
  2. open, fork, exec.
  3. ioctl.

49. Which system call is used to send a signal to another process?

Answers:

  1. signal
  2. kill
  3. socket
  4. ioctl

50. Which of the following commands can be used to generate a listing of all the shared libraries that an executable needs?

Answers:

  1. ld
  2. ldd
  3. ls
  4. ln

51. What is the default file descriptor used for the error outputs of a process?

Answers:

  1. 0
  2. 1
  3. 2
  4. -1

52. Which of the following commands can be used on a Linux system to kill process 8977 and all its children?

Answers:

  1. kill -term 8977
  2. kill -kill 8977
  3. kill -stop 8977
  4. kill -int 8977

53. Which of the following commands can be used on a Linux system to configure a network interface (card)?

Answers:

  1. ifconfig
  2. ipconfig
  3. netstat -c
  4. route

54. Which of the following commands can be used to list all the active TCP connections only on a Linux system?

Answers:

  1. netstat -r
  2. netstat -t
  3. iptables -L
  4. route

55. Which of the following ksh trap sequences causes the function ‘handler’ to be executed when the script exits?

Answers:

  1. trap handler EXIT
  2. trap EXIT handler
  3. set handler EXIT
  4. trap handler exit

56. How many bytes of a file of size 1023 will be read by the following piece of code?

char buf[256];

<snip>
while (read(fd, buf, 256)) {
/* Take some action */
}
<snip>

Answers:

  1. 1024
  2. 1023
  3. 0
  4. 768

57. What is the effect of setting the “sticky” bit on an application’s executable image?

Answers:

  1. It causes the system to load the program faster the next time it runs.
  2. It causes the system to fail all unlink system call requests on the image.
  3. It causes the system to preload the application’s image into the system RAM.
  4. It causes the system to grant the application owner’s privileges to other users if they try to run the application.

58. A C program “domath.c” utilizes the math library. Which of
the following commands correctly creates the corresponding executable
“domath”?

Answers:

  1. cc -o domath domath.c
  2. cc -o domath domath.c -L /usr/lib -lmath
  3. cc -o domath domath.c -lm
  4. cc -o domath domath.c -Lmath

59. Which of the following sequences creates a socket based connection for communication?

Answers:

  1. open, listen, accept
  2. open, accept, listen
  3. socket, connect, accept, listen
  4. socket, connect, listen, accept

60. What does the open system call return upon success?

Answers:

  1. A non zero value, which is the file descriptor.
  2. Zero.
  3. A positive integer which is the file descriptor.
  4. The pointer to the FILE structure of the open file.

61. If a process executes the following C code on a Linux system, what is the outcome?

<snip>
char *cp = 0, c = *cp;
<snip>

Answers:

  1. The process executes the code without errors.
  2. The process is killed with a SIGSEGV.
  3. The process is killed with a SIGBUS.
  4. The process is killed with a SIGKILL.

62. On Linux, the pthread_create interface does not use the fork system call to create threads.

Answers:

  1. True.
  2. False.

63. Which of the following shell parameters contains the return value of the previously executed shell command?

Answers:

  1. $*
  2. $$
  3. $?
  4. $!

64. Which of the following calls is used to initiate a socket connection to a target address?

Answers:

  1. socket
  2. connect
  3. accept
  4. listen

65. Which of the following gcc options can be used to generate a position independent code on a Linux system?

Answers:

  1. -pic
  2. +z
  3. -b
  4. -mshared

66. Which of the following commands can be used to list all the active TCP connections on a Linux system?

Answers:

  1. netstat -r
  2. netstat -t
  3. iptables -L
  4. route

67. What is the network byte order in Unix?

Answers:

  1. Little Endian
  2. Big Endian
  3. It is negotiated during connection.
  4. It is undefined.

68. Which of the following segments within the process address space are unique to each thread?

Answers:

  1. code.
  2. data.
  3. stack.
  4. bss.

69. How do threads created using pthread library share data between themselves efficiently?

Answers:

  1. They use one of the standard interprocess communication methods.
  2. They use sockets.
  3. They don’t need any special mechanism as they share the data segment.
  4. They use shared memory.

70. By convention, which of the following signals causes a daemon to reload its configuration?

Answers:

  1. SIGHUP
  2. SIGKILL
  3. SIGINT
  4. SIGCONT

71. Which of the following block sizes results in the best read/write performance for an IO intensive application?

Answers:

  1. 8192
  2. 4096
  3. 2048
  4. 1024

72. What is the name of the standard linker on Unix?

Answers:

  1. cc
  2. ldd
  3. ld
  4. ls

73. Which of the following is employed by the operating system to speed up file IO on a Solaris system.

Answers:

  1. Inode Cache
  2. DNLC
  3. Buffer Cache
  4. Page Cache

74. How is the stack trace of all the threads in a multi threaded Linux application obtained?

Answers:

  1. strace -f -p <procid>
  2. “backtrace” at the gdb prompt.
  3. “thread apply all ::stack” at the gdb prompt.
  4. “thread apply all backtrace” at the gdb prompt.

75. Which of the following creates an IPC message channel?

Answers:

  1. id = msgget(key, 0700|IPC_CREAT);
  2. id = msgget(key, 0700, IPC_CREAT);
  3. id = msgctl(key, 0700|IPC_CREAT);
  4. id = msgctl(key, IPC_CREAT, 0700);

76. Which of the following system calls can be used to get the metadata of a file?

Answers:

  1. open
  2. stat
  3. fcntl
  4. ioctl

77. Which of the following commands can be used to create a static (archive) library?

Answers:

  1. tar
  2. ar
  3. ld
  4. gcc

78. Which of the following system calls is specific to debugging?

Answers:

  1. truss
  2. fcntl
  3. strace
  4. ptrace

79. Which of the following commands can be used to compile a C file called “test.c” into an executable called “test”?

Answers:

  1. cc -o test test.c
  2. cc -g -S test.c
  3. cc test test.c
  4. cc -E test.c

80. Which of the following IO mechanisms allows greater performance to concurrent IO-intensive applications?

Answers:

  1. Memory Mapped IO
  2. Read Ahead
  3. Direct IO (Filesystem locking is skipped)
  4. Async IO.

81. What is the outcome of attempting an ioctl system call on a block device file?

Answers:

  1. The system returns ENOTTY.
  2. The ioctl succeeds and returns 0.
  3. The system returns EIO.
  4. The system returns ENXIO.

82. Which of the following system calls can be used to create device special files?

Answers:

  1. open
  2. mkfs
  3. touch
  4. mknod

83. If a process is terminated due to a SEGFAULT on a Solaris 9 system, what is the name of the core file that is created?

Answers:

  1. core
  2. corefile
  3. memdump
  4. coredump

84. Which of the following socket system calls creates a Unix Domain Socket connection?

Answers:

  1. socket(PF_UNIX, SOCK_STREAM, protocol)
  2. socket(PF_INET, SOCK_DGRAM, protocol)
  3. socket(PF_IPX, SOCK_RAW, protocol)
  4. socket(PF_LOCAL, SOCK_STREAM, protocol)

85. Which of the following system calls creates a named socket?

Answers:

  1. creat
  2. mknod
  3. bind
  4. socket

86. Which of the following shell operators is used to send the standard output of the first command to the standard input of the second command?

Answers:

  1. &
  2. ^
  3. >
  4. |

87. Which of the following C headers needs to be included for socket programming?

Answers:

  1. <socket.h>
  2. <sys/socket.h>
  3. <stdio.h>
  4. <stdlib.h>

88. Where are the DNS and search domains specified?

Answers:

  1. /etc/fstab
  2. /etc/nsswitch.conf
  3. /etc/resolv.conf
  4. /etc/hosts-

89. A process opens a file and forgets to close the file descriptor when it
exits. What is the result?

Answers:

  1. It results in a resource leak.
  2. The OS calls exit on behalf of the process before it terminates the process resulting in all the resources being reclaimed.
  3. The OS garbage collector recovers the descriptor.

90. If a write system call fails and if errno is set to EFAULT, what does it signify?

Answers:

  1. The system encountered an IO error while doing the write.
  2. The file descriptor was illegal.
  3. The write buffer is not legal.
  4. The file was removed by another process while this write was being attempted.

91. Which of the following commands can be used to install the native software package SOFTpkg on a Solaris system?

Answers:

  1. tar -xvf SOFTpkg
  2. swinstall -s `pwd` SOFTpkg
  3. rpm -i SOFTpkg
  4. pkgadd -d . SOFTpkg

909 total views, 2 views today