Question

Question 1 When you declare a variable of type Single, it contains 0 by default. True...

Question 1


When you declare a variable of type Single, it contains 0 by default.

True


False


Question 2


The following line declares an array that can contain whole numbers, with 10 elements.

Dim Variables(9) As Integer

True


False


Question 3


Once a variable is declared we can not change the variable's data type.

True


False


Question 4


If A is False and B is True, then A Or B is True because A is False.

True


False


Question 5


The data type of 25.5 is:


String


All shown answers are correct


Integer


Single


Question 6


The data type of 5 is:


Short


All shown answers are correct


Integer


Long


Question 7


The data type of the Text property is:


No correct answer is shown


Integer


String


Single


Question 8


Which of the following is a Boolean expression:

All answers shown are correct.


A Xor B



X

where X is integer

0


Question 9


To refer to a property xyz of a control named abc in your Visual Basic code, you use:


xyz.abc


a.b.c.x.y.z.


abc.xyz


No correct answer is shown


Question 10


Assume this code:

Dim Nums(Y) As Integer

Assume later we filled the array Nums with integer values.

Write one line of code that calculates the average of: the first and the last element of Nums. Display the average in a messagebox.

Question 11


Assume that an array z, is declared as in:


Dim z(n) As Integer

and that z has been filled with data in all its locations, and n is an odd number.

           <-- array content is integer values

0 1 2 3       n   <-- index or location

Write code that uses a for loop, to calculate the average of every other number in z starting from location 0 to location n inclusive.

Since n is an odd number the for loop can start at the first location and end at the last location of z.

Think of what the step should be so we process one element then skip the next one and move on to the one after that.

After the loop show the resulting average in a messagebox. Think about the number of elements we need to divide by is half of the elements between locations 0 and n.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Question 1:

Single data type is used to floating point numbers in visual basic.single dataype allots 4 bytes in memory.the default value assigned to variable is '0'.

Hence answer is TRUE.

Question 2:

Arrays in visual basic are used to store the elements which are logically connected together.array can be declared in VB as dim variableName(5) As Integer.variableName is array name holds 5 elements.

As per the question, the variable name is 'Variable'.in Vb the first letter of the second word can be capital.the variable name cannot start with a capital letter.we can declare sam array as Dim Variable(9) As Integer;

in the questoion declaration is correct but variable name constrints are violated.

hence the answer is "FALSE".

Question 3:

In visual basic the variables can be converted to other datatypes if it neccessary.for example when a variable declared as single ,it can be extended to double.This conversion of datatypes can be implicit or explicit also.

In VB ,functions CBool,CInt etc are used to convert the datatype of the variable.

Hence the answer is "FALSE",

Question 4:

the question is on logical operator.as per the expression.if A is false and b is true,then A OR B is true.

because OR is a operator where any one of the expression is true then the entire statement become true.but not because A is false.its beccause B is true.

Hence the ansewer is " False"

question 5:

the value 25.5 is a floating number.

option a is not correct because the value is not declared as "25.5".its a normal float number not a string.

option b is not correct since its not string.

option c is not corrects its not Integer because it has a precision value.

Option D is the corrct answer.25.5 is single datatype value.

Question 6:

the value 7 is a natural number.

option a can be correct because the short datatype can be used to declare a natural number.

option a can be correct because the Integer datatype can be used to declare a natural number.

option a can be correct because the Long datatype can be used to declare a natural number

option b is correct since 7 is a natuaral number can be declared short,Integer and Long where the difference is in allocated size.

Question7:

String is the correct answer.text property is used to display the string in the form.so its datatype is not Integer or Single .It is String.

Question 8:

A Xor B is the boolean expression.when a statement said as boolean expression it should contain boolean operators like OR,AND Xor..

Question 9:

To refer a property of xyz of control named abc in VB code,we use abc.xyz.for example .

the syntax is as follows ControlName.propertyName.

example:text.Label, Font.size

Question 10:

Dim Nums(y) As Integer

MessageBox.show("(Nums(0)+Nums(y))/2")

(Nums(0)+Nums(y))/2 is the average of first and last no in array.and then average can be displayed in MessageBox by using show method.

Question 11:

code calculate the average of n=10 numbers in array z.

Dim a As Integer

Dim sum As Integer

Dim z(10)As Integer

Dim avg as Double

for a=0 to 10

sum+=a

next a

avg=sum/10

