Answer:
8 times
Explanation:
The while is execute again and again until the condition is TRUE.
In the question:
the value of i=2, when program enter the loop it check the condition when
2 <= 16, condition TRUE. it update the value i = 4.
Again the loop check condition, 4 <= 16, condition TRUE, i become 6 and so on...
4,6,8,10,12,14,16
when i = 16 loop condition is also TRUE. 16 <= 16. So, it again run the loop and i become 18.
then, the loop condition false and it exit the loop.
so, i run until 18
4,6,8,10,12,14,16,18
Therefore, the answer is 8 times.
. What happens when you serialize an object? What happens when you deserialize an object?
Answer: serialize means to convert a java object to byte stream and deserialize means to convert the byte stream again to java object.
Explanation:
Both of these functions are present in java.io library. we perform serviceable to java object in order to send it across the network where we can it can be stored in the hard disk because java object cannot be sent across the network to be stored in hard disks. Similarly deserialize enable to get the java object from the byte stream across the network
The syntax for accessing a class (struct) member using the operator -> is ____.
A.
pointerVariableName.classMemberName
B.
pointerVariableName->classMemberName
C.
&pointerVariableName.classMemberName
Answer: pointerVariableName->classMemberName
Explanation:
Here the pointerVariableName can be used to access a classMemberName. This ca also be written as (*pointerVariableName).classMemberName.
Answer:
B. pointerVariableName->classMemberName
Explanation:
The syntax for accessing a class (struct) member using the operator -> is pointerVariableName->classMemberName.
put is a function to __________.
Ex:cout.put(aChar);
A)get one next character from the input stream
B)input one next character to the input stream
C)put one next character to the output stream
D)output one next character from the input stream
Answer: put one next character to the output stream
Explanation:
put is a member of the output stream class. So using the code cout which means displaying and the put method which places a character to the output stream. It is in use in C++.
Write a C++ program that reads four double precision numbersfrom the screen using the variables x1,x2,x3 and x4. The programthen adds them together multiplies the sum by the quantityx1*x2*x3*x4 and then prints the final result to the screen withappropriate label.
Answer:
#include <bits/stdc++.h>
using namespace std;
int main() {
double x1,x2,x3,x4,sum,output;//declaring variables..
cout<<"Enter the variables"<<endl;
cin>>x1>>x2>>x3>>x4;//taking input of the time...
sum=x1+x2+x3+x4;//calculating the sum...
output=sum*x1*x2*x3*x4;
cout<<"The asnwer is "<<output<<endl;//printing the temperature..
return 0;
}
Explanation:
I have taken 6 double variables sum to hold the sum of variables and output is to hold the answer.Then calculating printing the output.
Built-in user accounts include only the Administrator account created during Windows installation True False
Answer: True
Explanation:
When an OS is installed, the first account created is the built -in user account. It is the administrator account for the purpose of recovery and to facilitate the set up.
The statement is false; there are several built-in user accounts in Windows besides the Administrator account, including Guest, System, and service accounts such as Network Service and Local Service.
The statement that built-in user accounts in Windows include only the Administrator account created during Windows installation is false. Windows operating systems usually come with several predefined accounts for system management and security purposes.
Beyond the Administrator account, there is also the 'Guest' account, which is normally disabled by default but designed for users who require temporary access to the computer. Moreover, there is the 'System' account, which is used by the operating system to manage system services and the 'Network Service' and 'Local Service' accounts which have specific privileges to run particular system services without requiring the full privileges of the Administrator account.
These built-in accounts are an essential part of Windows security management, with each serving different roles and representing different levels of access permissions within the operating system.
When used as parameters, _________ variables allow a function to access the parameter’s
original argument.
Answer: reference
Explanation:
In an function if the variables are passed as reference variables this means that the variables are pointing to the original arguments.So the changes made in the function on the reference variables will be reflected back on the original arguments.
For example:-
#include<iostream>
using namespace std;
void swap(&int f,&int s)
{
int t=f;
f=s;
s =temp;
}
int main()
{
int n,m;
n=45;
m=85;
swap(n,m);
cout<<n<<" "<<m;
return 0;
}
the values of m and n will get swapped.
#include<iostream>
using namespace std;
void swapv(int f,int s)
{
int t=f;
f=s;
s=temp;
}
int main()
{
int n,m;
n=45;
m=85;
swapv(n,m);
cout<<n<<" "<<m;
return 0;
}
In this program the values of m and n will not get swapped because they are passed by value.So duplicate copies of m and n will be created and manipulation will be done on them.
With theuse of which of the following, we reason from a generalization to aspecific conclusion?
a- Analogy
b- Logic
c- Induction
d- Deduction
Answer:
d-Deduction
Explanation:
Deduction
In deductive inference, we maintain a hypothesis and we predict its implications on the basis of it. That is, we predict what the results should be if the theory were right. We go from the general theory to the particular observations.
Induction
We're going from the specific to the general inductive inference. We make a lot of observations, discern a pattern, generalize and infer an explanation or theory.
Analogy
An analogy is a comparison between two objects or object systems, highlighting the respects in which they are considered to be similar.
Logic
Science dealing with the principles and criteria of validity of inference and demonstration that is science of formal rules of reasoning.
The expression vecCont.empty() empties the vector container of all elements.
True
False
Answer:
False
Explanation:
Vector is a similar to dynamic array which has the ability to resize itself automatically.
empty() is a function used in the vector.
It is used to check the vector is empty or not.
it does not delete the element in vector, it just check the vector is empty or not, if vector empty it gives a Boolean value True other wise False.
Therefore, the answer is False.
If you want to stop a loop before it goes through all its iterations, the break statement may be used.
True False
Final answer:
The break statement is utilized to stop a loop prematurely in programming by exiting the loop before all iterations are completed.
Explanation:
The break statement in programming is used to stop a loop before it completes all its iterations. If the condition for the loop is True, the loop will keep running until the break statement is encountered, which then exits the loop.
Using a break statement helps in controlling the flow of the loop and is particularly useful in scenarios where you need to exit a loop prematurely based on certain conditions.
By strategically placing the break statement within a loop, you can efficiently manage when the loop should terminate, preventing it from running indefinitely.
Write a C++ programthat returns the type of a triangle (scalene, equilateral,or
isosceles). The input tothe program should consist of the lengths of thetriangle's
3 sides.
Answer:
#include<iostream>
using namespace std;
int main(){
//initialize
int a, b,c;
//print the message
cout<<"Enter the three sides of the triangle: "<<endl;
//store in the variables
cin>>a>>b>>c;
//if-else statement for checking the conditions
if(a == b && b == c && a == c){
cout<<"\nThe triangle is equilateral";
}else if(a != b && b != c && a != c ){
cout<<"\nThe triangle is scalene";
}else{
cout<<"\nThe triangle is isosceles";
}
return 0;
}
Explanation:
Create the main function and declare the three variables for the length of the sides of the triangle.
print the message on the screen for the user. Then the user enters the values and its store in the variables a, b, and c.
use the if-else statement for checking the conditions.
Equilateral triangle: all sides of the triangle are equal.
if condition true, print the equilateral triangle.
Scalene triangle: all sides of the triangle are not equal.
if condition true, print the Scalene triangle.
if both conditions is not true, then, the program moves to else part and print isosceles.
The continue statement _________.
A)Disables the loop
B)Skips the loop
C)Transfer control to another code segment in the loop
D)Terminates the loop
Answer: C) Transfer control to another code
Explanation: Continue statement is a type of statement for the controlling of the loop. It has the main function of execution of the next or another iteration. If the continue statement is executed inside a loop then the current execution of the statement will stop and jump on the next statement immediately and will transfer the loop there.
You can initialize more than one variable in a for loop by placing a(n) ____ between the separate statements.
a.
equal sign
b.
comma
c.
period
d.
semicolon
Answer:
comma
Explanation:
The for loop is used to execute the specific statement again and again until the condition is false.
The syntax:
for(initialization;condition;increment/decrement)
{
statement;
}
In the initialization, we an initialize more than one variable by using the 'comma' as separator.
similarly for condition and increment/decrement part as well.
for example:
for(int x = 0,y = 0;x<5,y<5;x++,y++)
{
statement;
}
we can used as many as possible by using comma
Write a test program that prompts the user to enter two strings and, if they are anagrams, displays is an anagram; otherwise, it displays is not an anagram
Answer:-Following is the program for the checking if 2 strings are anagram in c++:-
#include<bits/stdc++.h>
using namespace std;
int main()
{
string ana1,ana2;//declaring two strings.
int an1[256]={},an2[256]={};//declare two count arrays of size 256 an1 and an2.
bool test=true;//taking a bool variable test = true for displaying the result..
cout<<"Enter both the strings"<<endl;
cin>>ana1>>ana2;//prompting the strings..
for(int i=0;ana1[i]&ana2[i];i++) // iterating over both the strings.
{
an1[ana1[i]]++;//increasing the count of the characters as per their ascii values in count array an1.
an2[ana2[i]]++;//increasing the count of the characters as per their ascii values in count array an2.
}
for(int i=0;i<256;i++)//iterating over the count arrays..
{
if(an1[i]!=an2[i])//condition for not anagram.
{
cout<<"not an anagram"<<endl;
test=false;//making test false..
break;//coming out of the loop.
}
}
if(test)//if test is true only then printing..
cout<<"is an anagram"<<endl;
return 0;
}
Explanation:-
A string is said to be an anagram string of other string if it has same characters but in different order.
for example:-
string 1="raman"
string 2="manar"
string 2 is an anagram of string 1.
In the STL container list, the functionpop_front does which of the following?
a. inserts element at the beginning of the list
b. inserts element at the end of the list
c. returns the first element
d. removes the last element from the list
Answer: Returns the first element
Explanation:
The functionpop_front always gives us the first element as it removes the first element from the front of the list.
Instructions
Write a program that prompts the user to input a positive integer. It should then output a message indicating whether the number is a prime number. (Note: An even number is prime if it is 2. An odd integer is prime if it is not divisible by any odd integer less than or equal to the square root of the number.)
Answer: The c++ program to determine if the input number is prime is given below.
#include<iostream>
#include<math.h>
using namespace std;
int main() {
int num, n;
int prime=0;
int i=3;
cout<<"This program determines whether the number is prime." <<endl;
do
{
cout<<"Enter any positive number."<<endl;
cin>>num;
if(num<=0)
cout<<"Invalid input. Enter any positive number."<<endl;
}while(num<=0);
n=sqrt(num);
if((num==1)||(num==2))
{
cout<<"The input "<<num<<" is prime."<<endl;
}
else if(num%2==0)
{
cout<<"The input "<<num<<" is not prime."<<endl;
}
else
{
do
{
if(num%i == 0)
prime += 1;
i++;
}while(i<n);
if(prime>1)
cout<<"The input "<<num<<" is not prime."<<endl;
else
cout<<"The input "<<num<<" is prime."<<endl;
}
return 0;
}
OUTPUT
This program determines whether the number is prime.
Enter any positive number.
-9
Invalid input. Enter any positive number.
Enter any positive number.
0
Invalid input. Enter any positive number.
Enter any positive number.
47
The input 47 is prime.
Explanation: This program accepts numbers beginning from 1. Any number less than 1 is considered as invalid input.
The test for prime is done using multiple if-else statements.
If number is even, it is not prime. Any number divisible by 2 is an even number. Except 2, it is even but also prime since it is divisible by itself only.
For odd numbers, number is divided by all odd numbers beginning from 3 till square root of the input. We first calculate and store square root of input.
n=sqrt(num);
An integer variable prime is initialized to 0. This variable is incremented each time the number is divisible by other number.
int prime=0;
do
{
if(num%i == 0)
prime += 1;
i++;
}while(i<n);
Since prime number is only divisible by itself, all the prime numbers undergo this condition and hence, value of prime variable becomes 1.
The 0 and 1 values of variable prime indicate prime number. Other greater values indicate input is not prime.
if(prime>1)
cout<<"The input "<<num<<" is not prime."<<endl;
else
cout<<"The input "<<num<<" is prime."<<endl;
Python program checks if a positive integer is prime; uses a separate function to perform the primality test.
Here's a Python program that prompts the user to input a positive integer and then outputs a message indicating whether the number is a prime number:
```python
import math
def is_prime(n):
if n <= 1:
return False
if n == 2:
return True
if n % 2 == 0:
return False
max_divisor = math.isqrt(n)
for i in range(3, max_divisor + 1, 2):
if n % i == 0:
return False
return True
def main():
num = int(input("Enter a positive integer: "))
if is_prime(num):
print(f"{num} is a prime number.")
else:
print(f"{num} is not a prime number.")
if __name__ == "__main__":
main()
```
Explanation:
1. The `is_prime` function checks whether the given number `n` is a prime number.
2. It first checks if the number is less than or equal to 1, in which case it returns False.
3. It then handles the case for the number 2 separately, as it is a prime number.
4. For odd numbers greater than 2, it iterates through odd divisors up to the square root of the number to check for divisibility.
5. If the number is divisible by any of these odd divisors, it returns False; otherwise, it returns True.
6. In the `main` function, the user is prompted to input a positive integer, and the result of the `is_prime` function is printed accordingly.
The true or false questions.
The start directory of find is optional
Answer:
true
Explanation:
Find command syntax is as follows:
find [starting directory] [options]
For example:
$ find /tmp -name test
$ find . -name demo -print
$ find
As we can see in the last example, starting-directory and options can both be omitted and it will still be a valid command. When the start directory is omitted, it defaults to the current directory.
What are the details of frame transmission andreception that LAN interface handles?
Answer and Explanation:
LAN transmission and reception handles the given bellow details
LAN adds hardware address and use for error detection codes Use DMA to copy frame data directly from main memoryit follows access rule then transmission is in progressit also check the address where data is sent on incoming framesif the destination address completely match with location address a copy of the frame is passed to the computer
in LAN system a single pocket is sent to the one or more nodes
Convot the following biliary number into decimal form using any method ? (1010.100)2
Answer:
10.5
Explanation:
1010.1
Handy method you can find searching google images, and I originally learned
from some guy teaching an online java course.
.1 --> 1 * 2^(-1) = 0.5
0 --> 0 * 2^(0) = 0
1 --> 1 * 2^(1) = 2
0 --> 0 * 2^(2) = 0
1 --> 1 * 2^(3) = 8
0.5 + 2 + 8 = 10.5
If for some reason it isn't very clear, just take the number, (x) and multiply it
by two to the power of the position it is in. (e.g. first number before decimal point is 0, second 1, etc).
Develop a program that will calculate the area and perimeter of a rectangle. The length and width can be given as constant.(LENGTH= 8 WIDTH=8).
Answer:
#include <iostream>
using namespace std;
int main()
{
int length = 8;
int width = 8;
int perimeter = 2*(length + width);
int area = length * width;
cout<<"The perimeter is "<<perimeter<<endl;
cout<<"The area is "<<area<<endl;
return 0;
}
Explanation:
include the library iostream for using the input/output instructions in the c++ programming.
Create the main function and define the variable length and width with values.
Then, use the formula for calculating the perimeter and area of rectangle.
[tex]perimeter = 2*(length + width)[/tex]
[tex]area = length * width[/tex]
and store in the variables and finally print the output.
What is the value of the following expression? (false || (4-3 && 6))
true
false
0
illegal syntax
Answer:
true
Explanation:
The operator '||' is called the OR operator. it is used in between the two Boolean values.
OR operator has four possible values:
First Boolean is TRUE and second Boolean is TRUE, result will be TRUE.
First Boolean is TRUE and second Boolean is FALSE, result will be TRUE.
First Boolean is FALSE and second Boolean is TRUE, result will be TRUE.
First Boolean is FALSE and second Boolean is FALSE, result will be FALSE.
consider the expression:
(false || (4-3 && 6))
the second expression (4-3 && 6) gives Boolean TRUE, because their is no point for condition false.
so, (false || True) gives TRUE result.
Final answer:
False. The expression (false || (4-3 && 6)) will result in false because the '&&' operator takes precedence over '||', and 4-3 evaluates to 1 which is considered 'true' in Boolean logic.
Explanation:
The value of the expression (false || (4-3 && 6)) is true. In this expression, ((4-3 && 6)) is evaluated first. Since 4-3 is 1, which is true, and 6 is also a non-zero number, which is considered true, the result of that part of the expression is true because both operands are true for the && (AND) operator. Then we have 'false || true', and since '||' is the OR operator, the expression is true if either side is true. Hence, the entire expression evaluates to true.
SQL commands can be classified into three types. Which isNOT an SQL command type?
1 DDL
2 DML
3 DGL
4 DCL
Answer:
DGL
Explanation:
SQL stands for structured query language which is used to interface with the database.
Let discuss the options:
1. DDL: This comes in the category of SQL and it stands for data definition language. This allows using CREATE, DELETE, DROP, ALTER, etc. of the table in the database.
2. DML: This comes in the category of SQL and it stands for data manipulation
language. This allows the user to use the INSERT, DELETE, UPDATE command which help to manipulate the data in the table.
3. DGL: This is not a part of SQL.
4. DCL: This comes in the category of SQL and it stands for data control language which allows the user to use ALTER PASSWORD, GRANT, REVOKE like command which helps the user to control access the data in the database.
Therefore, the correct answer is DGL.
The resources assigned to them will significantlyinfluences the duration of most activities.
True
False
Explanation:
Assigned to whom? what resources??
what is a networking.give types also?
Answer: Networking is the method of exchanging of the information or data through a shared medium with different nodes in a networking system. Different types of networking are :-
LANWANMANPANExplanation: Networking forms the basic connection for sharing of the data between different nodes on the same medium . There are different types of network that are present according to the certain requirements are as follows:-
LAN(Local area network)-consists of a network established at a single site, particularly for an single building or infrastructure.WAN(Wide area network)-it is for a very wide area and also a combination of many MAN's and LAN's together . MAN(Metropolitan area network)-it is larger than a LAN and particularly limited to a single building or site such as a college building or office building.PAN(Personal area network)-computer network for an individual person within a building.
___ defines a series of standards for encoding audio and video in digital form for storage or transmission. Most of these standards include compression, often lossy compression.
a) JPEG b) ANSI c) ISO d) MPEG
Answer:
d) MPEG
Explanation:
MPEG stands for Moving Picture Experts Group.
It defines standards for audio and video compression on digital form for storage and transmission.
JPEG (Joint Photographic Experts Group)ANSI (American National Standards Institute)ISO ( International Organization for Standardization)are also international standards but they are not related to dogotal video compression.
23. Which of the following is most likely to violate a FIFO queue? A) supermarket with no express lanes B) car repair garage C) emergency room D) fast-food restaurant E) All of the above are equally likely to violate a FIFO queue.
Answer:
emergency room- C)
What is the Moore's law
Answer:
Hi, in the law of Moore we can express aproxitmaly for each two years is duplicated the number of transitors in a microprocessor.
Explanation:
In around 26 years the number of transitors has increased about 3200 times, a transitor is a way to regulate the current voltage flow and can be act like a switch for an electronic signal.
I hope it's help you.
Answer:
The power of microprocessors would double every two years
Explanation:
When a function uses a mixture of parameters with and without default arguments,
the parameters with default arguments must be defined _________.
Answer: after the required parameters.
Explanation:
Default arguments in a function should be defined after the required parameters because the required parameters are necessary but default arguments are not. If mixed parameters are allowed it will be very hard for the compiler to to judge which value matches which argument so there will be syntax error.
We can include following item(s) during configuration itemidentification:
a) User Manuals andDocumentations
b) Source Code
c) Software RequirementSpecifications
d) All of the above
Answer:
d) All of the above
Explanation:
In configuration management, the Identify configuration items, work products and related components are present.
All the documents which are related to the work,the manuals how that the system works are present in the configuration item identification.The source code that is implement for the functioning of the products.These are implemented at the time of generation of products.Software Requirement Specifications are also specified by SRS it is present in design stage of software development life cycle,it is also a part of configuration item identification.Write a program that takes the radius of a sphere (a floating-point number) as input and then outputs the sphere’s: Diameter (2 × radius) Circumference (diameter × π) Surface area (4 × π × radius × radius) Volume (4/3 × π × radius × radius × radius)
Final answer:
To calculate the properties of a sphere, such as diameter, circumference, surface area, and volume, we can use a Python program that takes the radius as input and applies mathematical formulae for a sphere.
Explanation:
To create a program that calculates the properties of a sphere, we will use the following formulae for a sphere: diameter is 2 × radius, circumference is diameter × π (pi), surface area is 4 × π × radius², and volume is (4/3) × π × radius³.
Example Code in Python
Here is a simple Python program for calculating the properties of a sphere:
import math
# Input: radius of a sphere
def sphere_properties(radius):
diameter = 2 * radius
circumference = diameter * math.pi
surface_area = 4 * math.pi * radius ** 2
volume = (4/3) * math.pi * radius ** 3
return diameter, circumference, surface_area, volume
# Example usage:
radius = float(input("Enter the radius of the sphere: "))
properties = sphere_properties(radius)
print(f"Diameter: {properties[0]}")
print(f"Circumference: {properties[1]}")
print(f"Surface Area: {properties[2]}")
print(f"Volume: {properties[3]}")
This program prompts the user to input the radius as a floating-point number, and then outputs the calculated diameter, circumference, surface area, and volume of the sphere.
What are the advantages in implementing a language with apure interpreter?
Answer:
The advantage of implementing a language with pure interpreter is source level debugging implementation operations are easy in a language with pure interpreter because all run time error messages refers to source level unit.For example-array index out of bound.