+ Start a Discussion
charan@appcharan@app 

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.

NaishadhNaishadh

You can use math.random for fetching questions.

WesNolte__cWesNolte__c

Hey,

 

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;

  chosenQuestions.add(questions[index]);

}

 

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

 

Wes

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>();
if(!i.contains(rand)){
quess = [SELECT Name FROM Questions__c limit 1 OFFSET :rand];
}
i.add(rand);
System.debug('@@@@Account@@@@@'+quess);

venkateshyadav1243venkateshyadav1243

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

 

 

Thanks,

venkatesh.

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

rajesh(tcs)

Jeniffer CullenJeniffer Cullen
Prepare for Salesforce Certification  from website : https://www.ebsose.com. Available 24*7 Support . Immediate Delivery. 
Project support and Salesforce training is also provided for Admin , Development , Integration , CPQ and QA at www.ebsose.com . 
For all latest salesforce certification SU20 materials mail us at ebsosedotcom@gmail.com
If you need help on any superbadge or salesforce certification mail us at ebsosedotcom@gmail.com
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 https://www.allrecentdumps.com
For all latest salesforce certification dumps mail us at allrecentdumps@gmail.com
If you need help on any superbadge or salesforce certification mail us at allrecentdumps@gmail.com
24*7 AND IMMEDIATE DELIVERY OF DUMPS.
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