# Cpp Programming preview questions

### C++ PROGRAMMING TEST

Problem Statement :

You are given an integer n. You need to count the total number of digit 1 appearing in all non-negative integers less than or equal to n.
The function countDigit() accepts the parameters integer n. Complete the function countDigit() and return the count_of_one in integer format.
For Example: If the integer is 13 then count of 1 from 0 to 13 i.e. {1,10,11,12,13} is 6.
Constraints: 0<=n<=100000000

Testcase 1

Input: n=10

Output: count_of_one = 2

Testcase 2

Input: n=15

Output: count_of_one = 8

Problem Statement :

You are given an array arr of size n consisting of positive and negative integers including 0. You need to find the smallest positive integer which is missing from the array.
The function smallest_positive() accepts the parameters array of integer arr having size n . Complete the function smallest_positive() and return the value of missing_number in the integer format.
For Example: If the array arr is [-2,0,3,5,6,13] of size 6 then the smallest missing number will be 1.
Constraints:
1<=n<=3000

Testcase 1

Input: n=10
arr= [5,1,-6,2,0,12,-5,24,10,-22]

Output: missing_number= 3

Testcase 2

Input: n=9
arr=[1,-2,4,0,-6,3,2,5,6]

Output: missing_number= 7

Fill up the form to continue : 