## Top 50 Programming Questions For Beginners

1. State the differences between a variable and a constant?

2. What is the role of a loop in programming?

3. Name three types of data structures used in programming?

4. Describe the function of each data structure used in programming with an example of its usage.

5. How do you decide which type of data structure to use for your program?

6. What are some rules to follow when writing a program?

7. Write a simple program that adds two numbers together, and then subtracts one number from another number that has already been added together.

8. State the differences between a function and a method?

9. State the differences between a function and a procedure?

10. What is the difference between a subroutine and a function?

11. How do you use an if statement?

12. What are the rules for using an else clause in a program?

13. How can you check whether or not a variable has been assigned before using it in your program, and what would happen if it hadn’t been assigned yet?

14. Can you define variables at definition time and then use them at run-time without assigning them? If so, how do you do it? If not, why not?

15. Write a program that prints the numbers from 1 to 100 using a loop.

16. Write a program that prints the sum of two numbers using recursion.

17. Write a program that prints all the prime numbers from 2 to n using for-loop or recursion?

18. Write a program that uses recursion to find out the length of each word in an input string from the user

19. How many times can you make a loop?

20. Write a program that returns all prime numbers less than 10 up to 100, in order: (1), (2), (3), (4), (5).

21. Write a program that takes as input a list of numbers and returns as output an index into the list where each element occurs exactly once, using repetition in at most one line of code only. For example, given [1; 2; 3; 4], return 2 .

22. Write a program that takes as input a list of positive integers and returns as output the maximum number in this set, using repetition in at most one line of code only

23. What is meant by procedural language?

24. What is meant by object-oriented language?

25. What is the difference between a loop and a program?

26. Describe three types of loops in Python.

27. What is the difference between a variable and a constant?

28. Write a program that prints out all integers from 1 to 100 inclusive.

29. Write a program that prints out all integers from 101 to 200 inclusive.

30. How do I print a string in reverse order?

31. How do I print all the numbers from 1 to 100 without repeating any number?

32. How do I print all the numbers from 1 to 100 in reverse order?

33. Write a program that will take in an array of integers, and then output the largest integer in that array?

34. Can you write a function that will take a string, and then return a substring that is at least 3 characters long but not more than 10 characters long?

35. What is the difference between a high-level language and a low-level language?

35. How to print the value of a variable in C++?

36. What is a pointer in C++? How do you use it to manipulate data within an array?

37. What is the difference between an if statement and a while loop?

38. What are the steps involved in calling a function in C++?

39. How do you declare variables in C++?

40. What are the steps involved in calling a function using pointers in C++ programming language?

41. How do you define arrays in C++ Programming Language? How do you declare them, initialize them and use them for different purposes such as looping through them, etc.? What are their uses?

42. What is dynamic memory allocation and how does it work in C++ programming language?

43. What is the difference between a variable and a constant?

44. How do you define the size of a variable in your program?

45. What does the term “scope” mean in programming?

46. What are some advantages of indexing over using pointers and arrays?

47. How do you define an input/output device in C++?

48. How do you initialize variables in C++?

49. What is meant by “implementation inheritance”?

50. How can you check whether a string has any more characters than it already has (not counting null?)?

Related Topics