
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 26504 Articles for Server Side Programming

552 Views
The problem states that what will be the working or the output if the scanf is followed by fgets()/gets()/scanf().fgets()/gets() followed by scanf()Example Live Demo#include int main() { int x; char str[100]; scanf("%d", &x); fgets(str, 100, stdin); printf("x = %d, str = %s", x, str); return 0; }OutputInput: 30 String Output: x = 30, str =Explanationfgets() and gets() are used to take string input from the user at the run time. I above code when we run enter the integer value then it won’t take the string value because when we gave newline after the integer ... Read More

7K+ Views
Process synchronization is the technique to overcome the problem of concurrent access to shared data which can result in data inconsistency. A cooperating process is the one which can affect or be affected by other process which will lead to inconsistency in processes data therefore Process synchronization is required for consistency of data.The Critical-Section ProblemEvery process has a reserved segment of code which is known as Critical Section. In this section, process can change common variables, update tables, write files, etc. The key point to note about critical section is that when one process is executing in its critical section, ... Read More

1K+ Views
Given a complex number in the form of x+yi and an integer n; the task is calculate and print the value of the complex number if we power the complex number by n.What is a complex number?A complex number is number which can be written in the form of a + bi, where a and b are the real numbers and i is the solution of the equation or we can say an imaginary number. So, simply putting it we can say that complex number is a combination of Real number and imaginary number.Raising power of a complex numberTo raise ... Read More

1K+ Views
Given a number k and an array arr[n], containing n number of integer elements which are storing the id’s of the opened apps in a system; the task is to show k number of most recently used apps, like when we press alt+tab shows all the recent apps and most recent before the least recent. The position of every id represents different apps in a system −They are as follows −Id in arr[0] is the id of an app which is currently in use.Id in arr[1] is the id of an app which was most recently used.Id in arr[n-1] is ... Read More

1K+ Views
Given weights and values of n items; the task is to print the items according to 0/1 knapsack for the following weights and values in a knapsack of capacity W, to get the maximum total value in the knapsack.What is 0/1 Knapsack?Knapsack is like a bag with only a fixed size or a bag which can handle a certain amount of weight. Each item which is included in a knapsack have some value(profit) and some weight to it. We have to add those weights which will get us the maximum profit according to the total weight a knapsack could hold.So ... Read More

175 Views
Given an array arr[n] containing n prime numbers and k; the task is to find the product of every k’th prime number in an array.Like, we have an array arr[] = {3, 5, 7, 11} and k = 2 so the prime number after every k i.e 5 and 11 we have to find their product which will be 5x11 = 55 and print the result as output.What are prime numbers?A prime number is a natural number which can’t be divided by any other number except 1 or the number itself. Some of the prime numbers are 2, 3, 5, ... Read More

646 Views
Given the task is to print the written C program itself.We have to write a C program which will print itself. So, we can use file system in C to print the contents of the file of which we are writing the code, like we are writing the code in “code 1.c” file, so we open the file in the read mode and read all the contents of the file and print the results on the output screen.But, before opening a file in read mode, we must know the name of the file we are writing code in. So, we ... Read More

4K+ Views
Given points A and B corresponding to line AB and points P and Q corresponding to line PQ; the task is to find the point of intersection between these two lines. Note − The points are given in 2D plane on X and Y coordinates. Here A(a1, a2), B(b1, b2) and C(c1, c2), D(d1, d2) are the coordinates which are forming two distinct lines and P(p1, p2) is the point of intersection. (just for a diagrammatic explanation of the point of intersection) How to find the point of intersection − Let’s take the above figure as − Example So ... Read More

1K+ Views
Given a DFA string of characters ‘a’ and ‘b’, which should start and end with the character ‘a’ the task is to find whether the string starts and ends with ‘a’ through a DFA.What is DFA(Deterministic Finite Automata)?In theory of computation, a branch of theoretical computer science, Deterministic Finite Automata is a finite state machine which accepts or reject strings of symbols. Deterministic refers to the uniqueness of the computation to run.For finding the string by a DFA and the string should start and end with ‘a’ from the input (a, b). Since there is no concept of memory and ... Read More

558 Views
Probability is the chances of getting the desired output from the set of data available. The range of probability lie between 0 and 1 where an integer 0 shows the chances of impossibility and 1 indicates certainty.What is probability?Probability in mathematics gives us the tools that tell the uncertainty of the events and reasons. In other words we can say probability deals with calculating the likelihood of a given event’s occurrence, which can be expressed as a number between 1 and 0. For example: the probability of getting a head’s when an unbiased coin is tossed, or getting a 3 ... Read More