May 2017 - Archive

Friday, May 19, 2017

Introduction To Cascading Style Sheets (CSS) .

May 19, 2017
Welcome to the gentle introduction to CSS this is actually my first article on CSS, I believe by the end of this article you should be able t work well with CSS. I have taken my time to write this tutorial in a manner that will be okay by everyone ranging from simple English to neat Images, lets start the class;

Like HTML, style sheets must use a common language and follow common rules. This language is known as Cascading Style Sheets, or more simply, CSS.
CSS has been developed by the WWW Consortium (, the same organization that develops standards for HTML.
CSS is designed to augment HTML, not replace it.
CSS is a whole new way of formatting Web pages.
CSS provides several tools not available with standard HTML.

CSS Versions

CSS1 was released in 1996.
CSS2 was released in 1998.
CSS3, the latest standard is being developed.

Benefits of Using Style Sheets (CSS)

Use as a design tool.
Makes website more flexible.
Easier to maintain and modify.
More aesthetically interesting.
Consistent look.

CSS Style Types.

There are three ways of employing CSS in Web pages:
  1. Inline styles: in which styles are added to each tag within the HTML file.  The style affects that particular tag but does not affect other tags in the document.
  2. Embedded or global styles: applied to an entire HTML file, allowing the Web designer to modify the appearance of any tag in the document.
  3. Linked or external style sheets: placed in an external file and linked with pages in the Web site, allowing the Web designer to modify the appearance of tags in several documents
Which approach you choose depends on the Web site’s design..

Using Inline Styles To Employ CSS In Web Page

If you need to format a single section in a Web page, you’d probably use an inline style. To create in inline style, add the style attribute to the HTML tag using the following syntax below:
<tag style=“style declarations”>
tag is the name of the tag (h1, h2, etc)
style declarations are the styles you’ll define for a particular tag
style declaration must be enclosed within double quotation marks

A Style Declaration In CSS

A style declaration consists of attribute names that specify such features as:
  • font size
  • color
  • font type

Attributes are followed by a colon and then the value of the attribute.
Multiple attributes can be used as long as you separate each one by a semicolon.
The general syntax for the style declaration is:
attribute1:value1; attribute2:value2;

Inserting an Inline Style

This figure shows the heading with the new style.

Creating an Embedded Style To Employ CSS In Web Page

An embedded style is a style applied to various sections within a Web page.
Insert a <style> tag within the head section of the HTML file.
Within the <style> tag, enclose the style declarations needed for the entire Web page.
The syntax of an embedded style is:
<style type=“style sheet language”>
  style declarations
style sheet language identifies the type of style language used in the document
The default, is “text/cssfor use with CSS

Style declaration within the <style> tags obey the following syntax:
selector {attribute1:value1; attribute2;value2; ...}
selector identifies an element in your document, such as a heading or paragraph, and the attributes and values within the curly braces indicate the styles applied to all the occurrences of that element
this collection of attributes and values is also referred to as the declaration of the selector
For example, to display all h1 headings in the HTML document using a gold sans-serif font, use the following embedded style:
  h1 {color: gold; font-family: sans-serif}
h1 is the selector and the text enclosed in the braces is the declaration

Defining a Global Style

The type attribute was not included within the <style> tag.  This is because “text/cssis the default style language , and unless you specify a different style language, you don’t need to enter the type attribute.  When using the <style> tags, you don’t need to include double quotes around the attributes and attribute values.

Grouping Selectors

You can apply the same declaration to a group of selectors by including all of the selector names separated by commas.
The following is a sample style declaration to format all headings in a gold sans-serif font:
  h1, h2, h3, h4, h5, h6 {color:gold; font-family:sans-serif}

The Same Style Applied to Two Headings

Even though the same style is used for all heading tags, there are still some differences in how the browser displayed text formatted with these tags.  Most notably, the styles did not affect the relative sizes of the text.  Text formatted with the <h1> tag is still larger than text formatted in the <h2> tag.  This is because the size of the heading text was not defined, so that attribute is left to the browser.

Using an External Style Sheet To Employ CSS In Web Page

Create styles that apply to an entire Web site by creating a text file containing style declarations.
Most style sheets have the extension “.css, though this is not a requirement.
Within a style sheet, you don’t need <style> tags, just the style declarations.

Linking to Style Sheets with the <link> Tag

Use the <link> tag to link Web pages to a style sheet.
The general syntax for using the <link> tag is as follows:
<link href=“URL” rel=“relation_typetype=“link_type>
URL is the URL of the linked document
relation_type establishes the relationship between the linked document and the Web page
link_type indicates the language used in the linked document
In order to link to a style sheet, the value of the rel attribute should bestylesheet and the value of the type attribute should be “text/css.
To link to a style sheet named mws.css,” the <link> tag would be:
<link href=“mws.css” rel=“stylesheettype=“text/css>

Linking to Style Sheets with @import

Another way to link to a style sheet is to use the @import command, which accesses the style sheet definitions from another file.
To use @import with styles, enclose the @import command within the embedded <style> tags as follows:
  @import url(stylesheet.css);
  style declarations
stylesheet.css is the URL of the style sheet file

The @import Command
The @import command provides greater flexibility than the <link> tag when working with multiple style sheets.
The @import command has limited browser support.
Unless you have a compelling reason to use @import, you are probably better off using the <link> tag.

Resolving Style Precedence

In cases where the styles conflict, precedence is determined in the following order:
an inline style overrides any embedded style or external style sheet
an embedded style overrides an external style sheet
an external style sheet overrides the internal style rules set by the Web browser
any style attributes left undefined by an inline style, an embedded style, or an external style sheet are left to the Web browser

How To Change CSS Styles In Web Pages

As a change is made to a style at one level, the changes are cascaded through to the other levels (hence the term, cascading style sheets).
Where a different font has not been specified, changes will cascaded through the embedded and inline styles.
As you define more styles for a Web site, you need to keep track of the inline, embedded, and external style sheets to correctly predict the impact that style changes have on the appearance of each page.

Working with Style Inheritance

Web pages invariably have elements placed within other elements.
for example, a Web page might have a bold tag, <b>, placed within a paragraph tag, <p>, to create boldface text within the paragraph.  The paragraph tag is likewise placed within the <body> tag.

Sample Tree Structure of HTML Elements
This figure displays the HTML element relationship using a tree diagram.

Parent and Descendant Elements

An element that lies within another element is called a descendant or descendant element.
An element that contains another element is called the parent or parent element.
An example of a parent is the <body> tag, which contains all of the other tags used to format the content of a Web page.
Using the principle of inheritance, styles defined for each parent tag are transferred to its descendants.

Contextual Selectors

Use the tree structure concept to better control how styles are applied to a Web page.
CSS provides ways of fine-tuning the context in which the selector is applied.
if you want to apply a style only to the direct descendant of a parent element, use the syntax: e1 > e2
el and e2 are the names of HTML elements and e2 is directly below the e1 in the hierarchy of elements in the document
for example: li > b {color:blue}

Not all browsers support contextual selectors. Always test Web page using various browsers and browser versions.

I think I should drop my pen right here at this junction, till next time I will be posting on this specific topic please learn this tutorial well and don't forget to drop your comments below to ask questions or to contribute at the same time share with your friends.

Next time we will be looking at how we can work with fonts in CSS.

Sunday, May 14, 2017

Some Java Basic Syntax You Should Know.

May 14, 2017
When we consider a Java program, it can be defined as a collection of objects that communicate via invoking each other's methods. Let us now briefly look into what do class, object, methods, and instance variables mean.

Some Java Basic Syntax You Should Know.

  • Object - Objects have states and behaviors. Example: A dog has states - color, name, breed as well as behavior such as wagging their tail, barking, eating. An object is an instance of a class.

  • Class - A class can be defined as a template/blueprint that describes the behavior/state that the object of its type supports.

  • Methods - A method is basically a behavior. A class can contain many methods. It is in methods where the logics are written, data is manipulated and all the actions are executed.

  • Instance Variables - Each object has its unique set of instance variables. An object's state is created by the values assigned to these instance variables.

First Java Program

Let us look at a simple code that will print the words Hello World.

public class MyFirstJavaProgram {
/* This is my first java program.
*This will print 'Hello World' as the output
public static void main(String []args) {
System.out.println("Hello World"); // prints Hello World

Let's look at how to save the file, compile, and run the program. Please follow the subsequent steps:

  • Open notepad and add the code as above.

  • Save the file as:

  • Open a command prompt window and go to the directory where you saved the class. Assume it's C:\.

  • Type 'javac' and press enter to compile your code. If there are no errors in your code, the command prompt will take you to the next line (Assumption : The path variable is set).  

  • Now, type ' java MyFirstJavaProgram ' to run your program.

  • You will be able to see ' Hello World ' printed on the window.

Basic Syntax

About Java programs, it is very important to keep in mind the following points.

  • Case Sensitivity - Java is case sensitive, which means identifier Helloand hello would have different meaning in Java.

  • Class Names - For all class names the first letter should be in Upper Case. If several words are used to form a name of the class, each inner word's first letter should be in Upper Case. Example: class MyFirstJavaClass

  • Method Names - All method names should start with a Lower Case letter. If several words are used to form the name of the method, then each inner word's first letter should be in Upper Case. Example: public void myMethodName()

  • Program File Name - Name of the program file should exactly match the class name. When saving the file, you should save it using the class name (Remember Java is case sensitive) and append '.java' to the end of the name (if the file name and the class name do not match, your program will not compile). Example: Assume 'MyFirstJavaProgram' is the class name. Then the file should be saved as ''

  • Public static void main(String args[]) - Java program processing starts from the main() method which is a mandatory part of every Java program.

Java Identifiers

All Java components require names. Names used for classes, variables, and methods are called identifiers. In Java, there are several points to remember about identifiers. They are as follows:

  • All identifiers should begin with a letter (A to Z or a to z), currency character ($) or an underscore (_). 
  • After the first character, identifiers can have any combination of characters.
  • A key word cannot be used as an identifier.
  • Most importantly, identifiers are case sensitive.
  •  Examples of legal identifiers: age, $salary, _value, __1_value.
  • Examples of illegal identifiers: 123abc, -salary. Java Modifiers Like other languages, it is possible to modify classes, methods, etc., by using modifiers. There are two categories of modifiers:
  • Access Modifiers: default, public , protected, private
  • Non-access Modifiers: final, abstract, strictfp We will be looking into more details about modifiers in the next section. Java Variables Following are the types of variables in Java:
  •  Local Variables
  • Class Variables (Static Variables)
  • Instance Variables (Non-static Variables) Java Arrays Arrays are objects that store multiple variables of the same type. However, an array itself is an object on the heap. We will look into how to declare, construct, and initialize in the upcoming chapters.

Java Enums

Enums were introduced in Java 5.0. Enums restrict a variable to have one of only a few predefined values. The values in this enumerated list are called enums.

With the use of enums it is possible to reduce the number of bugs in your code. For example, if we consider an application for a fresh juice shop, it would be possible to restrict the glass size to small, medium, and large. This would make sure that it would not allow anyone to order any size other than small, medium, or large.


class FreshJuice {
enum FreshJuiceSize{ SMALL, MEDIUM, LARGE }
FreshJuiceSize size;

public class FreshJuiceTest {

public static void main(String args[]){

FreshJuice juice = new FreshJuice();

juice.size = FreshJuice.FreshJuiceSize.MEDIUM ;
System.out.println("Size: " + juice.size);

The above example will produce the following result:

Note: Enums can be declared as their own or inside a class. Methods, variables, constructors can be defined inside enums as well.

Java Keywords 

The following list shows the reserved words in Java. These reserved words may not be used as constant or variable or any other identifier names.


Using Blank Lines

A line containing only white space, possibly with a comment, is known as a blank line, and Java totally ignores it.


In Java, classes can be derived from classes. Basically, if you need to create a new class and here is already a class that has some of the code you require, then it is possible to derive your new class from the already existing code. This concept allows you to reuse the fields and methods of the existing class without having to rewrite the code in a new class. In this scenario, the existing class is called the superclass and the derived class is called the subclass.


In Java language, an interface can be defined as a contract between objects on how to communicate with each other. Interfaces play a vital role when it comes to the concept of inheritance. An interface defines the methods, a deriving class (subclass) should use. But the implementation of the methods is totally up to the subclass.  

12 Java Overviews: Introduction To Java Programming Language.

History of Java

James Gosling initiated Java language project in June 1991 for use in one of his many settop box projects. The language, initially called ‘Oak’ after an oak tree that stood outside Gosling's office, also went by the name ‘Green’ and ended up later being renamed as Java, from a list of random words. Sun released the first public implementation as Java 1.0 in 1995.

It promised Write Once, Run Anywhere (WORA), providing no-cost run-times on popular platforms. On 13 November, 2006, Sun released much of Java as free and open source software under the terms of the GNU General Public License (GPL). On 8 May, 2007, Sun finished the process, making all of Java's core code free and opensource, aside from a small portion of code to which Sun did not hold the copyright.

Tools You Will Need

You will need a Pentium 200-MHz computer with a minimum of 64 MB of RAM (128 MB of RAM recommended).

You will also need the following softwares:

  • Linux 7.1 or Windows xp/7/8 operating system
  • Java JDK 8
  • Microsoft Notepad or any other text editor

Java programming language was originally developed by Sun Microsystems which was initiated by James Gosling and released in 1995 as core component of Sun Microsystems' Java platform (Java 1.0 [J2SE]). The latest release of the Java Standard Edition is Java SE 8. With the advancement of Java and its widespread popularity, multiple configurations were built to suit various types of platforms. For example: J2EE for Enterprise Applications, J2ME for Mobile Applications. The new J2 versions were renamed as Java SE, Java EE, and Java ME respectively. Java is guaranteed to be Write Once, Run Anywhere. Java is:
  • Object Oriented: In Java, everything is an Object. Java can be easily extended since it is based on the Object model.

  •  Platform Independent: Unlike many other programming languages including C and C++, when Java is compiled, it is not compiled into platform specific machine, rather into platform independent byte code. This byte code is distributed over the web and interpreted by the Virtual Machine (JVM) on whichever platform it is being run on.

  •  Simple: Java is designed to be easy to learn. If you understand the basic concept of OOP Java, it would be easy to master.

  • Secure: With Java's secure feature it enables to develop virus-free, tamper-free systems. Authentication techniques are based on public-key encryption.

  • Architecture-neutral: Java compiler generates an architecture-neutral object file format, which makes the compiled code executable on many processors, with the presence of Java run time system.

  • Portable: Being architecture-neutral and having no implementation dependent aspects of the specification makes Java portable. Compiler in Java is written in ANSI C with a clean portability boundary, which is a POSIX subset.

  •  Robust: Java makes an effort to eliminate error prone situations by emphasizing mainly on compile time error checking and runtime checking.

  •  Multithreaded: With Java's multithreaded feature it is possible to write programs that can perform many tasks simultaneously. This design feature allows the developers to construct interactive applications that can run smoothly.

  •  Interpreted: Java byte code is translated on the fly to native machine instructions and is not stored anywhere. The development process is more rapid and analytical since the linking is an incremental and light-weight process.

  •  High Performance: With the use of Just-In-Time compilers, Java enables high performance.

  •  Distributed: Java is designed for the distributed environment of the internet.

  • Dynamic: Java is considered to be more dynamic than C or C++ since it is designed to adapt to an evolving environment. Java programs can carry extensive amount of run-time information that can be used to verify and resolve accesses to objects on run-time.

Java Local Environment Setup.

If you are still willing to set up your environment for Java programming language, then this section guides you on how to download and set up Java on your machine.

Following are the steps to set up the environment.

Java SE is freely available from the link Download Java. You can download a version based on your operating system. Follow the instructions to download Java and run the .exe to install Java on your machine.

Once you installed Java on your machine, you will need to set environment variables to point to correct installation directories:

Setting Up the Path for Windows

Assuming you have installed Java in c:\Program Files\java\jdk directory:
  •  Right-click on 'My Computer' and select 'Properties'.
  •  Click the 'Environment variables' button under the 'Advanced' tab.
  •  Now, alter the 'Path' variable so that it also contains the path to the Java executable.

Example, if the path is currently set to 'C:\WINDOWS\SYSTEM32', then change your path to read 'C:\WINDOWS\SYSTEM32;c:\Program Files\java\jdk\bin'. Setting Up the Path for Linux, UNIX, Solaris, FreeBSD Environment variable PATH should be set to point to where the Java binaries have been installed.

Refer to your shell documentation, if you have trouble doing this.

Example, if you use bash as your shell, then you would add the following line to the end of your '.bashrc: export PATH=/path/to/java:$PATH'

Popular Java Editors

To write your Java programs, you will need a text editor. There are even more sophisticated IDEs available in the market.

But for now, you can consider one of the following:

  •  Notepad: On Windows machine, you can use any simple text editor like Notepad (Recommended for this tutorial), TextPad.

  •  Netbeans: A Java IDE that is open-source and free, which can be downloaded from

  •  Eclipse: A Java IDE developed by the eclipse open-source community and can be downloaded from  

Thursday, May 11, 2017

How To Create A Grab, Follow Me Button, or Badge For Your Website or Blog (HTML)

May 11, 2017

First of all i will like to introduce you to HTML because this badge is made with pure html look at my Image thumbnail above you will find out that the codes is purely html if you dont know anything about HTML check below lists to get insight on what HTML is all about plus some topics under HTML i have covered for your easy digestion....
Check out the source code below

<div align="center" style="padding: 5px;">
<img alt="" src="" style="border: none;" title="" /></div>
<pre style="background: none; border: none; padding: 0;"><textarea style="background: rgb(240, 240, 240) none repeat scroll 0% 0%; border: 1px solid rgb(204, 204, 204); color: #777777; display: block; font-size: 100%; height: 49px; margin: auto; padding: 7px 0px 2px 5px; text-align: left; width: 452px;"><div align="center">
<a href="" rel="nofollow" title=""><img src="" alt="" style="border: none;" /></a></div>

The above codes will display something like below:

The above code will display the above badge on your widget and the widget has a container with the code that visitors can paste on their own site to display your badge the code will look like this one below:

<div align="center"><a href="" rel="nofollow" title=""><img src="" alt="" style="border: none;" /></a></div>

The above codes will display something like below:

The only code you are making use of is the one i pasted fist and this are the changes you need to make:

  1. The "center" in blue you should change it to left or right depending on how you want the badge to be aligned.
  2. The link in red ("  title=" you should change it to your logo or any image you will like to use URL (Address).
  3. The link in red (alt="") note the only text in red should be changed and this is to be changed to any alternative text you will like to be displayed in the absent of the image as in my case i can change it to Institute Of computing and ict but thats left to you..
  4. This link in red should be changed to your desired url you want the user to go when the badge is clicked (Your website or blog url).
  5.  This link in red is the logo that will apear on the person that copied the badges code site so you can change it to your sites logo url
  6.  Alternative word in red you can change it to your desired words
  7. The Textarea in red (</textarea>)implies that you are going to use this on Blogspot or if you are goin to use it on use <pre></pre> tag instead..
That will be all for now i hope it worked perfectly for you don't hesitate to drop your comments below to ask any questions... And please share with friends..

Tuesday, May 9, 2017

80 Visual Basic Multiple Choice Objective Questions and Answers For University Students

May 09, 2017
I received messages from my readers asking me to help them with possible questions that can be asked in their fort coming examination I did my best and took my time to write and compile 80 questions and answers I wish I can work through the process of getting you exercises and not objective Questions but looking at the system run by various University this days objective Questions will be an added advantages compare to theory Questions. so lets go together to solve these Questions....

Yakubu Binuyaminu Adeiza: Binoosmrart

1. The Visual Basic Code Editor will automatically detect certain types of errors as you are entering code.
A. True
B. False
Ans: A

2. Keywords are also referred to as reserved words.
A. True
B. False
Ans: A

3. The divide-and-conquer-method of problem solving breaks a problem into large, general pieces first, then refines each piece until the problem is manageable.
A. True
B. False
Ans: A

VISUAL BASIC Multiple Choice Questions and Answers
4. Visual Basic responds to events using which of the following?
A. a code procedure
B. an event procedure
C. a form procedure
D. a property
Ans: B

5. When the user clicks a button, _________ is triggered.
A. an event
B. a method
C. a setting
D. a property
Ans: A

6. What property of controls tells the order they receive the focus when the tab key is pressed during run time?
A. Focus order
B. Focus number
C. Tab index
D. Control order
Ans: C

7. Sizing Handles make it very easy to resize virtually any control when developing applications with Visual Basic. When working in the Form Designer, how are these sizing handles displayed?
A. A rectangle with 4 arrows, one in each corner, around your control.
B. A 3-D outline around your control.
C. A rectangle with small squares around your control.
D. None of the above.
Ans: C

8. The Properties window plays an important role in the development of Visual Basic applications. It is mainly used change how objects look and feel.
B. when opening programs stored on a hard drive.
C. to allow the developer to graphically design program components.
D. to set program related options like Program Name, Program Location, etc.
Ans: A

9. When creating a new application in Visual Basic, you are asked to supply a name for the program. If you do not specify a name, a default name is XXXXX XXXXX is this default name?
A. Wapplication followed by a number.
B. Application followed by a number.
C. WindowsApplication.
D. WindowsApplication followed by a number.
Ans: C,B

10. Which of the properties in a control’s list of properties is used to give the control a meaningful name?
A. Text
B. ContextMenu
C. ControlName
D. Name
Ans: D

11. Pseudocode is
A. data that have been encoded for security.
B. the incorrect results of a computer program.
C. a program that doesn’t work.
D. the obscure language computer personnel use when speaking.
E. a description of an algorithm similar to a computer language.
Ans: E

12. An algorithm is defined as:
A. a mathematical formula that solves a problem.
B. a tempo for classical music played in a coda.
C. a logical sequence of steps that solve a problem.
D. a tool that designs computer programs and draws the user interface.
Ans: C

13. A variable declared inside an event procedure is said to have local scope
A. True
B. False
Ans: A

14. A variable declared outside of an event procedure is said to have class-level scope.
A. True
B. False
Ans: A

15. Option Explicit requires you to declare every variable before its use.
A. True
B. False
Ans: A

16. The value returned by InputBox is a string.
A. True
B. False
Ans: A

17. What is the correct statement when declaring and assigning the value of 100 to an Integer variable called numPeople
A. Dim numPeople =
B. Dim numPeople = Int(100)
C. numPeople = 100
D. Dim numPeople As Integer = 100
Ans: D

18. Which of the following arithmetic operations has the highest level of precedence?
A. + –
B. * /
C. ^ exponentiation
D. ( )
Ans: C

19. What value will be assigned to the numeric variable x when the following statement is executed? x = 2 + 3 * 4
A. 20
B. 14
C. 92
D. 234
Ans: B

20. Which of the following is a valid name for a variable?
A. Two_One
B. 2One
C. Two One
D. Two.One
Ans: A

21. Keywords in Visual Basic are words that
A. should be used when naming variables.
B. are used to name controls, such as TextBox1, Command2, etc.
C. have special meaning and should not be used when naming variables.
D. are used as prefixes for control names (such as txt, btn, lbl, and lst).
Ans: C

22. To continue a long statement on another line, use:
A. an underscore character.
B. an ampersand character.
C. Ctrl + Enter.
D. a space followed by an underscore character.
Ans: A

23. What is the proper syntax when using a message dialog box?
A. MessageBox.Show(“Hi there”, “Hi”)
B. MessageBox.Show(Hi there, Hi)
C. MessageBox.Show “Hi There”, “Hi”
D. MessageBox.Show Hi There, Hi
Ans: A

24. What will be the output of the following statement? txtBox.Text = FormatCurrency(1234.567)
A. $1234.567
B. 1,234.57
C. $1234.57
D. $1,234.57
Ans: D

25. The following lines of code are correct. If age >= 13 And < 20 Then txtOutput.Text = “You are a teenager.” End If
A. True
B. False
Ans: B

26. Given that x = 7, y = 2, and z = 4, the following If block will display “TRUE”. If (x > y) Or (y > z) Then txtBox.Text = “TRUE” End If
A. True
B. False
Ans: A

27. Asc(“A”) is 65. What is Asc(“C”)?
A. 66
B. 67
C. 68
D. “C”
Ans: B

28. Asc(“A”) is 65. What is displayed by txtBox.Text = Chr(65) & “BC”?
C. 656667
D. Not enough information is available.
Ans: A

29. Which of the following expressions has as its value the words “Hello World? surrounded by quotation marks?
A. “Hello World”
B. Chr(34) & “Hello World”
C. Chr(34) & Hello World & Chr(34)
D. Chr(34) & “Hello World” & Chr(34)
Ans: A

30. Which of the following is true?
A. “Cat” = “cat”
B. “Cat” < “cat”
C. “Cat” > “cat”
D. Relational operators are only valid for numeric values.
Ans: B

31. Which of the following is a valid Visual Basic conditional statement?
A. 2 < n < 5
B. 2 < n Or < 5
C. 2 < n Or 5
D. (2 < n) Or (n < 5)
Ans: D

32. The three main logical operators are ________, _________, and ________.
A. And, Or, Not
B. And, Not, If
C. Or, Not, If
D. False, And, True
Ans: A

33. Which value for x would make the following condition true: x >= 5
A. x is equal to 7
B. x is equal to 5
C. x is equal to 5.001
D. all of the above
Ans: D

34. Which value for x would make the following condition true: Not (x >= 5)
A. x is equal to 7
B. x is equal to 4
C. x is equal to 5.001
D. x is equal to 5.001
Ans: B

35. Which value for x would make the following condition true: (x >= 5) And (x <= 6)
A. x is equal to 7
B. x is equal to 5
C. x is equal to 5.001
Ans: B,C

36. Constructs in which an If block is contained inside another If block are called:
A. multi-If blocks
B. nested If blocks
C. sequential If blocks
D. none of the above
Ans: B

37. One may use an If block within a Select Case block.
A. True
B. False
Ans: A

38. One may use a Select Case block within an If block.
A. True
B. False
Ans: A

39. Select Case choices are determined by the value of an expression called a selector.
A. True
B. False
Ans: A

40. Items in the value list must evaluate to a literal of the same type as the selector
A. True
B. False
Ans: A

41. A single Case statement can contain multiple values.
A. True
B. False
Ans: A

42. You can specify a range of values in a Case clause by using the To keyword.
A. True
B. False
Ans: A

43. A variable declared inside a Select Case block cannot be referred to by code outside of the block.
A. True
B. False
Ans: A

44. Suppose that the selector in a Select Case block is the string variable myVar. Which of the following is NOT a valid Case clause?
A. Case “Adams”
B. Case “739”
C. Case (myVar.Substring(0, 1)
D. Case myVar.Length
Ans: D

45. Different items appearing in the same value list of a Select Case block must be separated by a ____________.
A. semi colon
B. comma
C. colon
D. pair of quotation marks
Ans: B

46. Which Case clause will be true whenever the value of the selector in a Select Case block is between 1 and 5 or is 8?
A. Case 1 To 8
B. Case 1 To 5, 8
C. Case 1 To 8, 5
D. Case 1 To 5; 8
Ans: B

47. Which Case clause will be true whenever the value of the selector in a Select Case block is greater than or equal to 7?
A. Case Is >7
B. Case Is = 8
C. Case Is >= 7
D. Case Is <= 8
Ans: C

48. What type of items are valid for use in the value list of a Case clause?
A. literals
B. variables
C. expressions
D. all of the above
Ans: D

49. What happens to a variable declared locally inside a Sub procedure after the procedure terminates?
A. It maintains its value even after the End Sub statement executes.
B. It ceases to exist after the End Sub statement executes.
C.It loses its value temporarily after the End Sub statement executes, but regains that value upon re-entry to the Sub procedure.
D. It is reset to its default value.
Ans: B

50. Suppose a variable is passed by reference to a parameter of a Sub procedure, and the parameter has its value changed inside the Sub procedure. What will the value of the variable be after the Sub procedure has executed?
A. It will have the newly modified value from inside the Sub procedure.
B. Its value can?t be determined without more information.
C. It will retain the value it had before the call to the Sub procedure
D. None of the above.
Ans: A

51. Suppose a variable is passed by value to a parameter of a Sub procedure, and the parameter has its value changed inside the Sub procedure. What will the value of the variable be after the Sub procedure has executed?
A. It will have the newly modified value from inside the Sub procedure.
B. Its value can?t be determined without more information
C. It will retain the value it had before the call to the Sub procedure
D. None of the above.
Ans: C

52. The declaration statement for a class-level variable should be placed __________.
A. inside an event procedure
B. inside a general procedure
C. anywhere in the program region, except inside a procedure
D. above the statement Public Class frmName
Ans: C

53. Variables declared inside a procedure are said to have ________________.
A. local scope
B. procedure-level scope
C. class-level scope
D. none of the above
Ans: A

54. What will be the output of the following program when the button is clicked?
Private Sub btnDisplay_Click(…) Handles btnDisplay.Click
Dim number As Double = 3
txtBox.Text = CStr(number)
End Sub
Sub DoubleAndSquare(ByRef myVar As Double)
myVar = myVar + myVar
myVar = myVar * myVar
A. 3
B. 36
C. 6
D. 0
Ans: B

55. Suppose the variable myName is declared in a Dim statement in two different Sub procedures. Which statement is true?
A. The program will malfunction when it is executed.
B. When the value of myName is changed in one Sub procedure, it will also be changed in the other Sub procedure.
C. Visual Basic’s smart editor will alert you that this is an error before the program is executed.
D. The two variables will be local to their respective Sub procedures.
Ans: D

56. Which of the following statements is guaranteed to pass the variable numVar by value to the Sub procedure Tally?
A. Tally(numVar)
B. Tally(ByVal numVar)
C. Tally((numVar))
D. Tally(ByVal numVar As Double)
Ans: D

57. The ______________ of a Sub procedure are vehicles for passing numbers and strings to the Sub procedure.
A. Call Statements
B. arguments
C. parameters
D. variables declared inside
Ans: C

58. Which of the following is NOT a reason for using procedures?
A. They break a complex problem down into smaller pieces.
B. They make a program run faster.
C. They can be reused easily.
D. They make it possible for a team of people to work together on a single program.
Ans: B

59. Which one of the following is true about arguments and parameters?
A. Arguments appear in Call statements; parameters appear in Sub statements.
B. Parameters appear in Call statements; arguments appear in Sub statements.
C. They are synonymous terms.
D. They are completely unrelated in a program.
Ans: A

60.Each individual variable in the list student(0), student(1), student(2) is known as a(n)
A. subscript
B. dimension
C. element
D. type
Ans: C

62. The statement Const TAX_RATE As Doubleface=Calibri size=2> is not valid.
A. True
B. False
Ans: A

63. Function names should be suggestive of the role performed. The names also must conform to the rules for naming variables.
A. True
B. False
Ans: A

64. The input to a user-defined function can consist of one or more values.
A. True
B. False
Ans: A

65. Both the input and output of a Function procedure can consist of several values.
A. True
B. False
Ans: B

66. Suppose you want to write a procedure that takes three numbers, num1, num2, and num3; and returns their sum, product, and average. It is best to use a Function procedure for this task.
A. True
B. False
Ans: B

67. Although a function can return a value, it cannot directly display information in a text box.
A. True
B. False
Ans: B

68. Function procedures can invoke other Function procedures.
A. True
B. False
Ans: A

69. A Function may return up to two values.
A. True
B. False
Ans: B

70. The input to a user-defined function can consist of:
A. a single value
B. one or more values
C. no values
D. All of the above
Ans: D

71. Variables appearing in the header of a Function procedure are called ____________.
A. values of the function
B. parameters
C. coordinates
D. arguments
Ans: B

72. The arguments appearing in a Call statement must match the parameters in the appropriate Sub or Function header in all but one of the following ways. Which one?
A. Number of arguments
B. Names of arguments
C. Data type of arguments
D. Order of arguments
Ans: B

73. What will be the output of the following program when the button is clicked?
Private Sub btnDisplay_Click(…) Handles btnDisplay.Click
Dim word, result As String
word = “Benjamin”
result = Rotate(word)
result = Rotate(result & word)
result = Rotate(result)
txtBox.Text = result
End Sub
Function Rotate(ByVal var As String) As String
Dim varlength As Integer
varlength = var.Length
Return var.Substring(1) & var.Substring(0, 1)
End Function
A. jaminBBenjaminen
B. BenjaminBenjamin
C. njaminBe
D. None of the above
Ans: A

74. What is displayed when the button is clicked?
Private Sub btnDisplay_Click(…) Handles btnDisplay.Click
Dim a, b as String
Dim x as Integer
a = “How now brown cow.”
b = “brown”
x = FindIt(a, b)
txtBox.Text = CStr(x)
End Sub
Function FindIt(ByVal z1 as String, ByVal z2 as String) As Integer
Dim x as Integer
x = z1.IndexOf(z2)
End Function
“How now”
A. 8
B. 0
C. An error
D. None of the above
Ans: D

75. A Do While loop checks the While condition before executing the statements in the loop.
A. True
B. False
Ans: A

76. A Do?Loop Until block is always executed at least once
A. True
B. False
Ans: A

77. A counter variable is normally incremented or decremented by 1.
A. True
B. False
Ans: A

78. The value of the control variable should not be altered within the body of a For?Next loop.
A. True
B. False
Ans: B

79. The body of a For…Next loop in Visual Basic will always be executed once no matter what the initial and terminating values are.
A. True
B. False
Ans: B

80. The body of a For…Next loop in Visual Basic will always be executed once no matter what the initial and terminating values are. duplicate question?
A. True
B. False
Ans: B