Computer Knowledge

Programming Fundamentals

2,381 Questions

Programming fundamentals form the core logic of software development and computer science. This includes variable declarations, pointer assignments, loop iterations, and exception handling. These technical topics are regularly tested in computer knowledge and IT officer competitive examinations.

Variables and arraysPointer assignmentsLoop iterationsException handling blocksCompile time errorsFunction references

Programming Fundamentals Questions

Multiple choice .net
  1. Array name

  2. Index value of the element

  3. Element value

  4. Both a and b.

  5. All of the above.

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

To reference an element in an array, you need to know the array name and the index value of the element.

Option A: Array name. This option is partially correct. The array name is required to identify the specific array you want to access.

Option B: Index value of the element. This option is correct. The index value is used to specify the position of the element within the array. It represents the location of the element in the array.

Option C: Element value. This option is incorrect. The element value is the actual value stored in the array at a specific index, but it is not required to reference an element in an array.

Option D: Both A and B. This option is correct. To reference an element in an array, you need both the array name and the index value of the element.

Option E: All of the above. This option is incorrect. Option C (Element value) is not required to reference an element in an array.

Therefore, the answer is D. Both A and B.

Multiple choice .net
  1. associate.

  2. constituent.

  3. element.

  4. member.

  5. part.

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

To answer this question, the user needs to know about structures in programming. A structure is a user-defined data type that groups related data of different data types. Structures in programming consist of variables or data members.

Each option will now be explained:

A. associate: This option is incorrect. An "associate" usually refers to a person or entity that is connected with another in some way. It does not accurately describe a variable inside a structure.

B. constituent: This option is incorrect. A "constituent" refers to a part or component of something that is considered as a whole. It is not the correct term for a variable inside a structure.

C. element: This option is incorrect. An "element" is a basic, indivisible unit of a larger system. It is not the correct term for a variable inside a structure.

D. member: This option is correct. A "member" is the correct term for a variable inside a structure. It is a data member or field that is part of the structure.

E. part: This option is incorrect. "Part" is a general term that refers to any piece or component of a whole. It is not the correct term for a variable inside a structure.

Therefore, the correct answer is:

The Answer is: D. member.

Multiple choice .net
  1. TextBoxes

  2. Labels

  3. Structures

  4. Controls

  5. An array can hold all of the above.

Reveal answer Fill a bubble to check yourself
E Correct answer
Explanation

To answer this question, we need to understand the concept of arrays and datatypes in programming.

An array is a data structure that can hold a fixed number of elements of the same datatype. Each element in the array is accessed by its index.

Now let's go through each option and determine if an array can hold that datatype:

A. TextBoxes: This option refers to a graphical user interface element used for user input. In programming, TextBoxes are usually represented by objects or classes. Therefore, an array can hold TextBox objects.

B. Labels: Similar to TextBoxes, Labels are another graphical user interface element used for displaying text. Labels are also represented by objects or classes, so an array can hold Label objects.

C. Structures: A structure is a user-defined data type that can hold different types of data under a single name. An array can hold structures, as long as all the elements in the array have the same structure type.

D. Controls: Controls refer to various graphical user interface elements, such as TextBoxes, Labels, Buttons, etc. Since we have already established that arrays can hold TextBoxes and Labels (which are types of controls), an array can hold Controls.

E. An array can hold all of the above: This option is correct. Arrays can hold TextBoxes, Labels, Structures, Controls, and any other data type as long as all the elements in the array have the same datatype.

Therefore, the correct answer is E. An array can hold all of the above.

Multiple choice .net
  1. Application.VariableName = Value

  2. Application.VariableName = (Value)

  3. Application(VariableName) = Value

  4. Application(VariableName) = (Value)

  5. Application("VariableName") = Value

Reveal answer Fill a bubble to check yourself
E Correct answer
Explanation

Application variables in ASP.NET are accessed using the Application collection with string keys in parentheses. The syntax Application("VariableName") = Value is correct. The variable name must be a string, not an identifier.

Multiple choice .net
  1. an event.

  2. a function.

  3. a variable.

  4. Both a and b.

  5. All of the above.

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

A Get procedure returns a value when a property is accessed, which is the defining behavior of a function. Events are triggered by actions, variables store data, and a property's Get specifically returns a computed or stored value.

Multiple choice java
  1. True

  2. False

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

In languages like C# and Java, primitive types (value types) such as int, char, and bool are typically allocated on the stack for performance. Objects (reference types) are allocated on the heap, while their references are stored on the stack.

Multiple choice java
  1. True

  2. False

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

To evaluate this statement, we need to understand the behavior of the default statement in a switch statement.

The default statement in a switch statement is optional and serves as a catch-all case. It is executed if none of the other cases match the value being switched.

Now let's go through each option:

A. True: This option is incorrect. The default statement is only executed if none of the other cases match the value being switched. If any of the other cases match, the default statement is skipped.

B. False: This option is correct. The default statement is not always executed. It is only executed if none of the other cases match the value being switched.

Therefore, the correct answer is B. False.

Let me know if you have any further questions!

Multiple choice asp
  1. Break it up into smaller easier-to-manage files that can serve as subroutines and function calls.

  2. Keep it nice and simple in one file and use subroutines and function calls.

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Breaking code into smaller, modular files improves maintainability, reusability, and debugging. You can create libraries of frequently used functions and subroutines, then include them only where needed. Keeping everything in one file (option B) creates maintenance nightmares as the application grows and makes code reuse difficult.

Multiple choice asp
  1. <% Language=VBScript %>

  2. <% ASPLanguage = VBScript %>

  3. <%@ Language=VBScript %>

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

ASP language directives use the @ symbol: <%@ Language=VBScript %>. This is a special directive syntax that must be placed at the very beginning of an ASP file to specify which scripting language to use. The @ symbol distinguishes it from regular ASP code delimiters. While VBScript is the default, explicitly declaring it is good practice, especially when using JavaScript instead.

Multiple choice .net asp
  1. <% '#include virtual="banner.asp" %>

  2. <!-- #include virtual="banner.asp" -->

  3. <-- #include virtual="banner.asp" -->

  4. <-- #include virtual="banner.asp" -->

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The correct format for an include statement in ASP/SSI uses HTML comment syntax with the #include directive. Option B shows the proper format: . The virtual attribute specifies a virtual path relative to the web root. Option A uses incorrect ASP-style delimiters, while options C and D are missing the exclamation mark after the opening bracket.

Multiple choice .net asp
  1. At the beginning to keep the code neat and tidy.

  2. Anywhere in the code where it is actually needed.

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Include files containing functions, subroutines, and configuration code should be placed at the beginning of your page. This makes the code more maintainable and ensures these definitions are available before any code that might need them. Placing configuration includes at the top is a best practice in ASP development for code organization and readability.

Multiple choice .net c-sharp
  1. Static

  2. Private

  3. Local

  4. Serial

  5. b and d

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

To solve this question, the user needs to know the different types of variables that can be declared in Java and their scope.

Now, let's go through each option and explain why it is right or wrong:

A. Static: This option is incorrect because a static variable is a variable that is declared with the static keyword and belongs to the class, not to any instance of the class.

B. Private: This option is incorrect because a private variable is a variable that is declared with the private keyword and is only accessible within the class it is declared in.

C. Local: This option is correct. A local variable is a variable that is declared inside a method or block of code and has a scope that is limited to that method or block of code. The variable can only be accessed within the method or block of code it was declared in, and once the method or block of code is exited, the variable is destroyed.

D. Serial: This option is incorrect because there is no such thing as a "serial" variable in Java.

E. b and d: This option is incorrect because option d is invalid, and option b is incorrect because it describes a different type of variable than the one being asked for.

Therefore, the answer is: C. Local

Multiple choice .net c-sharp
  1. The result of a users action

  2. result of a party

  3. code to force users action

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

To determine the correct answer, let's go through each option and explain why it is right or wrong:

A. The result of a user's action: This option is correct. An event is typically defined as the result of a user's action. In computer programming, an event can be triggered by user input, such as clicking a button or typing on a keyboard. The system responds to these actions by executing certain code or performing specific actions.

B. The result of a party: This option is incorrect. An event is not related to a party. In the context of computer programming, an event refers to user actions and their corresponding effects.

C. Code to force a user's action: This option is incorrect. An event is not code designed to force a user's action. Instead, events are typically triggered by user actions and are followed by specific reactions or responses from the system.

Therefore, the correct answer is A. The result of a user's action.

Multiple choice .net c-sharp
  1. reserved words

  2. method calls

  3. operator overloading

  4. operator overloading and method calls

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

String concatenation in C# supports both operator overloading (the + operator) and method calls (String.Concat, String.Join, StringBuilder.Append, etc.). You can write s1 + s2 or String.Concat(s1, s2) - both approaches are valid.