KDAB’s 20 Years Developer Challenge – NOW CLOSED Participants were invited to solve the tasks to win a cool gadget

Participants were invited to solve the tasks to win a cool gadget

KDAB turned twenty at the end of 2019!

We wanted to celebrate that in a special way with our customers, partners and all developers giving you the chance to win some cool stuff!

As KDAB is especially known for its expertise in cross-platform development with Qt, C++ and 3D technologies like OpenGL, we thought of a different kind of challenge.

Instead of asking you annoying questions like the year of KDAB’s founding or what KD stands for, we wanted to challenge your developer skills. 🙂

In order to win one of the attractive prizes – with KDAB’s know-how inside – participants were invited to solve some tricky tasks and submit the correct solutions. The challenge closed on 31st of December 2019. The winners were drawn from all the correct submissions.

And the winners are:

Prize: a 20l Braumeister kit, Daniel S., Terlan, Italy Prize: a reMarkable Tablet, Slobodan K., Skopje, North Macedonia Prize: a reMarkable Tablet, David E., Kempston, England

The answers can be viewed here.

Tasks

Below were the tasks for our challenge. In order to win one of the prizes, participants were asked to submit correct answers by 31st of December 2019.

(You can also download the code for these tasks.)

1. Find all bugs in the following code (why does the assert fail):

#include <QString> #include <QDebug> int main(int argc, char *argv[]) { Q_UNUSED(argc) Q_UNUSED(argv) QString hello = "Hello, world!"; for (int i = 0; i < hello.length(); ++i) { auto current = hello[i]; // Changing a local variable current = current.toUpper(); // Printing it out qDebug() << "Current: " << current; } // The original string is unchanged Q_ASSERT(hello == "Hello, world"); }

View the solution

2. Fix the undefined behavior (a crash) in the following code without slowing it down:

#define QT_USE_QSTRINGBUILDER #include <QString> #include <QDebug> #include <QTranslator> #include <QObject> int main(int argc, char *argv[]) { Q_UNUSED(argc) Q_UNUSED(argv) const QString youre = "You are"; auto message = youre + " " + QObject::tr("number six"); qDebug() << "Message is: " << message; }

View the solution

3. Rewrite the following function to use algorithms from the standard library instead of for/while/do-while loops. Make sure the implementation is as efficient as possible:

#include <QtGlobal> #include <vector> int counting(const std::vector & xs, const std::vector & ys) { int result = 0; for (auto x: xs) { bool flag = true; for (auto y: ys) { if (y < x) flag = false; } if (flag) result++; } return result; } int main(int argc, char *argv[]) { Q_UNUSED(argc) Q_UNUSED(argv) Q_ASSERT(counting(std::vector {1, 2, 3}, std::vector {2, 3, 4}) == 2); }

View the solution

Prize details

First Prize

1 x Braumeister Plus 20l kit (new model coming out in spring 2020*)

The Braumeister was specially developed as a brewing system for the aspiring and active hobby and home brewer. The next product generation is coming out 2020.

KDAB helped Braumeister slim down the operating system to just the necessary features, configure start-up of software components and connect them to each other. Through using Qt and QML we were able to realize our customers’ design and interaction ideas. This, along with added touch features, makes the Braumeister system an intuitive and visually rich brewing experience for all users.

You could be one of those first users!

For detailed information about the product check out this link...

By the way, you can also use a Braumeister kit to brew alcohol free beer. And if you win the first prize, but don't like beer brewing, we will look for a way to exchange your prize with another winner.

Second and Third Prizes

2 x reMarkable The Paper Tablets including Folios

reMarkable is a digital device that gives you a pen-to-paper note-taking experience. It converts your handwritten notes to typed text, making them easy to refine and share. KDAB helped reMarkable with our expertise in C++, QML and performance optimization. For more information about the device check www.remarkable.com

Terms of participation

By submitting your solutions for the "KDAB 20 years developer challenge", here referred to as "challenge", you agree to the following: