Ask Programiz - Human Support for Coding Beginners
Explore questions from fellow beginners answered by our human experts. Have some doubts about coding fundamentals? Enroll in our course and get personalized help right within your lessons.

endl in C++ stands for "end line". It's used to move the output to the next line, just like pressing Enter on the keyboard.
For example:
cout << number1 << endl;
This prints the value of number1, then moves the cursor to the next line before printing anything else.
We can clearly see this in the practice exercise:
int number1 = 89;
int number2 = 313.78;
cout << number1 << endl;
cout << number2;
Output with endl:
89
313.78
Without endl (if we wrote cout << number1;):
89313.78
So endl helps keep output clean and readable by separating it into lines.

DSA (Data Structures and Algorithms) is all about solving problems efficiently using the right tools.
Data structures help organize and store data—like arrays, lists, stacks, queues, trees, and graphs.
Algorithms are step-by-step instructions to perform tasks like searching, sorting, or finding the shortest path.
Real-Life Examples of DSA in Action:
Search engines use efficient algorithms to return results in milliseconds.
Social media platforms use graph algorithms to suggest friends and show relevant content.
GPS apps use shortest path algorithms (like Dijkstra’s) to find the fastest routes.
E-commerce websites use sorting and recommendation algorithms to show you useful product suggestions.
In short, DSA makes software faster, smarter, and more responsive. It’s not just for interviews or school—it’s what helps technology scale and perform in the real world.
Learning DSA also builds strong problem-solving skills and helps you understand how systems work under the hood.
You can also check out our blog Data Structures and Algorithms in Everyday Life to learn more on this.

No, you don't need always quotation marks when creating variables. For example,
age = 25In this case, age is a variable that stores the value 25. Since 25 is a number, we don't need to use quotation marks around it.
However, if you're storing a string in a variable, you must enclose the value with quotation marks. For example,
favorite_food = "Pizza"Here, favorite_food is a variable, storing the string "Pizza".
As for spaces around the equal sign, Python doesn’t require them, but adding spaces makes the code easier to read:
age=25
age = 25Here, age=25 works but age = 25 is cleaner and easier to understand.

In C, you can take user input using the scanf() function. It reads values entered by the user and stores them in variables. For example,
#include
int main() {
int number;
printf("Enter a number: ");
// Take input and store it in number variable
scanf("%d", &number);
printf("You entered: %d\n", number);
return 0;
} Output
Enter a number: 42
You entered: 42Here,
printf()asks the user to enter a number.scanf("%d", &number);takes the user's input and stores it in thenumbervariable.%dtellsscanfthat you're expecting an integer.&numberis the address of the variable where the input will be stored.
Finally,
printf()displays the entered number.
Note: Always remember to use & (address-of operator) before the variable name in scanf().

In C++, the return 0; statement simply indicates that the program has completed successfully. It tells the system that the program ran without errors.
For example:
#include
using namespace std;
int main() {
cout << "Hello, world!" << endl;
return 0;
} In the code:
The program prints
"Hello, world!".The
return 0;line sends a status code back to the system—0traditionally means success.If something went wrong in your program and you wanted to signal that to the system, you could return a non-zero value like
return 1;.
Why does this matter?
If you're running your program in a larger system or calling it from a script, the return value lets that system know whether the program succeeded. This is useful in automated testing, system monitoring, or when chaining commands in shell scripts.
So while it may seem small, return 0; plays an important role in communicating the outcome of your program to the system.

Yes, you can use f-strings outside of print().
An f-string is just a formatted string, meaning you can use it anywhere a string is used.
Example 1: Assigning to a variable:
name = "Alice"
message = f"Hello, {name}"
print(message) # Output: Hello, AliceExample 2: Writing to a file:
age = 30
with open("info.txt", "w") as file:
file.write(f"User age: {age}")Example 3: Passing as a function argument:
def greet(msg):
print(msg)
greet(f"Welcome back, {name}!")In all of these examples, the f-string is being used to build a string dynamically with variables or expressions, then used just like any regular string—stored, written, passed, or returned.
F-strings are one of the most efficient and readable ways to format strings in Python, and you'll keep finding more ways to use them as your projects grow.

The main difference between function overloading and function overriding in C++ comes down to where and how the functions are defined.
1. Function overloading
Happens in the same class
Functions have the same name but different parameters (different number or types)
The compiler decides which function to call based on the arguments
Example:
#include
using namespace std;
class Animal {
public:
// Function with no parameters
void make_sound() {
cout << "Animal Sound" << endl;
}
// Overloaded function with an integer parameter
void make_sound(int count) {
cout << "Animal Sound (" << count << ") times" << endl;
}
};
int main() {
Animal a1;
// Calls the function without parameters
a1.make_sound(); // Output: Animal Sound
// Calls the overloaded function with an integer argument
a1.make_sound(10); // Output: Animal Sound (10 times)
return 0;
} Here, calling make_sound() and make_sound(10) will call different versions of the function.
2. Function overriding
Happens between a base class and a derived class
Functions have the same name and parameters
The derived class function replaces the base class function when called via an object of the derived class
Example:
#include
using namespace std;
class Animal {
public:
// Function to make a generic animal sound
void make_sound() {
cout << "Animal Sound" << endl;
}
};
class Dog: public Animal {
public:
// Overrides the Animal class' make_sound() function
void make_sound() {
cout << "Woof Woof" << endl;
}
};
int main() {
// Create object of the child (Dog) class
Dog dog1;
// Calls the overridden function in child (Dog) class
// and not base (Animal) class
dog1.make_sound();
return 0;
}
// Output: Woof Woof Here, calling make_sound() on the Dog class executes the function of the Dog class, overriding the make_sound() function of the Animal class.
Also, one thing to note is just because function overloading happens within the same class doesn't mean it can't be used alongside inheritance.
You can still overload functions in a base class and its derived class, as long as the overloaded functions follow the usual rules—having the same name but different parameter lists.


The use of %d and %d% is related to the LIKE operator, which is used to search for a specified pattern in a column. The % character is a wildcard that can represent any sequence of characters (including no characters at all). Here's how they work:
%d: This pattern is used to find values that end with the letter 'd'. For example,
SELECT * FROM table WHERE column LIKE '%d';This will return all rows where the column ends with the letter 'd'. For example, it would match "keyboard", "mousepad", and "sand".
%d%: This pattern is used to find values that contain the letter 'd' anywhere in the string. For example,
SELECT * FROM table WHERE column LIKE '%d%';This will return all rows where the column contains the letter 'd' at any position in the string. For example, it would match "ride", "window", and "card".

printf() is used to display text or values on the screen.
For Example:
printf("Hello, World");
The above code displays the text Hello, World on the screen.
I hope this clears your confusion. If you have more questions feel free to ask!

In C, scanf() is used to read input from the user, while printf() is used to display output on the screen.
Think of it this way:
scanf()receives data (input)printf()sends data to the screen (output)
Example:
#include
int main() {
int age;
printf("Enter your age: "); // Output
scanf("%d", &age); // Input
printf("You are %d years old.", age); // Output
return 0;
} Here, printf() first prompts the user, and then scanf() captures the input into the age variable. After that, printf() is used again to show the result.
Our Experts
Sudip BhandariHead of Growth/Marketing
Apekchhya ShresthaSenior Product Manager
Kelish RaiTechnical Content Writer
Abhilekh GautamSystem Engineer
Palistha SinghTechnical Content Writer
Sarthak BaralSenior Content Editor
Saujanya Poudel
Abhay Jajodia
Nisha SharmaTechnical Content Writer
Udayan ShakyaTechnical Content Writer