Add a comment
Know the answer?
Add Answer to:
Question 1 When you declare a variable of type Single, it contains 0 by default. True...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write the code to dynamically allocate ONE integer variable using calloc (contiguous allocation) or malloc (memory...

    Write the code to dynamically allocate ONE integer variable using calloc (contiguous allocation) or malloc (memory allocation) and have it pointed to by a pointer (of type int * ) named ptr_1. Use ptr_1 to assign the number 7 to that dynamically allocated integer, and in another line use printf to output the contents of that dynamically allocated integer variable. Write the code to dynamically allocate an integer array of length 5 using calloc or malloc and have it pointed...

  • this is true and false for C++ (1 point each) Circle T for true or F...

    this is true and false for C++ (1 point each) Circle T for true or F for false for the following questions. 1. T/F The Boolean expression b1 || b2 evaluates to true if either Boolean value (b1, b2) is true. T/F The code we write in C++ (e.g. code in file project1.cpp) is referred to as source code. 2. 3. T/F The statement float scores[3][3] creates 3 arrays, each containing 3 floating-point variables. T/F For loops work best when...

  • Q1) How would you declare an array of doubles called myDoubles? Arrays can be initialized in...

    Q1) How would you declare an array of doubles called myDoubles? Arrays can be initialized in one of two ways. In one method, the array elements are placed in a list enclosed in curly braces after the array name definition. For example, the code below creates an array of ints with 3 elements: 1, 2 and 3. int[] a = {1, 2, 3, 4}; We can also initialize an array with a new construct, indicating how many elements we want...

  • Using C programming

    Using C, create a data file with the first number being an integer. The value of that integer will be the number of further integers which follow it in the file. Write the code to read the first number into the integer variable how_many.Please help me with the file :((This comes from this question:Write the code to dynamically allocate ONE integer variable using calloc (contiguous allocation) or malloc (memory allocation) and have it pointed to by a pointer (of type int...

  • question 1: Three options for "returning true" are shown in comments within the method above.  Which option...

    question 1: Three options for "returning true" are shown in comments within the method above.  Which option is the correct one? Briefly explain. question 2: Assuming the array is of size n × n and it IS square, what is the complexity using Big-O notation of the method above for each of the three options for the location of "return true"? Briefly explain. for question 2, its basically asking what are the three options Below is a method written to determine...

  • Incorrect Question 12 0/4 pts What of the following are true for the following piece of...

    Incorrect Question 12 0/4 pts What of the following are true for the following piece of code? int main() int a[ ] = { 2, 4, 6, 8, 10 } int i; change ( a, 5); for (i = 0; i <= 4; i++) printf("\n%d", a[i]); return 0; void change ( int *b, int n) int i; for (i - @;i<n; i++) this line void change(int *b, int n) has an error. We must have to use int b[] as...

  • Java Write a Simple Program This question is about following the directions below. Failure to do...

    Java Write a Simple Program This question is about following the directions below. Failure to do so, results in lost credit. Write the definition of a method that takes in an integer number, and returns true if the number is prime, otherwise, returns false. A prime number is only divisible by itself and 1. Do not write the code for main here. The code must follow these steps in the order shown: 1. Name the method isPrime, and make it...

  • Define a class DoubleStack which implements two stacks of objects of type Object using a single...

    Define a class DoubleStack which implements two stacks of objects of type Object using a single shared array, so that the push and pop operations specify which of the two stacks is involved in the operation (as described below). (a) Specify necessary instance variables and write a constructor “DoubleStack(int n)” that takes integer n and creates an empty DoubleStack object with the shared array with room for n elements (2 pt); b) Write methods "boolean push(int i, Object o)" and...

  • Assignment 5 will be way different. It will be more like what you will receive in...

    Assignment 5 will be way different. It will be more like what you will receive in a programming shop. By that I mean that some things are built for you and others you will need to create or finish. P.S. part of your grade will include: Did you add in the required files? Did you rename your project? does your linear searches work? Did you put your code in the correct modules? did you change modules that you weren't supposed...

  • Question 1 What is the value of x after the following int x = 5; x++;...

    Question 1 What is the value of x after the following int x = 5; x++; x++; x+=x++; A)14 B)10 C)13 D)15 Question 2 The last line in value returning function (before the }) should contain the word return. True False Question 3 This contains three parts: Void or Data Type the name optional parameter list A)Menu System B)Function Header C)Switch Question 4 What is a variable? A)a pointer B)a place in memory to hold data C)int D)a computer programming...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT