Logical or operator can be compared to what in terms of precedence?
The logical OR operator can be compared to ____ in terms of precedence.
Definite interations: Repeated sequence of calculations/ operations for a fixed number of repetitions. (Do or For loop) Indefinite iteration: no set limit on iterations, generally "while" loops. multiple interations is the same as multiple repetitions or trials.
Why is char often treated as integer data type?
The char data type is an integral type and can therefore be used to represent integers as well as characters. However, in order to treat the representation as an actual integer, it must be explicitly converted to a non-character type, such as int.
Swap 2 variable without a 3rd variable in c program?
This can be done using the bitwise exclusive-or(XOR) operator.
int X = 16 // Binary 010000
int Y = 32 // Binary 100000
X = X ^ Y // X = 110000
Y = X ^ Y // Y = 010000
X = X ^ Y // X = 100000
This is good to know but is not widely practiced, as it is far simpler to use a temporary variable, and less prone to bugs.
int temp = X;
X = Y;
Y = temp;
C program for finding square root of positive no?
#include<stdio.h>
#include<conio.h>
float SquareRoot(float num);
void main()
{
float input, ans;
clrscr();
printf("\n Enter The Number : ");
scanf("%f", &input);
ans = SquareRoot(input);
printf("\n Square Root : %f", ans);
getch();
}
float SquareRoot(float num)
{
if(num >= 0)
{
float x = num;
int i;
for(i = 0; i < 20; i ++)
x = (((x * x) + num) / (2 * x));
return x;
}
}
Should element in an array must be of primitive data type?
No, it can be array, structure or union as well.
What are some disadvantages of using case structures to program multiple alternative decisions?
Using case structures becomes difficult when programming multiple alternative decisions. Instead of listing each of the steps and executing them individually, it is easier to make decision structures and loops.
How does one draw a triangle in C console?
#include<stdio.h>
void main()
{
int row,column,add,sub,h,noofrows,noofcolumns,j,finish;
printf("how many rows do you want in your triangle\n");
scanf("%d",&noofrows);
noofcolumns=noofrows-1;
for(row=1;row<=noofrows-1;row=row+1)
{
for(column=-noofcolumns;column<=noofcolumns;column=column+1)
{
add=row+column;
sub=row-column;
if(add==1sub==1)
{
printf("*");
}
else
{
printf(" ");
}
}
printf("\n");
}
finish=((noofrows+noofrows)-1);
for(j=1;j<=finish;j=j+1)
{
printf("*");
}
scanf("%d",&h);
}
How do C and C plus plus differ in terms of data abstraction and classes and structs?
They differ insofar as C does not use object-oriented programming at all -- there are no classes (only structures), therefore there was nothing to abstract. C++ (which literally means 'the successor to C') is an extension of C that primarily adds object-orientated support to the language. Everything you can do in C you can also do in C++, but with the added benefits of OOP you can do a whole lot more, more easily, including the creation of abstract data types.
Every complete statement ends with a?
Any teacher will expect you to answer by saying a semicolon (;), but this is not strictly true. First of all, the definition of a "line of code" varies from teacher to teacher and textbook to textbook. Second, even the Java Language Specification lists several types of Java statements which do not need to end in a semicolon.
In general, a complete Java statement will end in either of semicolon or a closing block brace.
Design the logic code for program to print numbers in reverse order from 10 down to 1?
Enter values and end of the list enter -1 to see output. but execute it at command line.
<?php
function readData(){
fwrite(STDOUT, "Please enter your name\n");
// Read the input
$name = fgets(STDIN);
if($name != -1)
readData();
fwrite(STDOUT, "Hello $name");
return;
}
readData();
?>
start
num Sub
num Size = 10
index = 0
while index<10
index = index + 1
endwhile
while index > 0
index = index - 1
endwhile
print Sub
stop
What is a sparse matrix in c programming?
Sparse matirx can be represented 1-dimensionally, by creating a array of structures, that have members sumc as: Struct RM{int ROW,int COL, int non_zero}; struct RM SM[Number_non_Zeros +1]; then input row,col for each non-zero element of the sparse matrix. if still unclear please fell free to requestion or query on ikit.bbsr@gmail.com, specifying clearly the question in the subject. Chinmaya N. Padhy (IKIT)
What are Different types of assembly language statements?
The three types of assembly language are:
1. Imperative: indicates an action to be performed.
2. Declaration
3. Assembler Directives
32 how many arrays can you make?
You shouldn't wikianswer your homework, tardface. I can eat a pineapple in less than 2 minutes.
In a doubly linked list, you can iterate backwards as easily as forwards, as each element contains links to both the prior and the following element. You can also insert or delete an element without needing to iterate and remember the prior element's link. This comes at a cost. You are adding storage to each element for the second link, and you are adding processing overhead to the insert and delete operation. You have to determine the tradeoff.
What are the advantages of insertion sort?
It is less efficient on list containing more number of elements.
As the number of elements increases the performance of the program would be slow.
Insertion sort needs a large number of element shifts.
What development tool that helps programmers write compile and test their programs?
Microsoft Visual Studio comes with Visual Basic,Visual C++ etc.You can use them to create programs.
Why you define static data member in global declaration?
Defining a static data member in a global declaration allows for its visibility throughout the entire file while restricting its linkage to that file only. This means that the static member can be accessed by all functions and classes within the same translation unit but cannot be accessed from other files, promoting encapsulation. It helps in managing shared data while preventing name clashes in larger projects. Additionally, it aids in maintaining a single instance of the data member, conserving memory and ensuring consistent behavior.
Why pointers are called derived data type?
Pointers are called derived data types because they derive their meaning from the type of data they point to, rather than holding a direct value. Specifically, a pointer stores the memory address of another variable, allowing for indirect access to that variable's data. This relationship enables more complex data structures, such as linked lists and trees, to be created and manipulated in programming. Additionally, pointers facilitate dynamic memory allocation, enhancing the flexibility and efficiency of memory management in applications.
What has been strongest influence on programming language design?
The strongest influence will always be the need and the demand for it.
for instance, with regards to security, if there are so many virus or hack attacks
then definitely a new security program is needed.
another is if the current program cannot handle the growth of a company
then a new set of programs is in order.
and then there is the cost of maintaining a program.
why pay more when one can get it for a much cheaper program.
Program to find the size of the string in c?
int main (void) {
char buf[1024];
scanf ("Enter a string: %s", buf);
printf ("The length of the string is %d chars long.\n", strlen (buf));
return 0;
}
What translates a high level language into machine code?
An interpreter or a compiler. The former translates one line at a time and must be executed within the interpreter. The latter compiles the entire program into a standalone executable. For example, C++ is compiled to machine code but Java is compiled to byte code which is then interpreted by the Java Virtual Machine.