Answer:
4
Explanation:
The loop is used to execute the part of code or statement again and again until a condition is not true.
syntax of for loop:
for(initialize; condition; increment/decrement){
statement;
}
in the question, the value of n is zero.
then, for loop check the condition k<2, initially the value of k is zero. so, the condition is true and execute the code n = 0 +2=2
Then, k is increment by 1. so, the value of k is 1.
then, again loop run and check the condition 1<2, it true. then n = 2+2=4.
then, k is increment by 1. so, the value of k is 2.
Then, again check the condition 2<2, condition false and program terminate the loop and finally print the value 4.
What is wrong with the following program? #include //Line 1 namespace aaa //Line 2 { const int X = 0; //Line 3 double y; //Line 4 } using namespace std; //Line 5 int main() //Line 6 { y = 34.50; //Line 7 cout << "X = " << X << ", y = " << y << endl; //Line 8 return 0; //Line 9 }
Answer:
#include //Line 1
namespace aaa //Line 2
{ const int X = 0; //Line 3
double y; //Line 4
}
using namespace std; //Line 5
int main() //Line 6
{ y = 34.50; //Line 7
cout << "X = " << X << ", y = " << y << endl; //Line 8
return 0; //Line 9
}
In Line 1, No header file is present,so it will print output as cout and endl is not defined.
we should include <iostream> header file in line 1
Lines 7 and 8 are incorrect.
X and y variables in aaa namespace are stated. So we can't use it any other namespace(std), but here y is initialized to 34.50 and x is printed in other namespace rather than stated.
Inserting a new value in the middle of a singly lnked list requires changing the pinter of the list node that follows the new node.
A.) True
B) False
Answer:
A.) True
Explanation:
Inserting a new value in the middle of a singly lnked list requires changing the pinter of the list node that follows the new node.
Convert each of the following bit patterns into whole numbers. Assume the values are stored
using the twos complement bit model.
00101101
01011010
10010001
11100011
Answer:
1. 45
2. 90
3. 161
4. 227
Explanation:
Binary starts off with the first bit equaling 1 and then each subsequent bit being double the previous bit from right to left, so.
128, 64, 32, 16, 8, 4, 2, 1 In this example. If you imagine each 1 or 0 being and on or off for the value it's related to, you just add the numbers together that are on (with a 1 on them)
All ofthe following are correct EXCEPT one option when it comes towriting disappointing news letters. Identify theexception.
a- Avoidthe use of negative words or phrases.
b- Avoid makingsuppositions that are not likely to occur.
c- Avoida meaningless closing.
d- Avoid aneutral or buffered opening.
Answer: d) Avoid a neutral or buffered opening
Explanation: A newsletter is a piece of a report that is having knowledge about the activities of the business ,organizations,their members and owner etc.When the news letter contains contains a disappointing news it should not not have a buffered or neutral opening .The start of the news letter should not be impartial or prejudiced to make bad opening. Therefore, option(d)is the correct option.
What is Peer-to-PeerNetworking?
Answer:
Peer-to-peer networking is a distributed application where computers are get connected to each other and share resources. Peer-to-peer connection can also be an ad-hoc connection as couple of computers connected and sharing files and information with each other. The main advantages of this network is that it is less expensive and easy to set up. Wireless and wired both networks can be configured as peer-to-peer networking.
Testing and Configuration Management
Answer:
Test management most commonly refers to the activity of managing the computer software testing process. A test management tool is software used to manage tests (automated or manual) that have been previously specified by a test procedure. It is often associated with automation software.
The Configuration Management is a process of establishing and maintaining a product’s performance, functional and physical attributes with its requirements, design, and functionalities through its life.
In Configuration Management we making sure that these items are managed carefully in entire project & product life cycle. It allows Software Tester to manage their testware and test outputs using same configuration management mechanisms.
What application of encryption verifies that a document was sent by the person it says it is from? Select one: a. Digital rights management b. Asymmetric encryption c. Cryptographic hash d. Digital signatures
Answer:
D.
Explanation:
a. is about delivering material only to who is entitled to it
b. is about encrypting and decrypting with two different keys
c. is about proving the integrity of a document (that it hasn't been changed).
d. is a cryptographic hash in combination with private key, so that provides both document integrity and non-repudiation
What width would you choose for the pdf?
Answer:
I would go for a width of 8.27 inches
Explanation:
The width of your PDF file depends on the project you are working on as well as your use case. Putting that aside, you are always better off making the dimensions of your PDF the same as the dimensions of A4 printing paper, which is 8.27 inches or 21 centimeters (2480 pixels). This is because A4 is the most common printing paper used and will make organization and printing less of a hassle.
I hope this answered your question. If you have any more questions feel free to ask away at Brainly.
. IDT stands for ______________________.
? interrupt descriptor table
? individual descriptor table
? inline data table
? interrupt descriptor table
Answer:
Interrupt descriptor table
Explanation:
In x86 architecture we use Interrupt descriptor table(IDT) which is data structure to produce an Interrupt vector table(IVT). The processor uses the IDT to form the right reaction to interrupts and exceptions.
It is the equivalent of the Protected mode to the (Interrupt Vector Table(IVT)) Real mode stating at the position of Interrupt Service Routines (ISR) (one per interrupt vector).
Address and size of IDT is kept in the CPU's IDTR register. LIDT, SIDT instructions are used for storing.
You may declare an unlimited number of variables in a statement as long as the variables are ____.
a.
initialized to the same value
b.
the same data type
c.
properly commented
d.
floating point numbers
Answer:
b. the same data type
Explanation:
Any number of variables can be declared in a statement as long as the variables have the same data type. For example:
1) int a,b,c,d,e;
Here each of the declared variables a,b,c,d,e have the type int.
2) char p,q,r,s,t,u,v,w;
In this case variables p to w all have the type char.
3) float x,y,z;
x,y and z are all of type float.
Create a stack with three integers and then use .toarray to copy it to an array.
Answer:
import java.util.*;
import java.lang.*;
import java.io.*;
class Codechef
{
public static void main (String[] args)
{
Stack<Integer> mat=new Stack<Integer>();
mat.add(1);
mat.add(3);
mat.add(6);
System.out.println(mat);
Object [] a=mat.toArray();
for(int i=0;i<a.length;i++)
System.out.println(a[i]);
}
}
Explanation:
An integer type stack st is created;
1,3 and 6 are added to the stack.
printing the contents of the stack.
array a is created form the stack using toArray().
Then printing the array.
Explain the difference between the prefix and postfix forms of the increment operator.
Answer:
The prefix form of increment operator is ++a, for the variable a.
it first increments the value of the variable and substitutes the incremented value of the variable to the expression.The postfix form of increment operator is a++, for the variable a.
it substitutes the existing value of the variable to the expression and then increments the value.Explanation:
Let a = 6.
++a + 5 = 12.
but
a++ + 5 =11.
. A register in a computer has a of bits. How many unique combinations can be stored in the register?
Answer:
The number of unique combinations stored in the register totally dependent upon the number of bits the register can hold.
Explanation:
Suppose if the register is 2-bit.Then it can have (2²) 4 unique combinations of the bits and those combinations are 00,01,10,11.For a 3 bit register there are (2³) or 8 unique combinations those are 000,001,010,011,100,101,110,111.So for a n-bit register there can be 2ⁿ unique combinations there.
The while loop has two important parts: a condition that is tested and a statement or block of statements that is repeated as long as the expression ________.
Answer:
TRUE
Explanation:
The while loop is used to run the block of statement again and again until condition is TRUE. if condition false program terminate the loop and execute the next of while statement.
syntax:
initialize;
while(condition)
{
statement;
increment/decrement;
)
when condition is TRUE, the block of statement execute again and again.
A while loop in programming has a condition and contents (block of statements). As long as the condition holds true, the loop keeps repeating the contents. The loop stops when the condition turns false.
Explanation:The while loop in programming has two key components. These are a condition that the system checks before each loop, and some content (statements or blocks of statements) that get executed as long as the condition holds true. The sentence would be completed as 'repeated as long as the expression is true' because the while loop continues until the condition becomes false.
Learn more about While Loop here:https://brainly.com/question/32887923
#SPJ6
Describe the phases through which a program goes during its lifecycle. explain your answer with the help of diagram
Answer:
The image of the life cycle of program is attached please refer it.
1. Requirement:- When there is a problem the there is need of program.
2. Analysis:- In this phase all the requirements are collected.
3. Design:- It is an important phase in the program life cycle .The design of problem is generated.
4. Coding:- In this phase the program is coded as per the design.
5. Testing:- In this phase the testing of the program is done to make sure that the program is working properly.
6. Deployment:- In this phase the program comes into the use.
T F All static local variables are initialized to −1 by default.
Answer:
F
Explanation:
they are initialized to 0 by default.static variables are shared variables
Please add thenodes given below to construct the AVL tree show all the necessarysteps,
30,33,37,18,23,34,15,38,40,17
Answer:
30,33,37,18,23,34,15,38,40,17
To construct the AVL tree, follow these steps and diagrams are shown in the image:
• Add 30 to the tree as the root node. Then add 33 as the right child because of 33 is greater than 30 and AVL tree is a binary search tree.
• Then add 37 as the right child of 33. Here the balance factor of node 30 becomes 0-2 = -2, unbalanced.
Use RR rotation, make node 33 the root node, 30 as the left child of 33 and 37 as the right child of 33.
• Now add 18 as the left child of 30. And 23 as the right child of 18. Here the balance factor of 30 becomes 2-0 = 2. It’s unbalanced.
Use LR rotation, make 23 the parent of 18 and 30.
• Now add 34 as the left child of 37 and 15 as the left child of 18. Add 38 as the right child of 37. And then add 40 as the right child of 38.
• Now adding 17 as the right child of 15 makes the tree unbalanced at 18.
Use LR rotation, make 17 as the parent of 15 and 18.
Explanation:
The balance factor of a node can be either 0,1 or -1. Else the tree is called unbalanced at the node.
If the inserted node is in the left subtree of the left subtree of the unbalance node, then perform LL rotation.
If the inserted node is in the right subtree of the right subtree of the unbalance node, then perform RR rotation.
If the inserted node is in the left subtree of the right subtree of the unbalance node, then perform RL rotation.
If the inserted node is in the right subtree of the left subtree of the unbalance node, then perform LR rotation.
What are the tripleconstraints?
a) Time, Schedule, and Cost
b) Time, quality and money
c) Time, money and WBS
d) Schedule, quantity and quality
Answer:
a) Time, Schedule, and Cost
Explanation:
Great question, it is always good to ask away and get rid of any doubts that you may be having.
The triple constraints are represented by a triangle whose sides are three a different aspects which represent a Quality Project when combined. These three aspects are Time, Schedule (Scope), and Cost. This model has been used by companies since the 1950's, and is still widely used in today's companies.
I hope this answered your question. If you have any more questions feel free to ask away at Brainly.
Differentiatebetween:
a) Firmware Computers and Virtual Computers
b) Early binding and Late Binding
c) BNF and EBNF
Answer:
a)Firmware Computers and Virtual Computers
Firmware Computers-A type of computer program that offers low-level device-specific hardware control.Once installed, the firmware is generally altered rarely and only by the manufacturer's updates. Firmware loss can often lead to the loss of function of a hardware device depending completely on the scenario.
Virtual Computers-The most common purpose of the software is to describe a program/piece of data to be changed, viewed or otherwise interacted by the user most often.A software or firmware upgrade allows a continuous change — generally a feature enhancement, performance enhancement, or error correction
b) Early binding and Late Binding
Early binding-The compiler matches the function call at compile time in early binding with the right function definition. It can be called as Compile-time Binding/Static Binding. The compiler defaults to the feature definition called during the moment of compilation. So, because of early binding, all the feature calls you've studied up to now.
Late binding-The compiler matches the function call at run-time with the right function definition in the event of late binding. It is also referred to as Run-time Binding.
The compiler defines the object type at run-time in late binding and then checks the function definition with the function call.
c) BNF and EBNF
BNF(Backus – Naur form)-It is used to officially describe a language's grammar, so there is no discrepancy or ambiguity about what is permitted and what is not. In reality, BNF is so unambiguous that there is a lot of mathematical theory around this kind of grammar, and you can effectively build a parser mechanically for a language with a BNF grammar.
EBNF(Extended Backus–Naur form)-It is used to convey a grammar that is context-free. EBNF is used to describe formally a formal language such as a language for computer programming. This is extension metasyntax notation of the fundamental Backus – Naur form (BNF).
Answer:
jfff
Explanation:
List and define the types of System Software. How does System Software differ from Applications Software?
Answer: Operating system, Device driver, Firmware, Translator and Utility are the categories of system software.
Explanation:
Software can be either System software or Application software.
System software includes software to manage resources of the system such as hardware, input/output, and other machine level operations such as translation and compilation of programs.
System software can be categorized into
1 – Operating system: OS forms the interface between the user and hardware. OS hides the complexities of the hardware and provides a graphical user interface to the user for interaction with the system.
2 – Device driver: Every device has its own device driver. The driver forms the interface between the OS and the actual device. The operating system assigns the duties of the device to its driver.
3 – Firmware: This software is programmed on the memory chip. Any upgrades to this software is done by replacing the existing chip with new chips. Hence, this software is firm as per the name unlike other software which can be updated without replacing any component.
4 – Translator: This software translates programming language code to machine language instructions. Compilers, assemblers and interpreters are the types of translator. Translator may either translate complete code or one line of code at a time.
5 – Utilities – This software performs diagnostic and maintenance of the system. Examples include anti-virus, disk partition, data recovery, and the like.
System software vs Application software
1- System software manages computer resources.
Application software performs a particular task for the end user.
2- Installed according to the operating system used.
Applications are installed based on user’s needs.
3- System software works in the background and hence, no user interaction needed.
Application software are intended for the user and enable user interaction.
4- System software execute independently irrespective of applications.
Application software can only execute on the system software.
5- Examples include device driver, data recovery, etc.
Applications include excel, database, etc.
It is legal to have a function with no arguments. TRUE FALSE
Answer:
TRUE
Explanation:
A parameter is a variable in a method definition and an argument is the value to this variable that gets passed to the function.
public void CalculateAdd(int i, int j)
{
Console.WriteLine(i+j);
}
In the above defined function, i and j are parameters .
We pass arguments when the function is called.
CalculateAdd(10,20);
10 and 20 are arguments which are passed to the above function to calculate addition operation.
If a function has no parameters, then it is legal to have no arguments.
For example,
public void PrintMessage()
{
Console.WriteLine("Hello");
}
The above function has no parameters. So, you can call the function without passing any arguments to it as shown below.
PrintMessage();
All the read/write heads a hard disk are controlled by a(n) ____ which moves the read/write heads across the disk surfaces in unison. a. controller c. formatter b. actuator d. processor
Answer: b. actuator
Explanation:
We know that a RW head ( or also known as read/write head) is a component of device which is usually appeared on the hard drive which is used to read and write data by the hard drive's disk . When data required to be read or write, the read/write arm is regulated by actuator.
[An actuator is a part of a device that is mainly responsible for moving and controlling a mechanism or system.]
Hence, All the read/write heads a hard disk are controlled by an actuator .
Write a loop that sets each array element to the sum of itself and the next element, except for the last element which stays the same. Be careful not to index beyond the last element. Ex: Initial scores: 10, 20, 30, 40 Scores after the loop: 30, 50, 70, 40
Answer:
JAVA program for the given question is as below.
public class MyProgram {
public static void main(String args[]) {
int len = 5;
int[] scores = new int[len];
scores[0] = 7;
scores[1] = 10;
scores[2] = 11;
scores[3] = 9;
scores[4] = 10;
System.out.print("This program sets each element to the sum of itself and the next element except the last element.");
System.out.println();
System.out.println("The initial elements are ");
for(int i=0; i<len; i++)
{
System.out.print(scores[i]+" ");
}
// new line is inserted
System.out.println();
System.out.println("The elements after addition are ");
for(int i=0; i<len; i++)
{
// addition is not done for last element
if(i != len-1)
scores[i] = scores[i] + scores[i+1];
// elements of array printed backwards beginning from last element
System.out.print(scores[i]+" ");
}
}
}
OUTPUT
The elements of array are
7 10 11 9 10
The elements of array backwards are
10 9 11 10 7
Explanation:
This program uses for loop to display and add up the array elements.
The length of the array is determined by an integer variable, len.
The len variable is declared and initialized to 5.
int len = 5;
The array of integers is declared and initialized as given.
int[] scores = new int[len];
We take the array elements from the question and initialize them manually.
First, we print array elements in sequence using for loop.
for(int i=0; i<len; i++)
To display in sequence, we begin with first element which lies at index 0. The consecutive elements are displayed by incrementing the value of variable i.
The array element is displayed followed by space.
System.out.print(courseGrades[i]+" ");
Next, we set each array element to the sum of itself and the following element except the last element.
if(i != len-1)
scores[i] = scores[i] + scores[i+1];
We also display these elements simultaneously.
The length and elements of the array are initialized manually and can be changed for testing the program.
Answer:
JAVA program for the given question is as below.
public class MyProgram {
public static void main(String args[]) {
int len = 5;
int[] scores = new int[len];
scores[0] = 7;
scores[1] = 10;
scores[2] = 11;
scores[3] = 9;
scores[4] = 10;
System.out.print("This program sets each element to the sum of itself and the next element except the last element.");
System.out.println();
System.out.println("The initial elements are ");
for(int i=0; i<len; i++)
{
System.out.print(scores[i]+" ");
}
// new line is inserted
System.out.println();
System.out.println("The elements after addition are ");
for(int i=0; i<len; i++)
{
// addition is not done for last element
if(i != len-1)
scores[i] = scores[i] + scores[i+1];
// elements of array printed backwards beginning from last element
System.out.print(scores[i]+" ");
}
}
}
OUTPUT
The elements of array are
7 10 11 9 10
The elements of array backwards are
10 9 11 10 7
Explanation:
This program uses for loop to display and add up the array elements.
The length of the array is determined by an integer variable, len.
The len variable is declared and initialized to 5.
int len = 5;
The array of integers is declared and initialized as given.
int[] scores = new int[len];
We take the array elements from the question and initialize them manually.
First, we print array elements in sequence using for loop.
for(int i=0; i<len; i++)
To display in sequence, we begin with first element which lies at index 0. The consecutive elements are displayed by incrementing the value of variable i.
The array element is displayed followed by space.
System.out.print(courseGrades[i]+" ");
Next, we set each array element to the sum of itself and the following element except the last element.
if(i != len-1)
scores[i] = scores[i] + scores[i+1];
We also display these elements simultaneously.
The length and elements of the array are initialized manually and can be changed for testing the program.
A method can not be made final until whole class is madefinal.
? True
? False
Answer:
True.
Explanation:
A method can not be made final until whole class is madefinal.
The class string belongs to ................... package.
A) java.awt
B) java.lang
C) java.applet
D) java.string
Which particularlayer of OSI model is not required, if two devices communicate atthe same network?
Explain your answerwith reason.
Answer:
Network layer
Explanation:
Network layer is used when devices from different network involves communication.So,network layer is not required if devices communicate in a same network.
The network layer is concerned with the selection of network paths.
The network layer is the layer in OSI Model. This layer provides data routing paths for communication. Data is transferred on nodes via packets in an order controlled by the network layer.
This layer includes hardware devices such as bridges, firewalls ,routers and switches, but it effectively generates a logical image of the most effective communication path and implements it with a physical medium.
What is the command to create a compressed archive(archive1.tar.gz) of files test1 test2and test3.
Answer:
The command to create a compressed archive (archive1.tar.gz) is
[tex]tar\,\,-czvf\,\,archive1.tar.gz\,\,test1\,\,test2\,\,test3[/tex]
Explanation:
The explanation for the above command is
The general command to create a compressed archive is
tar -czvf name-of-archive.tar.gz /path/to/directory-or-files
Here, the terms are as follows:
-c : Creates an archive
-z : Compress the archive with gzip.
-v : This is known as verbose. This is an optional command and it displays the progress on terminal command. Without this the progress is not displayed on terminal command.
-f : Allows to specify the file name of the archive.
Here, if we want to archive multiple files, we provide the command the names of multiple files or directories of the files also can be used.
So, the command [tex]tar\,\,-czvf\,\,archive1.tar.gz\,\,test1\,\,test2\,\,test3[/tex]
creates a compressed archive - archive1.tar.gz of files test1, test2 and test3.
To create a compressed archive file named archive1.tar.gz containing the files test1, test2, and test3, use the command: tar -cvzf archive1.tar.gz test1 test2 test3.
This command creates and gzips the tarball with verbose output. For This Question use the following command:
tar -cvzf archive1.tar.gz test1 test2 test3
In this command:
-c: Create a new archive.-v: Verbose mode, so the process shows detailed output.-z: Compress the archive using gzip.-f: Specify the filename of the archive.Define embedded system and what are itsmain charactristics
Answer:
Embedded system is defined as, it is the combination of between hardware and software which performed various specific tasks. It is a dedicated functions which contain large electrical and mechanical components. Basically it is the real time computing constraint.
Example: Printers, washing machine and automobiles.
Characteristics of embedded system are:
It is performed single function and specific operations. It is based on microprocessor and micro controller.Software are used for flexibility and good features and hardware are used for the security purpose and better performance.
Write a function which accepts an integer and returns true if the number is odd or false if the number is even
Answer:
#include<stdio.h>
#include<stdbool.h>
bool isEven(int x);
main()
{
int n;
bool v;
printf("Enter an integer: \n");
scanf("%d", &n);
v = isEven(n);
if(v==true)
printf("\n The integer is even");
else
printf("\n The integer is odd");
}
bool isEven(int x)
{
if(x%2==0)
return true;
else
return false;
}
Explanation:
if the integer is divided by 2 then the integer is even
else the integer is odd.
Which of the following is NOT a valid method to increase a variable named score by 1?
a.
++score = score + 1
b.
score = score + 1
c.
score++
d.
++score
Answer:
a.
++score = score + 1
Explanation:
First you have to understand the increment operator;
There are three possible ways to increment the value of variable by 1.
1. post increment
syntax:
name++
it using in expression first then increase the value by 1.
2. Pre increment
syntax:
++name
it increase the value by 1 before it using in expression.
3. simple method
name = name +1
In the question,
option 1: ++score = score + 1
it increase the value of score by 2 because their are two increment is used first for (score + 1) and second ++score.
Therefore, the correct option is a.