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.
What scheme is usually used today for encoding signed integers?
Answer:
For encoding signed integer the two's complement scheme are used as, the number can be positive, with no fraction part and it can be negative. The computer can stored information in the form of bits and the value with the zero and one. Encoding of signed number in the two's complement with the positive integer it can be done by binary number.
. 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.
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.
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.
What is the difference between persistent and transient objects? How is persistence handled in typical OO database systems?
Final answer:
Persistent objects are stored permanently in a database, while transient objects are not and are lost when the application that created them is closed. OO database systems handle persistence by storing objects in designed database tables and often use an ORM tool to manage serializing object states for storage.
Explanation:
In the context of object-oriented databases, persistent objects are those that continue to exist after the application that created them has ended. Their state is saved in a non-volatile storage system like a database, allowing them to be retrieved and used by other applications or instances of the same application in the future. On the other hand, transient objects only exist during the lifetime of the application instance that created them; once the application is closed, transient objects are lost because they are not stored permanently.
How Persistence is Handled in OO Database Systems:
In typical object-oriented (OO) database systems, persistence is handled by storing objects in tables within the database. These tables are designed during the database design phase and are created to hold all of the necessary attributes and relationships that define the object. The process of persisting objects involves serializing the object's state and storing it in the database, often using an Object-Relational Mapping (ORM) tool that abstracts the complexity of the underlying database operations.
It is important to note that the concept of persistence of objects from LibreTexts™ is a philosophical concept about whether objects continue to exist out of perception, whereas in computer science, it refers to the longevity of data beyond the lifecycle of the program that creates it. In contrast, the problem of other minds pertains to the philosophical inquiry about the existence and nature of consciousness in others which is not directly related to database systems.
rite a program that prompts the user to enter an integer and displays each of its numbers one by one.
Answer:
#include <iostream>
using namespace std;
int main()
{
int num;
cout<<"Enter the integer: ";
cin>>num;
while(num>0){
int rem = num%10;
cout<<rem<<endl;
num = num/10;
}
}
Explanation:
First include the library iostream in the c++ programming for input/output.
Then write the main function and declare the variable.
cout is used to display the message on the screen.
cin is used to store the value in the variable.
then used the while loop and put the condition num>0
after that, take the reminder of the number by using the operator modulus '%'.
and then print it on the screen.
after that reduce the number by one digit.
This process continue until the condition not failed.
Therefore, the all digits of the number will be printed.
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.
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.
The class string belongs to ................... package.
A) java.awt
B) java.lang
C) java.applet
D) java.string
You use a ____ following the closing brace of an array initialization list.
a.
,
b.
.
c.
:
d.
;
Answer:
a.
,
Explanation:
The array is used to store the multiple data with same data type.
Syntax for initialization of array:
type name[] = {data_1, data_2, data_3,....};
the comma ',' is used to separate the data with other data.
for example:
int array[] = {1,2,3,4,5};
we cannot used dot '.', colon ':' and semicolon ';' as separator.
____ are systems in which queues of objects are waiting to be served by various servers
A.
Queuing networks
B.
Queuing systems
C.
Holding systems
Answer: Queuing systems
Explanation:
We have the queuing theory which gives us the in depth knowledge of queuing systems which helps us to predict the queue length and the waiting time at the respective nodes in an network. A group of queuing systems together constitute the queuing network. The queuing theory helps to cope with the demand of various services in an queuing network composed of queuing systems.
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.
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.
Contrast and compare: an array, a stack, and a queue. Identify the principal uses of each and give an example.
Answer:
All three of them are linear Data Structures.
A stack is a FILO(First In Last Out) or LIFO(Last In First Out) type data structure means first inserted element will be the last one to be removed form the stack.Insertion and Deletion is from one end only called head.
ex:-A stack of books on the shelf.
A queue is FIFO(First In First Out) type means the first inserted element will be the first one to be removed.In queue insertion is from the back or tail and removal of elements is done form the front.
ex:-A queue at the ticket counter.
In array each element stored is given an index, by which we can be access the element very easily. We can use this index to modify or store element at that index of the array. i.e any object can be accessed with the right index, unlike queue and stack.
We can access only the front and back in the queue.In stack we can access only the top but in array we can access any element with the index.
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)
True of False - use T or F The Throwable class implements the Serializable interface
Answer:
T
Explanation:
The java.lang.Throwable class implements the Serializable interface.
If a class implements an interface then all its subclasses also implicitly implement the interface.
Note that all Exception classes in Java inherit from java.lang.Throwable. Since Throwable is Serializable, by implication, all java Exception classes are also Serializable by default. That is, all exception classes can be serialized to a file or sent over the network is required.
Which of the following would compile without error? A. int a = Math.abs(-5); B. int b = Math.abs(5.0); C. int c = Math.abs(5.5F); D. int d = Math.abs(5L);
Answer:
int a = Math.abs(-5)
Explanation:
Math.abs() is the function which gives the absolute value of the integer.
syntax:
Math.abs(int name);
the argument enter must be integer(int).
int b = Math.abs(5.0): here, 5.0 is not the integer, it is float. So, it gives error.
int c = Math.abs(5.5F): here, 5.5F is not the integer, it is float. So, it gives error.
int d = Math.abs(5L): L stand for long but it is not int. So, it also gives error.
Therefore, the correct result is int a = Math.abs(-5), -5 is integer.
________ is used to install and update software, backup, and restore mobile devices, wipe employer software and data from devices, report usage, and provide other mobile device management data.
Answer: MDM softwares
Explanation:
Here MDM refers to mobile device management software which provides people with the facilities of updating, installing creating backup of various mobile devices within an organisation. Moreover these software's provides tools for proper monitoring and to report their usage across various independent mobile device users. MDM is often used or interconnected with the term BYOD(Bring your own device), whereby employees of an organisation bring their own mobile devices and they are being managed by a MDM software centrally.
write a program in C thats read an integer value for x andsums upto 2*x.
Answer:
#include<stdio.h>
//main function
int main(){
//initialization of variable
int temp_sum=0;
int x,i;
//display the message
printf("Enter the number:");
scanf("%d",&x);//read the number and store in the variable
//for loop which run 2*num_1 times
for(i=x;i<=2*x;i++){
temp_sum = temp_sum + i; //adding
}
//display the output
printf("The sum is: %d",temp_sum);
return 0;
}
Explanation:
Include the library stdio.h for using input/output function in c programming.
Create the main function and declare the variables.
display the message on the screen by output function printf().
read the value enter by the user and store in the variable using scanf().
Then, it takes the for loop statement which runs again and again until the condition not false.
the for loop start from value x enter by the user and the loop goes running 2 * x times.
in the for loop, add the number continuously and after the loop terminate.
the output print on the screen.
Lets dry run the code:
suppose initially, temp_sum=0, x = 4, i = 4.
the for loop start from 4, it check the condition 4 <= 8, condition True.
then,
temp_sum = 0 + 4 which is 4 assign to temp_sum.
then, loop increment the value of i and it becomes 5.
This process continues until the condition not false.
after that print the output store in the temp_sum.
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.
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.
what is ucspi-tcp pakage in qmail??
Answer: UCSPI-TCP is the sort of domain for the public that helps in building the client-server application of TCP using the command line tool of UNIX TCP in qmail
Explanation: UCSPI-TCP is referred as the UNIX Client-Server Program Interface with the help of TCP (transfer control protocol) .It is usually used for the management of the IP (internet protocol) present on the server and checks which IP's should be permitted for the connection with SMTP(simple mail transfer protocol)services.It also manages the variable or the environment constant that IP want to utilize .
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:
2) What is the value stored in the variable z by the statements below?
int[ ] q = {3, 2, -2, 4, 7, 0, 1};
int z = q.length;
a) 1
b) 3
c) 6
d) 7
e) None of the above
Answer:
7
Explanation:
Because the q.length is a inbuilt function in the programming which used to get the length of the array. In the array, there are 7 values are store. Therefore, the size 7 store in the variable z.
For example:
int[] array={1,2};
int x = array.length;
the answer of above code is 2, because the elements present in the array is 2.
What are the modes of operation of WLANs?
Answer:
WLAN's or Wireless LAN Units have 2 main modes of operation
Explanation:
The Two Main modes of Operation are the following
Infrastructure Mode: in this mode the main WLAN unit becomes the main connection point in which all devices are connected to and the main unit provides an internet connection to all the devices connected to it.
Ad Hoc Mode: in this mode devices transfer data from one another back and forth without permission from a base unit.
Some WLAN units will also include 2 extra modes of operation called Bridge and Wireless Distribution System (WDS).
Bridge Mode: this mode allows the base unit to act as an intermediary and bridge two different connection points. Such as bridging a wired connection with a wireless one.
WDS Mode: this mode uses various access points to wirelessly interconnect devices to the internet using repeaters to transmit connections. It can provide internet to both wired and wireless clients.
I hope this answered your question. If you have any more questions feel free to ask away at Brainly.
Comparison between Sendmail vs. Qmail
Answer: Sendmail and Qmail are the mail transferring agents which carry out the process of sending the mail. they also have differences between them .
Explanation: Comparison between sendmail and Qmail are as follows:-
There is less security aspect in the sendmail as compared to the Qmail which was created to overcome this issue.Qmail has faster execution and other features as compared with the sendmail.Sendmail is not highly reliable whereas Qmail has got a good reliability factor. Send mail has bigger components which make it complex and slow as compared with Qmail which has small component.the address of the last cell of a memory RAM is 3FFFFh.a total capacity of the main memory and 4M bits and the data bus can transfer the contents of two memory cells , respond
a)which register the size of the memory address(MAR) ?
b)where the maximum number of cells that can be stored in memory?
c)which the cell size of this machine ?
d)which the size of the memory buffer register (MBR ) ?
Hey there!:
Given the address of the last cell of a memory RAM is 3FFFFh then :
There are 8 bits in a byte
1024 bytes in a kilobyte
so 8*1024= 8192
so 8192 bits in a kb
32*8192 = 262144
there are 262144 bits in 32KB .
a) 32 bit address registers must match 2^32 byte = 4 GB of physical memory.
However, with 32 Bit you can also address more than 4 GB, like Physical Address Extension (PAE) does.
The other way is that you can access 4 GB with less than 32 bit address register.
____________________________________________________
b) Main Memory = 4M × 32Kbits, RAM chips = 32K × 4bit.
For this memory we require 4 × 2 = 8 RAM chips.
Each chip requires 18 address bits (ie. 218 = 256K).
And 1M × 8 bits requires 20 address bits (ie. 220 = 1M )
_____________________________________________________
c) The size of the storage cells is known as the word size for the computer.
In some computers, the word size is one byte while in other computers the word size is two, four, or even eight bytes. In our 4M main memory the size of cell is 4*2^20 bytes.
Each storage cell in main memory has a particular address which the computer can use for storing or retrieving data.
______________________________________________________
d) The size of MBR is the 4M bits of main memory.
_____________________________________________________
Hope this helps!
Write a function called calculate() that accepts three integer Numbers as arguments, compute these values : Sum and Product and Return these computed results to the main program.
Answer:
int* calculate(int a,int b,int c){
int result[] = {0,0};
int sum = a+b+c;
int product = a*b*c;
result[0] = sum;
result[1] = product;
return result;
}
Explanation:
The function is a block of the statement which performs the special task.
The function can return one integer, not more than one integer.
If we want to return multiple values then, we can use array.
we store the result in the array and return that array to the main function.
This is the only possible way to return multiple values.
So, define the function with return type array and declare the array with zero value.
Then, calculate the values and store in the variable after that, assign to the array.
Finally, return that array.
A database has a built-in capability to create, process and administer itself.
A.
True
B.
False
Answer:
false
Explanation: