1.
What does HTML stand for?
Correct Answer
C. Hyper Text Markup Language
Explanation
HTML stands for Hyper Text Markup Language. It is a standard markup language used for creating and structuring the content on web pages. HTML uses tags to define elements such as headings, paragraphs, images, links, and more. These tags provide a structure and format to the content, allowing web browsers to interpret and display the information correctly. HTML is the foundation of web development and is essential for creating and designing websites.
2.
Does the following C++ script have errors?
#include "stdafx.h"
#include <iostream>
using namespace std;
int main() {
cout<<"Hello world"<<endl
return 0;
}
Correct Answer
A. Yes
Explanation
The given C++ script has errors because there is a missing semicolon (;) after the cout statement.
3.
In Java, a method is a container that holds classes.
Correct Answer
B. False
Explanation
In Java, a method is not a container that holds classes. A method is a block of code that performs a specific task and is defined within a class. It is used to encapsulate a set of instructions that can be called and executed when needed. Classes, on the other hand, are used to define objects and their properties and behaviors. Therefore, the statement that a method is a container that holds classes is incorrect.
4.
<h1>Text</h1> is the correct way of making a header in HTML.
Correct Answer
A. True
Explanation
In HTML, the tag is used to create a header, and it is the correct way to make a header in HTML. The tag represents the highest level of heading and is typically used for main headings on a webpage. It is important to use the appropriate HTML tags to structure and format the content correctly, and in this case, using the tag for a header is the correct approach.
5.
Which of the following is the correct way of making a string in Java?
Correct Answer
D. String text = "text";
Explanation
The correct way of making a string in Java is by using double quotation marks. Therefore, the correct answer is "String text = "text";".
6.
Which of the following is the correct way to use the standard namespace in C++?
Correct Answer
A. Using namespace std;
Explanation
The correct way to use the standard namespace in C++ is by using the statement "using namespace std;". This statement allows you to access all the standard library functions and objects without having to specify the "std::" prefix every time.
7.
Is this HTML code correct?
<html>
<head>
<title>Title</title>
</head>
<h1>Header</h1>
<p>Paragraph</p>
</html>
Correct Answer
B. No
Explanation
The HTML code is not correct because the and elements should be placed inside the element, not directly inside the element.
8.
Is it less bytes to use:
long l = 100;
then:
int i = 10;
Correct Answer
B. No
Explanation
The given answer "No" is correct because both variables, long and int, occupy the same amount of memory in Java. The difference lies in the range of values they can hold. A long variable can store larger values than an int variable, but it does not necessarily use more memory. In this case, both variables are assigned small values, so they would occupy the same number of bytes.
9.
Is this the correct way to make an object in Java?
Class class = new Class();
Correct Answer
B. False
Explanation
In Java, "Class" is a reserved keyword used for reflection to obtain metadata about classes at runtime. Therefore, naming a variable "class" may lead to confusion. A correct way to instantiate an object of a class named "Class" would be:
Class className = new Class();
10.
Is this how you import something in C++?
#include <string>
Correct Answer
B. Yes
Explanation
In C++, the #include directive is used to import libraries or header files, and <string> is a standard C++ header file that provides functions and classes for working with strings. So, #include <string> is used to include the functionality related to strings in your C++ program.