Accenture Previous Year Coding Questions | Accenture Previous Coding Questions and Answers | Accenture Last Year Coding Questions | Accenture Previous Year Coding Questions Pdf download
Accenture Previous Year Coding Questions: Some of the previous questions helps to get more marks in your examinations or test. Aspirants focussed to prepare the Previous Year Questions for easy to crack the examinations. In the Company of Accenture is released the hiring every month for various eligible candidates. The candidates who applied the Accenture Hiring, they must attend the selection process. The Selection is based on the coding test, assessment test, technical test etc., Candidates eagerly prepare for the Accenture Coding Test Round. Those who will be selected in the Accenture Coding Test, they will be move on further selection process.
The Accenture Previous Coding Questions is helping to achieve the selection round. Continuous practising of the Accenture Previous Coding Questions and answers, it gives idea and got a repeated asked question. Accenture Previous Year Coding Questions and Answers will be uploaded in the official website. Accenture Previous Coding Questions contains programming wise coding questions like Accenture Java Coding questions & Answers, Accenture Python Coding Questions etc., Candidates clearly solved the Accenture Previous Coding Question and Answers/ Accenture Previous Coding questions etc.,
Accenture Previous Year Coding Questions & Answers
Q) Problem Description :
C Program
Java Program
import java.util.*; class Main { public static int solve (int r, int unit, int arr[], int n) { if (arr == null) return -1; int res = r * unit; int sum = 0; int count = 0; for (int i = 0; i < n; i++) { sum = sum + arr[i]; count++; if (sum >= res) break; } if (sum < res) return 0; return count; } public static void main (String[]args) { Scanner sc = new Scanner (System.in); int r = sc.nextInt (); int unit = sc.nextInt (); int n = sc.nextInt (); int arr[] = new int[n]; for (int i = 0; i < n; i++) arr[i] = sc.nextInt (); System.out.println (solve (r, unit, arr, n)); } }
C++ Program
#include<bits/stdc++.h> using namespace std; int OperationsBinaryString (char *str) { if (str == NULL) return -1; int i = 1; int a = *str - '0'; str++; while (*str != '\0') { char p = *str; str++; if (p == 'A') a &= (*str - '0'); else if (p == 'B') a |= (*str - '0'); else a ^= (*str - '0'); str++; } return a; } int main () { string s; getline (cin, s); int len = s.size (); char *str = &s[0]; cout << OperationsBinaryString (str); }
C+ Program
def OperationsBinaryString(str): a=int(str[0]) i=1 while i< len(str): if str[i]=='A': a&=int(str[i+1]) elif str[i]=='B': a|=int(str[i+1]) else: a^=int(str[i+1]) i+=2 return a str=input() print(OperationsBinaryString(str))
Java program
import java.util.*; class Main { public static int operationsBinaryString (String str) { if (str == null) return -1; int res = str.charAt (0) - '0'; for (int i = 1; i < str.length ();) { char prev = str.charAt (i); i++; if (prev == 'A') res = res & (str.charAt (i) - '0'); else if (prev == 'B') res = res | (str.charAt (i) - '0'); else res = res ^ (str.charAt (i) - '0'); i++; } return res; } public static void main (String[]args) { Scanner sc = new Scanner (System.in); String str = sc.next (); System.out.println (operationsBinaryString (str)); } }
Java program
import java.util.*; class Main { public static int findCount (int arr[], int length, int num, int diff) { int count = 0; for (int i = 0; i < length; i++) { if (Math.abs (num - arr[i]) <= diff) count++; } return count > 0 ? count : -1; } public static void main (String[]args) { Scanner sc = new Scanner (System.in); int n = sc.nextInt (); int arr[] = new int[n]; for (int i = 0; i < n; i++) arr[i] = sc.nextInt (); int num = sc.nextInt (); int diff = sc.nextInt (); System.out.println (findCount (arr, n, num, diff)); } }
Q) Implement the following Function
def differenceofSum(n. m)
The function accepts two integers n, m as arguments Find the sum of all numbers in range from 1 to m(both inclusive) that are not divisible by n. Return difference between sum of integers not divisible by n with sum of numbers divisible by n.
Assumption:
- n>0 and m>0
- Sum lies between integral range
Example
Input
n:4
m:20
Output
90
Explanation
- Sum of numbers divisible by 4 are 4 + 8 + 12 + 16 + 20 = 60
- Sum of numbers not divisible by 4 are 1 +2 + 3 + 5 + 6 + 7 + 9 + 10 + 11 + 13 + 14 + 15 + 17 + 18 + 19 = 150
- Difference 150 – 60 = 90
Sample Input
n:3
m:10
Sample Output
19
C++ Program
#include<stdio.h> int differenceofSum (int n, int m) { int i, sum1 = 0, sum2 = 0; for (i = 1; i <= m; i++) { if (i % n == 0) { sum1 = sum1 + i; } else { sum2 = sum2 + i; } } if (sum2 > sum1) return sum2 - sum1; else return sum1 - sum2; } int main () { int n, m; int result; scanf ("%d", &n); scanf ("%d", &m); result = differenceofSum (n, m); printf ("%d", result); return 0; }
}
Python Program
n = int(input()) m = int(input()) sum1 = 0 sum2 = 0 for i in range(1,m+1): if i % n == 0: sum1+=i else: sum2+=i print(abs(sum2-sum1))
Java Program
C program
#include <iostream> #include <algorithm> int productSmallestPair (int *array, int n, int sum) { int answer, temp, i, j, check; if (n < 2) { answer = -1; } else { for (i = 0; i < n; i++) { // sorting of array for (j = i + 1; j < n; j++) { if (array[i] > array[j]) { temp = array[i]; array[i] = array[j]; array[j] = temp; } } } check = array[0] + array[1]; if (check <= sum) { answer = array[0] * array[1]; } else { answer = 0; } } return answer; } int main () { int n, sum, result, i; std::cin >> sum; std::cin >> n; int *array = new int[n]; for (i = 0; i < n; i++) { std::cin >> array[i]; } result = productSmallestPair (array, n, sum); std::cout << result; delete[]array; return 0; }
C Program
#include<stdio.h> int productSmallestPair (int *array, int n, int sum) { int answer, temp, i, j, check; if (n < 2) { answer = -1; } else { for (i = 0; i < n; i++) //sorting of array { for (j = i + 1; j < n; j++) { if (array[i] > array[j]) { temp = array[i]; array[i] = array[j]; array[j] = temp; } } } check = array[0] + array[1]; if (check <= sum) { answer = array[0] * array[1]; } else { answer = 0; } } return answer; } int main () { int n, sum, result, i; scanf ("%d", &sum); scanf ("%d", &n); int array[n]; for (i = 0; i < n; i++) { scanf ("%d", &array[i]); } result = productSmallestPair (array, n, sum); printf ("%d", result); return 0; }
Java Program
import java.util.*; class Main { public static int productSmallestPair (int arr[], int n, int sum) { if (n <2) return -1; int ans, temp, check; for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { if (arr[i] > arr[j]) { temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; } } } check = arr[0] + arr[1]; if (check <= sum) return arr[0] * arr[1]; else return 0; } public static void main (String[]args) { Scanner sc = new Scanner (System.in); int sum = sc.nextInt (); int n = sc.nextInt (); int arr[] = new int[n]; for (int i = 0; i < n; i++) arr[i] = sc.nextInt (); System.out.println (productSmallestPair (arr, n, sum)); } }
Python Program
n = int(input()) sum1 = int(input()) arr = list(map(int, input().split())) if n < 2: print('-1') arr = sorted(arr) for i in range(n-1): if arr[i] + arr[i+1] < sum1: print(arr[i] * arr[i+1]) break else: print('0')
Input: 6 4 9 8 3 -7 3 9 Output: -21
JOB ALERT ON INSTAGRAM | FOLLOW NOW>> |
JOB ALERT ON YOUR EMAIL DAILY | SUBSCRIBE NOW>> |
Here candidates got an Accenture Previous Coding questions with solutions/ Accenture Coding Questions 2024 etc., Aspirants or Examiners kindly check the dailyrecruitment.in site for more informative updates.
Govt Jobs by Qualifications
Education & Vacancies | Salary | Apply Link |
---|---|---|
12th Pass Govt Jobs - 18,000+ Vacancies | Rs. 5,200 - 92,300 | Apply Now |
ITI Pass Jobs - 3,500 Vacancies | Rs. 5,200 - 35,000 | Apply Now |
Any Graduate Jobs - 19,100 Vacancies | Rs. 5,200 - 92,300 | Apply Now |
Central Govt Jobs | Rs. 5,200 - 17,000 | Apply Now |
Bank Jobs - 1,000 Vacancies | Rs. 5,200 - 29,200 | Apply Now |
Diploma Jobs - 9,300 Vacancies | Rs. 5,200 - 35,000 | Apply Now |
BTech/BE Jobs - 18,000 Vacancies | Rs. 15,000 - 1,00,000 | Apply Now |
Data Entry Jobs - 1,300 Vacancies | Rs. 5,200 - 29,200 | Apply Now |
Private Jobs | Rs. 10,000 - 67,700 | Apply Now |