Podcast
Questions and Answers
Which programming construct repeats a process multiple times until a specified condition is met?
Which programming construct repeats a process multiple times until a specified condition is met?
- If Then Statement
- Conditional Statement
- Loop Statement (correct)
- Switch Case Statement
Which loop type is best suited for executing blocks of statements as long as a condition remains true
?
Which loop type is best suited for executing blocks of statements as long as a condition remains true
?
- Do While Loop (correct)
- While End Loop
- For Next Loop
- If Then Loop
Which loop repeatedly executes code until a given condition is satisfied?
Which loop repeatedly executes code until a given condition is satisfied?
- For Next Loop
- While End Loop
- Do While Loop (correct)
- If Then Loop
In a For
loop, what determines the increment or decrement of a variable after each iteration?
In a For
loop, what determines the increment or decrement of a variable after each iteration?
What keyword signifies the end of a For
loop?
What keyword signifies the end of a For
loop?
In a For
loop, 'start' and 'end' parameters define the initial and final values of the:
In a For
loop, 'start' and 'end' parameters define the initial and final values of the:
Which loop type is designed specifically for iterating over elements in an array or collection?
Which loop type is designed specifically for iterating over elements in an array or collection?
What does a While
loop check initially?
What does a While
loop check initially?
In contrast to a While
loop, what does a Do
loop check after executing its statements?
In contrast to a While
loop, what does a Do
loop check after executing its statements?
In VB.NET, a Do Until
loop continues execution as long as the Until
condition is:
In VB.NET, a Do Until
loop continues execution as long as the Until
condition is:
Which of the following code snippets is NOT an example of a nested loop?
Which of the following code snippets is NOT an example of a nested loop?
Which statement about the While
loop is incorrect?
Which statement about the While
loop is incorrect?
Which of these VB.NET loops is NOT a pretest loop?
Which of these VB.NET loops is NOT a pretest loop?
What will be the output of the following VB.NET code segment?
x=10
While(x>5)
Console.WriteLine("{0}",x)
x-=1
End While
What will be the output of the following VB.NET code segment?
x=10
While(x>5)
Console.WriteLine("{0}",x)
x-=1
End While
What would be printed from the following VB.NET code segment?
Dim i As Single
For i = 20 To 1 Step -2
Console.Write(i & " ")
Next
What would be printed from the following VB.NET code segment?
Dim i As Single
For i = 20 To 1 Step -2
Console.Write(i & " ")
Next
What does 'Data Type' represent in programming?
What does 'Data Type' represent in programming?
In a For Each
loop, what is var_name
used for?
In a For Each
loop, what is var_name
used for?
In a For Each
loop, a variable checks whether what is available?
In a For Each
loop, a variable checks whether what is available?
In a For Each
loop, the block executes until the condition remains:
In a For Each
loop, the block executes until the condition remains:
In a For Each Loop
, when all elements are read, control passes to which function to terminate the program?
In a For Each Loop
, when all elements are read, control passes to which function to terminate the program?
A sequential collection of characters is commonly known as a:
A sequential collection of characters is commonly known as a:
Which keyword is used to declare a variable that stores text values?
Which keyword is used to declare a variable that stores text values?
Which string class contains various functions for string manipulation?
Which string class contains various functions for string manipulation?
In VB.NET, what is a string object considered to be?
In VB.NET, what is a string object considered to be?
Which property is used to access a single character from a string object?
Which property is used to access a single character from a string object?
Which string property returns the total number of characters in a string object?
Which string property returns the total number of characters in a string object?
Which function counts the number of characters in a string?
Which function counts the number of characters in a string?
Which function compares two strings and returns an integer value indicating their relative order?
Which function compares two strings and returns an integer value indicating their relative order?
Which string method checks if a specified text exists within a string?
Which string method checks if a specified text exists within a string?
Which string function joins two or more strings together?
Which string function joins two or more strings together?
Which function creates a new string object with the same content as an existing string?
Which function creates a new string object with the same content as an existing string?
Which method determines if a string ends with a specified suffix?
Which method determines if a string ends with a specified suffix?
Which function determines if two string objects have identical values?
Which function determines if two string objects have identical values?
Which function replaces one or more objects with a specified string object?
Which function replaces one or more objects with a specified string object?
Which function returns the index of the first occurrence of a character or string within another string?
Which function returns the index of the first occurrence of a character or string within another string?
Which function inserts a substring at a specified position within a string?
Which function inserts a substring at a specified position within a string?
Given a string, which method removes characters from a specified position to the end?
Given a string, which method removes characters from a specified position to the end?
Which function replaces all occurrences of a specified character or string within another string?
Which function replaces all occurrences of a specified character or string within another string?
Which function splits a string into an array of substrings based on specified delimiters?
Which function splits a string into an array of substrings based on specified delimiters?
Classes that are used for storing, retrieving, and managing data in memory are known as:
Classes that are used for storing, retrieving, and managing data in memory are known as:
Which of these is a Collection
class that stores a generic type of object?
Which of these is a Collection
class that stores a generic type of object?
In a List
, which property returns the number of elements?
In a List
, which property returns the number of elements?
Which List
property is used to access or modify an item at a specific index?
Which List
property is used to access or modify an item at a specific index?
Which method adds an entirety of a collection to the end of List
?
Which method adds an entirety of a collection to the end of List
?
Which method copies the elements of a list to a new array object?
Which method copies the elements of a list to a new array object?
Flashcards
Loop Statement
Loop Statement
Repeats a process multiple times until a specified condition is met.
While End Loop
While End Loop
Executes blocks of statements as long as the condition remains true.
For Next loop
For Next loop
Repeatedly executes code until a given condition is satisfied.
Step
Step
Signup and view all the flashcards
Next
Next
Signup and view all the flashcards
Variable name
Variable name
Signup and view all the flashcards
For Each loop
For Each loop
Signup and view all the flashcards
Condition
Condition
Signup and view all the flashcards
Condition
Condition
Signup and view all the flashcards
True
True
Signup and view all the flashcards
Data Type
Data Type
Signup and view all the flashcards
var_name
var_name
Signup and view all the flashcards
element
element
Signup and view all the flashcards
True
True
Signup and view all the flashcards
Next
Next
Signup and view all the flashcards
text
text
Signup and view all the flashcards
String
String
Signup and view all the flashcards
System.String
System.String
Signup and view all the flashcards
immutable
immutable
Signup and view all the flashcards
Chars
Chars
Signup and view all the flashcards
Length
Length
Signup and view all the flashcards
Length
Length
Signup and view all the flashcards
Compare()
Compare()
Signup and view all the flashcards
Contains()
Contains()
Signup and view all the flashcards
Concat()
Concat()
Signup and view all the flashcards
Copy()
Copy()
Signup and view all the flashcards
EndsWith()
EndsWith()
Signup and view all the flashcards
Equals()
Equals()
Signup and view all the flashcards
Replace()
Replace()
Signup and view all the flashcards
IndexOf()
IndexOf()
Signup and view all the flashcards
Insert()
Insert()
Signup and view all the flashcards
Remove()
Remove()
Signup and view all the flashcards
Replace()
Replace()
Signup and view all the flashcards
Split()
Split()
Signup and view all the flashcards
Collection
Collection
Signup and view all the flashcards
List
List
Signup and view all the flashcards
Count
Count
Signup and view all the flashcards
Item
Item
Signup and view all the flashcards
AddRange
AddRange
Signup and view all the flashcards
ToArray
ToArray
Signup and view all the flashcards
Study Notes
Loop Statements
- Loop statements repeat a process until a condition is met.
- The loop executes blocks of statements as long as the condition remains true.
- Several statements repeatedly execute a code sequence until a condition is satisfied.
Do While Loop
,For Next Loop
, andWhile End Loop
are types of loop statements.
For Loop Components
Step
determines the counter variable's increment or decrement after each iteration.Next
is a keyword that signifies the end ofFor
loops.start To end
parameters represent the initial/final value of the variable in the loop.
For Each Loop
For Each
iterates through a block of statements in an array or collection.- The
while
loop initially checks the defined condition. - The
Do
loop executes statements and then checks a condition. - In VB.NET, a
Do Until
loop executes as long as theUntil
condition isTrue
.
Nested Loops
- Not a nested loop -
for i=0 to 9 Console.Write("i={0}",i) Next for j=1 to i+3 Console.Write("j={0}",j)Next
While Loop Characteristics
- One untrue statement about the
while
loop is: "The while loop is a posttest loop."
VB.NET Loop Types
do while
loop is not a pretest loop.
VB.NET Code Segment Output
- This VB.NET code segment:
x=10 While(x>5) Console.WriteLine("{0}",x) x-=1 End While
would output 10 9 8 7 6.
Data Types
- Data Type represents the type of a variable.
For Each Loop Variables
var_name
is the variable name to access elements from the array or collection object.- A variable checks whether the element is available or not in
For Each
loops. - If an element exists in a collection object, the
For Each
block continues while the condition is true. - After all elements are read in a
For Each
loop, control passes toNext
to terminate the program.
String Definition
- A String is a sequential collection of characters called text.
String
creates a string variable to store text.
System.String Class
- The String class is named
System.String
.
String Object
- In VB.NET, the string object is immutable.
String Functions
Chars
gets a character from the current string object.Length
returns the number of characters in the current string object.Length
counts the number of characters in a string.Compare()
compares two strings; if one is less than the other, it returns an integer value.Contains()
validates if specified text exists in a string.Concat()
joins two or more strings.Copy()
creates a new string object with the same content as the original string.EndsWith()
checks if the string ends with specified text.Equals()
determines if two string objects have the same value.Format()
replaces objects with a specified string.Replace()
replaces one or more objects within the specified string object.IndexOf()
returns the index position of the first character or string occurrence, starting from zero.Insert()
inserts a specified string at a given position.Remove()
deletes characters from a specified position to the end of a string.Replace()
replaces all occurrences of a character or string and returns a new string.Split()
divides a string into substrings using delimiters- Collections are special purpose classes, useful for storing data, dynamically allocating memory, retrieving a list of items or elements on the basic index number, etc.
List Definition
List
stores generic types of collection objects.Count
counts the number of elements in the List.Item
gets or sets an item at a specified position in the List.AddRange
adds the elements of a collection to the end of the List.ToArray
copies all list elements to a new array object.
Functions
- A function consists of separate code groups performing specific tasks.
Access_Specifier
defines the access level (public, private, friend, protected) of a function.ParameterList
lists parameters for sending/retrieving data from a method.- Recursive function is when a function calls itself until a condition is satisfied.
Sub
is a separate code set for executing specific tasks that does not return values.- Add() method adds an object at the end of the List.
- Clear() clears all records from the List.
- Find() method searches for a specified element from a list that matches the defined state and returns the first occurrence.
- CopyTo() method copies all records of a list into a one-dimensional array.
- OrderBy() method used to sort the elements of the list.
- Opposite() method used to reverse the order list of elements
- Remove() method in a list, we can delete an element from the specified location in a list.
- Insert is used to insert all elements of a specified collection in a list start from a specified location.
- Contains is used to validate whether the specified object exists in the List or not.
Class Definition
- Class is a group of data members/objects with the same properties, processes, events, and relationships.
Access_Specifier
defines a class's access levels (Public, Private, Friend, etc.).Implements
specifies interfaces from which the class inherits.NotInheritable
means the class cannot be a base class.Shadows
re-declares variables and hides identical elements in a base class.- Constructor is a special method implemented when a class object is created.
- A constructor without arguments creates a default constructor.
- Inheritance creates a new class by inheriting characteristics from an existing class.
- Derived Classes - The old class is known as the base class, and the inherited class is known as the derived class.
- Classes - An interface in VB.NET allows multiple inheritances of classes.
- Multithreading is when two or more processes execute simultaneously.
- A thread executes each process; the execution of a process is known as the thread.
- Single Thread is used to execute a single logic or task in an application.
- Main thread - By default, each application has a main thread to execute each process.
- To create and access a new thread in the Thread class, import the System.Threading namespace.
- Child Thread - A new thread becomes the child thread for what it inherited from the main thread.
- ThreadStart() is the method executed by the new thread.
- Join() is a synchronization method that stops the calling thread until the execution thread completes.
- Interrupt() is used to stop the currently executing thread.
- Dead state is when a thread is complete or aborted.
User Interface Elements
- Object is a user interface element created on a form using a toolbox control.
- Properties describe the object.
- Methods cause an object to do something.
- Value is a new property setting.
- Event alerts an application that something has occurred.
- Forms contains all the controls for the user interface
- ListBox displays a list of items.
- RadioButton enables single selection from a group of choices.
- PictureBox displays an image.
- TreeView displays hierarchical, labeled items.
- ListView displays items in different views.
- DateTimePicker allows date and time selection and display.
- ColorDialog displays available colors for custom color definition
- FontDialog allows font selection, size, and color choice.
- OpenFileDialog allows the user to select a file to open.
- SaveFileDialog prompts the user to select a location for saving a file and specifies the file's name.
- Abort returns DialogResult.Abort value.
- Cancel returns DialogResult.Cancel.
- Default returns nothing and the dialog box continues running.
- Ignore returns DialogResult.Ignore.
VB.NET Form Applications
- Form creates a form-based or window-based application.
- Locked determines if the form is disabled.
- FormBorderStyle sets/gets border style in a form.
- MDI stands for Multiple Document Interface.
- TopMost determines whether to put the window form above all others (Boolean value).
- GotFocus is activated when the form control receives a focus.
- KeyDown is activated when a key is pressed while focussing on the form.
- KeyUp is activated when a key is released while focusing on the form.
- LostFocus is activated when the form loses focus.
- MouseEnter is activated when the mouse pointer put on the form.
- MouseLeave event is activated when the mouse pointer leaves the form surface.
- MouseEnter event is activated when the mouse pointer enters the form.
- Load event is used to load a form before it is first displayed.
- Resize event is activated when a form is resized.
- DragDrop event is activated when a drag and drop operation is performed.
- Exception is a wanted error that occurs during the execution of a program and can be a system exception or application exception.
- Catch block is used to monitor a particular exception that may throw an exception within the application.
- Try is a block of code that catches an exception with an exception handler at the place in a program where the problem arises.
- Throw handler is used to throw an exception after the occurrence of a problem.
- "Finally" is used to execute a set of statements in a program, whether an exception has occurred.
JavaScript Variables
- Variables declared in Javascript:
let variableName
,var variableName
,const variableName
- An uninitialized variable has a default value of undefined in JavaScript.
const
declares a constant variable in JavaScript.- Reassigning a value to a constant variable throws an error.
- An invalid variable name is
2ndVar
. let a, b, c;
declares multiple variables in a single statement- Variables can have block-level scope using
let
. - The output of the following code is
undefined
-
let x;
console.log(x);
- An object can store multiple values in Javascript.
- Variable that can be declared but not initialized:
let
. - Variables declared with
var
are function-scoped in JavaScript. - Variables declared with
let
andconst
are block-scoped. - JavaScript variable names can start with a number:
False
. - The keyword const allows variable reassignment:
False
. - Variables declared without a keyword become global variables:
True
. - Javascript is case-sensitive:
True
. - Using var for variable declaration is preferred in modern JavaScript:
False
. - Uninitialized variables have a default value of null in JavaScript:
False
. - Constants must be initialized at the time of declaration:
True
. - Re-declaring a variable using let in the same scope throws an error:
True
.
Javascript Operators
- The "+" operator concatenates strings when used with strings.
++
is NOT a comparison operator in JavaScript.- The result of the expression 5 + "5" in JavaScript is 55.
- The
&&
operator returns true only if both operands are true. - The typeof operator returns
"string"
when used on a string. - The
===
operator checks equality in value and type in JavaScript. - The result of the expression 5 % 2 javascript is 1.
- The
=
operator is used to assign values in JavaScript. !
is a logical NOT operator in JavaScript.- The result of ""10" == 10" in JavaScript? - Returns/evaluates to:
true
. - Javascript uses the + operator for both addition and string concatenation -
True
. - The == operator checks for both value and type equality -
False
. - The expression 5 === "5" evaluates to true -
False
. - The && operator returns true if both operands are true -
True
. - The result of "5" + 5 is 10 -
False
. - The != operator checks for strict inequality -
False
. - JavaScript's typeof operator returns a string representing the type of a value -
True
. - The ++ operator can be used to increment a variable by 1 -
True
. - The expression 10 % 3 evaluates to 3 -
False
. - The || operator returns true if at least one operand is true -
True
.
JavaScript Popup Boxes
alert()
displays a simple alert box with a message.prompt()
asks the user for input and returns it as a string.confirm()
confirms an action from the user in JavaScript.- The return value of
confirm()
if the user clicks "Cancel" isfalse
. prompt()
returns a string data type in JavaScript.- The following code will output if "John" is entered:
Hello John
let name = prompt("Enter your name:");
alert("Hello " + name);
console.log()
is often used for simple debugging to check values.- Closing a prompt box without entering any input returns
null
. - A JavaScript alert box's appearance cannot be customized.
- The purpose of the alert box in JavaScript is to display warning messages.
- The alert() function can accept multiple arguments:
False
. - The confirm() function always returns a string value:
False
. - JavaScript pop-up boxes are blocking, meaning script execution pauses until the box is closed:
True
. - The prompt() function can accept two parameters: a message and a default value:
True
. - The alert() function can return a value:
False
. - The confirm() function returns true if the user clicks "OK":
True
. - Using pop-up boxes is generally recommended for complex user interactions:
False
. - If a user clicks "Cancel" on a prompt(), the return value is null:
True
. - Pop-up boxes can be styled using CSS in JavaScript:
False
. - The prompt() function can be used to get input from the user:
True
.
Javascript Functions
- A function in JavaScript is a block of code designed to perform a specific task.
- You define a function in JavaScript using:
function functionName() {}
. - The keyword
return
is used to return a value from a function. - The output of the following code is 7:
function add(a, b) {
return a + b;
}
console.log(add(2, 5));
- A function can be assigned to a variable.
- An anonymous function is a function without a name.
- The following code outputs Hello undefined:
function greet(name) {
console.log("Hello " + name);
}
greet();
- Immediately Invoked Function Expression (IIFE) type does NOT have a name and is often used immediately after creation.
- The output of the following code is 6:
const multiply = (a, b) => a * b;
console.log(multiply(2, 3));
- If a function does not explicitly return a value, it returns undefined.
- A function in JavaScript can accept zero or more arguments:
True
. - Functions in JavaScript cannot return values:
False
. - Anonymous functions are often used as arguments in higher-order functions:
True
. - The return statement immediately stops function execution:
True
. - JavaScript functions can be assigned to variables and passed as arguments:
True
. - Functions in JavaScript must always have a name:
False
. - An arrow function automatically binds this based on the surrounding code:
True
. - JavaScript does not allow nested functions:
False
. - A function defined with the function keyword cannot be called before its declaration:
False
. - JavaScript functions can only be declared using the function keyword:
False
.
JavaScript Loops
- Loops execute a block of code repeatedly in JavaScript.
While
loop runs a block of code while a specified condition is true.do-while
guarantees at least one execution, even if the condition is false initially- The following loop will run 5 times:
for (let i = 0; i < 5; i++) {
console.log(i);
}
- The
break
statement exits the loop completely. continue
is used to skip the current iteration and continue with the next iteration.- The output of the following code is 0 2:
for (let i = 0; i < 3; i++) {
if (i === 1) {
continue;
}
console.log(i);
}
- The following is NOT a valid loop in JavaScript:
loop-until
- If the condition in a while loop is always true, it creates an infinite loop.
- The
for
loop is best suited for iterating over an array. - A for loop can be used to iterate over an array:
True
. - The while loop checks the condition before executing the code block:
True
. - The do-while loop executes the code block at least once, even if the condition is false:
True
. - Using break inside a loop skips the current iteration:
False
. - The continue statement terminates the loop completely:
False
. - A loop with an always-true condition may create an infinite loop:
True
. - JavaScript has a built-in foreach loop for arrays:
False
. - The for loop can have multiple initializations and increments:
True
. - Loops cannot be nested in JavaScript:
False
. - It’s good practice to create infinite loops for long-running tasks:
False
.
JavaScript Error Trapping
- Error trapping handles runtime errors gracefully in JavaScript.
try
,catch
,throw
are keywords used to handle errors in JavaScript.- The
catch
block catches and handles errors. - The output of the following code is:
Start Error occurred
try {
console.log("Start");
throw new Error("Something went wrong");
console.log("End");
} catch (error) {
console.log("Error occurred");
}
CatchError
is NOT a valid error type in JavaScript.- The throw keyword is used to manually trigger an error in JavaScript.
- The
finally
block executes code regardless of errors in JavaScript. - A true statement about error handling is: The throw statement is used to create user-defined errors
- If an error is not caught, the script stops executing immediately.
- A
ReferenceError
is thrown when an undefined variable is accessed. - The catch block in JavaScript can access the error message from the throw statement:
True
. - The finally block always executes, regardless of whether an error occurs:
True
. - JavaScript can handle both syntax errors and runtime errors:
True
. - The throw statement can only throw built-in errors:
False
. - The finally block is optional in a try-catch-finally statement:
True
. - A catch block must always follow a try block:
True
. - JavaScript does not support user-defined errors:
False
. - The catch block can catch multiple types of errors:
False
. - Errors inside a finally block are ignored:
False
. - Error handling improves the reliability and robustness of JavaScript applications:
True
.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.