If an array has a 100 elements what is the allowable range of subscripts?
Since arrays in C are zero based, the allowed subscript range is 0 - 99 (gives 100 values). Always remember to subtract 1 from the high range (in this case 100) to get the last subscript maximum value.
When might you omit a break statement from the end of a case in a switchstatement?
You can omit the break statement at the end of a case whenever you want execution to flow into the next case, or when the case is the last case.
For instance, if you wanted to test a character regardless of whether it was upper or lower case, you might use the following:
void f(char c)
{
switch (c)
{
case 'a': // execution flows into next case...
case 'A':
// do something
break;
case 'b': // execution flows into next case...
case 'B':
// do something else
}
}
How do you get a output like 1 23 456 78910?
in java,, class floydstriangle
{
public void main()
{
int a,b,c=1;
for(a=1;a<=4;a++)
{
for(b=1;b<=a;b++)
{
System.out.print(c);
c++;
}
System.out.println();
}
}
}
Stack can be described as a pointer Explain?
Stack is also dynamic memory, without the hassle. Dynamic memory uses pointers to check its value, free the memory, etc.
import TerminalIO.*;
public class nn8{
public static void main(String[] args){
KeyboardReader reader=new KeyboardReader();
System.out.println("Enter your ages");
int x,y=0;
x=reader.readInt();
for(int i=1;i<=20;x=i)
y=x+i;
System.out.println("the sum is" +y);
}
}
What is the difference between active and passive objects in c plus plus?
Passive objects encapsulate state and operations, whereas active objects also encapsulate a process. Standard C++ does not support active objects.
What is peep operation in stack using array in c?
I guess you mean operation top: return the topmost element without deleting it from the stack.
int top (const struct stack *from, stacktype *into)
{
if (from->elements==0) return -1; /* EMPTY */
*into = from->array[from->elements -1];
return 0; /* OK */
}
compare with pop:
int pop (struct stack *from, stacktype *into)
{
if (from->elements==0) return -1; /* EMPTY */
*into = from->array[from->elements -1];
--from->elements;
return 0; /* OK */
}
Which header file should be included to use functions like malloc and calloc?
stdlib.h
Next time try the built-in help/manual before asking.
What is function Explain the user define function with example?
Function is a logically grouped piece of code allowing perform certain types of operations. Function can return value (int, double etc) or be void type - meaning they do not return value.
Functions allow to make code cleaner by moving out chunks of code of main body. For instance you want to write a function that finds area of rectangular.
#include <iostream>
using std cin;
using std cout;
using std endl;
using std get;
int main()
{
double sideA = 0.0;
cout << "Enter side a of rectagular: ";
cin >> sideA;
double sideB = 0.0;
cout << endl << "Enter side b of rectangular: ";
cin >> sideB;
//This part passes sides a and b to user defined function "Square"
cout << endl << "Area of rectangular is: " << Square(a, b);
cin.get();
return 0;
}
//definition of user defined function Square
double Square(double a, double b)
{
return (a * b);
}
WAP to read any two numbers and display largest of them?
Using if-else statement
#include<stdio.h>
#include<conio.h>
int main(void)
{
long int n,i;
clrscr();
printf("\n Enter any two nos.");
scanf("%ld%ld",&n,&i);
if(n>i)
printf("\nThe largest no. is=%ld",n);
else
printf("\nthe largest no. is=%ld",i);
getch();
return 0;
}
using ternary operator
#include<stdio.h>
#include<conio.h>
int main(void)
{
int n,i,a;
clrscr();
printf("\n Enter any two nos.");
scanf("%d%d",&n,&i);
a=(n>i?n:i);
printf("\nThe largest no. is=%d",a);
getch();
return 0;
}
The micrometer is a precision measuring instrument, used by engineers. Each revolution of the rachet moves the spindle face 0.5mm towards the anvil face.
What is formula to find sum of n even numbers?
There is no formula that will sum n even numbers without further qualifications: for example, n even numbers in a sequence.
What are the data security threats and what controls can be put in place to curb the threats?
Historically, information security solutions have focused on preventing external threats such as viruses, hackers and worms through perimeter solutions that include firewalls and antivirus software. While still aware of outside threats, companies are now coming to understand they can no longer ignore inside violations concerning data at rest. So information security and privacy is of atmost importance whether it is internal or external.
Today's employees are able to easily export sensitive files and information via email or by copying to file shares and portable media without concerning about data security and data privacy. Many companies simply do not have the resources or appropriate policies in place to identify NPI and PII and avoid inadvertent, accidental mis-steps or malicious actions from within. As companies continue to accumulate NPI and PII, they are under enormous pressure to mitigate risk and to provide data security to sensitive information before an undesirable loss occurs. Whether you call it data security, Content Loss Prevention or simply Information Security solutions & Privacy, the time has come to take steps to protect your company's data privacy.
Deployed in under 30 minutes, the Kazeon's Information Server i.e. information security solutions system discovers sensitive information contained in emails and files regardless of physical or logical location.
How to write a C program to find largest 2 numbers using pointers?
program to find maximum of two numbers using pointers
What is difference between C and lisp?
If i know the answer i better open face book rather than this...
O(m*n).