(a) Write a program in any high-level language to read an integer and display a pattern like the one below. For example, if the given integer is…
(a) Write a program in any high-level language to read an integer and display a pattern like the one below. For example, if the given integer is 1234, the following pattern will be printed:
1 2 3 4
2 3 4
3 4
4
(b) What is a friend function? Given the following class, show how to add a friend function named isneg() that takes one parameter of type myclass and returns true if num is negative and false otherwise.
class myclass {
int num;
public:
myclass(int i) { num = i; }
};From the BPSC Assistant Director (ICT) May 2025 – Written exam, question 6 of 9.
More from this paper
- Previous: (a) Describe the following terms: (i) Supervised learning (ii) Unsupervised learning (iii) Reinforcement learning (b) Given the following…
- Next: (a) Apply Kruskal's algorithm to the following graph to find the cost of the minimum spanning tree (MST). The graph is undirected; the…
- All questions in BPSC Assistant Director (ICT) May 2025 – Written