function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Developing Online Exam

I am trying to develop an online exam.


I was successful in keeping all the questions and writing class for them.

It works fine, but I need some questions which should be randomly picked from object.

Every time these questions should be different.

How can we achieve randomly ques from db?


Help me out at earliest.


You can use math.random for fetching questions.




List<Question__c> questions = [SELECT id, name, body FROM Question__c];

LIst<Question__c> chosenQuestions = new List<Question__c>();

Integer listSize = questions.size();


for(Integer i = 0; i< 10; i++){

  Integer index = Math.random * listSize;




This isn't perfect, you could add the same question more than once for example, but it will get you started.



chowdary marellachowdary marella

iam using the following but getting repeated,can you please suggest?


Integer rand = Math.floor(Math.random()*14).intValue();

quess = new list<Questions__c>();
quess = [SELECT Name FROM Questions__c limit 1 OFFSET :rand];


Hi Charn am also developing the online exam using apex,visualforce.


can please tel me design and if u code can u please send me





rajesh mummadirajesh mummadi

hello i also had a task for developing the online exam using apex,visualforce...please can any one send the source code for this.



thank you


Jeniffer CullenJeniffer Cullen
Prepare for Salesforce Certification  from website : Available 24*7 Support . Immediate Delivery. 
Project support and Salesforce training is also provided for Admin , Development , Integration , CPQ and QA at . 
For all latest salesforce certification SU20 materials mail us at
If you need help on any superbadge or salesforce certification mail us at
Summer 20 Dumps all Available
We have Following latest certification of 
0. B2B Commerce Admin
1. Admin 201
2. App Builder
3. Platform developer 1
4. Platform Developer 2
5. Sales Cloud
6. Service Cloud
7. Community Cloud
8. Marketing cloud Email Specialist
9. Marketing cloud Cloud Consultant
10. CPQ
11. FSL
12. Data Management Architecture
13. Integration architecture
14. Identity Access management
15. Development Lifecycle
16. Pardot Specialist
17. Advance Admin
18. Sharing Visibilty Designer 
19. Einstein Analytics
20. Non- Profit Cloud
21. Marketing cloud developer 1
Luther waltonLuther walton
Now Salesforce All latest Updated every week dumps available at
For all latest salesforce certification dumps mail us at
If you need help on any superbadge or salesforce certification mail us at
All Summer 20 Dumps are available. We have Following latest certification of 
•    Copado Admin
•    Copado Developer
•    Vlocity Platform Essential
•    B2B Commerce Admin    
•    Javascript Developer 1 Dumps
•    Admin 201
•    App Builder
•    Platform developer 1
•    Platform Developer 2
•    Sales Cloud
•    Service Cloud
•    Community Cloud
•    Marketing cloud Email Specialist
•    Marketing cloud Cloud Consultant
•    Marketing Cloud Admin
•    Marketing Cloud Developer
•    CPQ Specialist
•    Field Service Lightning
•    Data Management Architecture
•    Integration architecture
•    Identity Access management
•    Development Lifecycle
•    Pardot Specialist
•    Advance Admin
•    Sharing Visibilty Designer 
•    Einstein Analytics
Thomas JohThomas Joh
You can contact me for any help and exact questions and answers for ALL the latest Winter 21 certifications at salesforcecertguide2018[at] 100% pass rate. All exact screenshots and 100% accuracy. Trusted by ALL for passing all their exams. We offer one to one guidance as well.
Kate Hooper 3Kate Hooper 3
I recently passed the Salesforce-Certified-Administrator exam and I learned many things along the way. Hopefully, these suggestions will help you succeed with your exam.

Download Full Practice Exam Material Here:
I worksI works
It is just increasing spam on your site. They are providing irrelevant and non-syllabus-based questions. This is a spammy site. Remove its comments from the forums.