My Report (&Account)

KPMG Coding Questions - Apr-May 2025


Correct Answer: 2 points | Wrong: -1 point
Grades: A* (100% score) | A (80%-99%) | B (60%-80%) | C (40%-60%) | D (0%-40%)
Don't Press Next Button if Question 1 is not visible. It can take upto 2 minutes due to server load.

C Programming (Ch1)

1. What will be the output of the following C code?

    #include <stdio.h>
    int main()
    {
        int x = 2, y = 2;
        x /= x / y;
        printf("%d\n", x);
        return 0;
    } 

Question 1 of 50

C Programming (Ch2)

2. What is an example of iteration in C?

Question 2 of 50

C Programming (Ch3)

3. What is the scope of a function?

Question 3 of 50

C Programming (Ch4)

4. Which of the following are generated from char pointer?

Question 4 of 50

C Programming (Ch5)

5. What is the advantage of a multidimensional array over pointer array?

Question 5 of 50

C Programming (Ch6)

6. Which of the following function with ellipsis are illegal?

Question 6 of 50

C Programming (Ch7)

7. calloc() initialize memory with all bits set to zero.

Question 7 of 50

C Programming (Ch8)

8. What will be the output of the following C code?

char str1[15];
char str2[15];
int mat;
strcpy(str1, "abcdef");
strcpy(str2, "ABCDEF");
mat= strncmp(str1, str2, 4);
if(mat< 0)
printf("str1 is not greater than str2");
else if(mat> 0)
printf("str2 is is not greater than str1");
else
printf("both are equal");

Question 8 of 50

C Programming (Ch9)

9. Initial seed is ________ for the function srand(unsigned int seed).

Question 9 of 50

C Programming (Ch10)

10. What will be the output of the following C code?

#include<stdio.h>
#define san 557
int main()
{
    #ifndef san
    printf("yes");
    #endif
    printf("no");
}

Question 10 of 50

C++ Programming (Ch1)

11. Which of the following C++ code will give error on compilation?

================code 1=================
#include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
	cout<<"Hello World";
	return 0;
}
========================================
================code 2=================
#include <iostream>
int main(int argc, char const *argv[])
{
	std::cout<<"Hello World";
	return 0;
}
========================================

Question 11 of 50

C++ Programming (Ch2)

12. When we define the default values for a function?

Question 12 of 50

C++ Programming (Ch3)

13. What is the default type of linkage that is available for identifiers?

Question 13 of 50

C++ Programming (Ch4)

14. What will be the output of the following C++ code?

#include <iostream>
#include <string>
using namespace std;
int main ()
{
  std::string str ("Sanfoundry.");
  str.back() = '!';
  std::cout << str << endl;
  return 0;
}

Question 14 of 50

C++ Programming (Ch5)

15. Which of the following is used for generic programming?

Question 15 of 50

C++ Programming (Ch6)

16. What will be the output of the following C++ code?

 
    #include<iostream>
    #include "math.h"
    using namespace std;
    double MySqrt(double d)
    {
        if (d < 0.0)
        throw "Cannot take sqrt of negative number";     
        return sqrt(d);
    }
    int main()
    {
        double d = 5;
        cout << MySqrt(d) << endl;
    } 

Question 16 of 50

C++ Programming (Ch7)

17. Pick the correct statement.

Question 17 of 50

C++ Programming (Ch8)

18. What is the use of sum() function in Valarray?

Question 18 of 50

C++ Programming (Ch9)

19. What kind of execution does sequence point allow?

Question 19 of 50

C++ Programming (Ch10)

20. What will the max function in the numeric limit will return for type float?

Question 20 of 50

Java Programming (Ch1)

21. An expression involving byte, int, and literal numbers is promoted to which of these?

Question 21 of 50

Java Programming (Ch2)

22. What will be the output of the following Java program?

   class box 
   {
        int width;
        int height;
        int length;
   } 
    class mainclass 
    {
        public static void main(String args[]) 
        {        
            box obj = new box();
            System.out.println(obj);
        } 
    }

Question 22 of 50

Java Programming (Ch3)

23. What will be the output of the following Java program?

 
    class recursion 
    {
        int func (int n) 
        {
            int result;
            result = func (n - 1);
            return result;
        }
    } 
    class Output 
    {
        public static void main(String args[]) 
        {
            recursion obj = new recursion() ;
            System.out.print(obj.func(12));
        }
    }

Question 23 of 50

Java Programming (Ch4)

24. Which of these method returns a largest whole number less than or equal to variable X?

Question 24 of 50

Java Programming (Ch5)

25. Which of these exceptions is thrown by URL class's constructors?

Question 25 of 50

Java Programming (Ch6)

26. What is the remaining capacity of BlockingQueue whose intrinsic capacity is not defined?

Question 26 of 50

Java Programming (Ch7)

27. Which of these keywords is used to by the calling function to guard against the exception that is thrown by called function?

Question 27 of 50

Java Programming (Ch8)

28. Which of these formatting strings of SimpleDateFormat class is used to print week of the year?

Question 28 of 50

Java Programming (Ch9)

29. What type of methods an interface contain by default?

Question 29 of 50

Java Programming (Ch10)

30. Which mode allows us to run program interactively while watching source code and variables during execution?

Question 30 of 50

Python Programming (Ch1)

31. What will be the output of the following Python expression?

4^12

Question 31 of 50

Python Programming (Ch2)

32. What will be the output of the following Python code?

d = {0: 'a', 1: 'b', 2: 'c'}
for x in d.keys():
    print(d[x])

Question 32 of 50

Python Programming (Ch3)

33. What will be displayed by print(ord('b') - ord('a'))?

Question 33 of 50

Python Programming (Ch4)

34. What will be the output of the following Python code?

import copy
a=[10,23,56,[78]]
b=copy.deepcopy(a)
a[3][0]=95
a[1]=34
print(b)

Question 34 of 50

Python Programming (Ch5)

35. What will be the output of the following Python code snippet?

total={}
def insert(items):
    if items in total:
        total[items] += 1
    else:
        total[items] = 1
insert('Apple')
insert('Ball')
insert('Apple')
print (len(total))

Question 35 of 50

Python Programming (Ch6)

36. How many keyword arguments can be passed to a function in a single function call?

Question 36 of 50

Python Programming (Ch7)

37. What will be the output of the following Python code?

x = [[0], [1]]
print((' '.join(list(map(str, x)))))

Question 37 of 50

Python Programming (Ch8)

38. Which of the following cannot be returned by random.randrange(4)?

Question 38 of 50

Python Programming (Ch9)

39. What will be the output of the following Python code?

import re
re.ASCII

Question 39 of 50

Python Programming (Ch10)

40. Which of the following best describes inheritance?

Question 40 of 50

Data Structure (Ch1)

41. Which of the following is not a disadvantage to the usage of array?

Question 41 of 50

Data Structure (Ch2)

42. Using the evaluation of prefix algorithm, evaluate +-9 2 7.

Question 42 of 50

Data Structure (Ch3)

43. Which of the following arrays are used in the implementation of list data type in python?

Question 43 of 50

Data Structure (Ch4)

44. What are implicit and explicit implementations of freelists?

Question 44 of 50

Data Structure (Ch5)

45. What is the expected number of leaves in a randomized binary search tree?

Question 45 of 50

Data Structure (Ch6)

46. What are the operations that could be performed in O(logn) time complexity by red-black tree?

Question 46 of 50

Data Structure (Ch7)

47. Reducing search space by eliminating irrelevant trees is known as?

Question 47 of 50

Data Structure (Ch8)

48. What is the time per operation of merging, insertion and deletion operations in a skew heap?

Question 48 of 50

Data Structure (Ch9)

49. Which of the following trait of a hash function is most desirable?

Question 49 of 50

Data Structure (Ch10)

50. Given Adjacency matrices determine which of them are PseudoGraphs?
i) {{1,0} {0,1}}
ii) {{0,1}{1,0}}
iii) {{0,0,1}{0,1,0}{1,0,0}}

Question 50 of 50


 


   

KPMG Test Series

The KPMG Test Series offers comprehensive preparation with multiple sets that simulate the actual exam. These tests cover all key areas and are designed to improve your skills and confidence.


KPMG Coding Questions (Set 1 to 10)

Our KPMG Coding Questions comprises of 10 sets, where each set covers a specific topic (focus area) which helps you to build your skills progressively.


Coding Questions (All Companies)


Frequently Asked Questions

Q1. What are KPMG coding questions?
KPMG coding questions are part of the company's technical assessment process, designed to evaluate a candidate's programming skills, problem-solving abilities, and understanding of data structures, algorithms, and coding fundamentals.

Q2. What topics are covered in the KPMG Coding Test?
The test may include questions from the following topics:

  • Computer Fundamentals
  • C Programming
  • C++ Programming
  • Java Programming
  • Python
  • Data Structure
  • Design and Analysis of Algorithm
Q3. Why are Coding Tests important in Recruitment?
Coding tests evaluate technical skills, problem-solving ability, and practical application of knowledge, ensuring fairness and identifying top talent for technical roles.

Q4. Can I use online compilers during the test?
No, online compilers are usually not allowed. Most tests provide a built-in code editor and compiler to complete your tasks.

Q5. How can I prepare for coding test?
Practice coding problems on platforms like Sanfoundry, focus on key topics like algorithms and data structures, and take mock tests to improve speed and accuracy.

Q6. Where can I find resources for coding practice?
You can visit Sanfoundry Programming MCQs and coding challenges to access a wide variety of problems across different topics and difficulty levels.

Q7. How often should I practice for the test?
Practice regularly, ideally daily or a few times a week, to build consistency and improve your problem-solving skills over time.

Q8. Is the KPMG Coding Test difficult?
The KPMG Coding Test can be challenging, but the difficulty varies based on your coding skills and preparation. With regular practice and a strong understanding of algorithms and problem-solving, you can make it manageable and perform well.

Q9. Can I retake the KPMG Coding Test?
Yes, you can retake the KPMG Coding Test on Sanfoundry as many times as you want. However, for official recruitment, it depends on the company's policy for retaking tests during the selection process.
advertisement
advertisement
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.